mirror of https://github.com/rancher/dashboard.git
fix creating repository with secret
This commit is contained in:
parent
ddbb569fe5
commit
4b49ba26b1
|
|
@ -23,7 +23,7 @@ export default class SelectOrCreateAuthPo extends ComponentPo {
|
|||
|
||||
createSSHAuth(privateKey: string, publicKey: string) {
|
||||
this.authSelect().toggle();
|
||||
this.authSelect().clickOptionWithLabel('Create a SSH Auth Secret');
|
||||
this.authSelect().clickOptionWithLabel('Create a SSH Key Secret');
|
||||
this.setAuthSecret('ssh', privateKey, publicKey);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import AsyncButtonPo from '@/cypress/e2e/po/components/async-button.po';
|
|||
import LabeledSelectPo from '@/cypress/e2e/po/components/labeled-select.po';
|
||||
import RadioGroupInputPo from '@/cypress/e2e/po/components/radio-group-input.po';
|
||||
import NameNsDescription from '@/cypress/e2e/po/components/name-ns-description.po';
|
||||
import SelectOrCreateAuthPo from '@/cypress/e2e/po/components/select-or-create-auth.po';
|
||||
|
||||
export default class ChartRepositoriesCreateEditPo extends PagePo {
|
||||
private static createPath(clusterId: string, product: 'apps' | 'manager', repoName?: string ) {
|
||||
|
|
@ -44,6 +45,14 @@ export default class ChartRepositoriesCreateEditPo extends PagePo {
|
|||
return new AsyncButtonPo('[data-testid="action-button-async-button"]', this.self());
|
||||
}
|
||||
|
||||
authSelectOrCreate(selector: string) {
|
||||
return new SelectOrCreateAuthPo(selector);
|
||||
}
|
||||
|
||||
clusterrepoAuthSelectOrCreate() {
|
||||
return this.authSelectOrCreate('[data-testid="clusterrepo-auth-secret"]');
|
||||
}
|
||||
|
||||
saveAndWaitForRequests(method: string, url: string) {
|
||||
cy.intercept(method, url).as('request');
|
||||
this.saveCreateForm().click();
|
||||
|
|
|
|||
|
|
@ -126,4 +126,68 @@ describe('Cluster Management Helm Repositories', { testIsolation: 'off', tags: [
|
|||
// check list details
|
||||
cy.contains(this.repoName).should('not.exist');
|
||||
});
|
||||
|
||||
it('can create a repository with basic auth', function() {
|
||||
ChartRepositoriesPagePo.navTo();
|
||||
repositoriesPage.waitForPage();
|
||||
repositoriesPage.waitForGoTo('/v1/catalog.cattle.io.clusterrepos?exclude=metadata.managedFields');
|
||||
repositoriesPage.create();
|
||||
repositoriesPage.createEditRepositories().waitForPage();
|
||||
repositoriesPage.createEditRepositories().nameNsDescription().name().set(this.repoName);
|
||||
repositoriesPage.createEditRepositories().nameNsDescription().description().set(`${ this.repoName }-description`);
|
||||
repositoriesPage.createEditRepositories().repoRadioBtn().set(1);
|
||||
repositoriesPage.createEditRepositories().gitRepoUrl().set('https://git.rancher.io/charts');
|
||||
repositoriesPage.createEditRepositories().gitBranch().set('release-v2.8');
|
||||
repositoriesPage.createEditRepositories().clusterrepoAuthSelectOrCreate().createBasicAuth('test', 'test');
|
||||
repositoriesPage.createEditRepositories().saveAndWaitForRequests('POST', '/v1/catalog.cattle.io.clusterrepos');
|
||||
repositoriesPage.waitForPage();
|
||||
|
||||
// check list details
|
||||
repositoriesPage.list().details(this.repoName, 2).should('be.visible');
|
||||
repositoriesPage.list().details(this.repoName, 1).contains('In Progress').should('be.visible');
|
||||
repositoriesPage.list().actionMenu(`${ this.repoName }`).getMenuItem('Delete').click();
|
||||
|
||||
const promptRemove = new PromptRemove();
|
||||
|
||||
cy.intercept('DELETE', `v1/catalog.cattle.io.clusterrepos/${ this.repoName }`).as('deleteRepository');
|
||||
|
||||
promptRemove.remove();
|
||||
cy.wait('@deleteRepository');
|
||||
repositoriesPage.waitForPage();
|
||||
|
||||
// check list details
|
||||
cy.contains(`${ this.repoName }`).should('not.exist');
|
||||
});
|
||||
|
||||
it('can create a repository with SSH key', function() {
|
||||
ChartRepositoriesPagePo.navTo();
|
||||
repositoriesPage.waitForPage();
|
||||
repositoriesPage.waitForGoTo('/v1/catalog.cattle.io.clusterrepos?exclude=metadata.managedFields');
|
||||
repositoriesPage.create();
|
||||
repositoriesPage.createEditRepositories().waitForPage();
|
||||
repositoriesPage.createEditRepositories().nameNsDescription().name().set(this.repoName);
|
||||
repositoriesPage.createEditRepositories().nameNsDescription().description().set(`${ this.repoName }-description`);
|
||||
repositoriesPage.createEditRepositories().repoRadioBtn().set(1);
|
||||
repositoriesPage.createEditRepositories().gitRepoUrl().set('https://git.rancher.io/charts');
|
||||
repositoriesPage.createEditRepositories().gitBranch().set('release-v2.8');
|
||||
repositoriesPage.createEditRepositories().clusterrepoAuthSelectOrCreate().createSSHAuth('privateKey', 'publicKey');
|
||||
repositoriesPage.createEditRepositories().saveAndWaitForRequests('POST', '/v1/catalog.cattle.io.clusterrepos');
|
||||
repositoriesPage.waitForPage();
|
||||
|
||||
// check list details
|
||||
repositoriesPage.list().details(this.repoName, 2).should('be.visible');
|
||||
|
||||
repositoriesPage.list().actionMenu(`${ this.repoName }`).getMenuItem('Delete').click();
|
||||
|
||||
const promptRemove = new PromptRemove();
|
||||
|
||||
cy.intercept('DELETE', `v1/catalog.cattle.io.clusterrepos/${ this.repoName }`).as('deleteRepository');
|
||||
|
||||
promptRemove.remove();
|
||||
cy.wait('@deleteRepository');
|
||||
repositoriesPage.waitForPage();
|
||||
|
||||
// check list details
|
||||
cy.contains(`${ this.repoName }`).should('not.exist');
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ export default Vue.extend({
|
|||
<template>
|
||||
<textarea
|
||||
ref="ta"
|
||||
data-testid="text-area-auto-grow"
|
||||
:data-testid="$attrs['data-testid'] ? $attrs['data-testid'] : 'text-area-auto-grow'"
|
||||
:disabled="isDisabled"
|
||||
:style="style"
|
||||
:placeholder="placeholder"
|
||||
|
|
|
|||
|
|
@ -28,6 +28,9 @@ export default {
|
|||
},
|
||||
|
||||
computed: {
|
||||
inStore() {
|
||||
return this.$store.getters['currentProduct'].inStore;
|
||||
},
|
||||
secretNamespace() {
|
||||
const tryNames = ['cattle-system', 'default'];
|
||||
|
||||
|
|
@ -37,7 +40,7 @@ export default {
|
|||
}
|
||||
}
|
||||
|
||||
return this.$store.getters['cluster/all'](NAMESPACE)[0]?.id;
|
||||
return this.$store.getters[`${ this.inStore }/all`](NAMESPACE)[0]?.id;
|
||||
}
|
||||
},
|
||||
|
||||
|
|
@ -118,10 +121,12 @@ export default {
|
|||
/>
|
||||
|
||||
<SelectOrCreateAuthSecret
|
||||
data-testid="clusterrepo-auth-secret"
|
||||
v-model="value.spec.clientSecret"
|
||||
:register-before-hook="registerBeforeHook"
|
||||
:namespace="secretNamespace"
|
||||
:limit-to-namespace="false"
|
||||
:in-store="inStore"
|
||||
generate-name="clusterrepo-auth-"
|
||||
/>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue