diff --git a/cypress/e2e/po/components/select-or-create-auth.po.ts b/cypress/e2e/po/components/select-or-create-auth.po.ts index edfb65dc0b6..88a0a5e2715 100644 --- a/cypress/e2e/po/components/select-or-create-auth.po.ts +++ b/cypress/e2e/po/components/select-or-create-auth.po.ts @@ -7,23 +7,31 @@ export default class SelectOrCreateAuthPo extends ComponentPo { return new LabeledSelectPo(`${ this.selector } [data-testid="auth-secret-select"]`, this.self()); } - setAuthSecret(secretType: string, username: string, password: string) { - const privateKey = new LabeledInputPo(`${ this.selector } [data-testid="auth-secret-${ secretType }-private-key"]`, this.self()); - const publicKey = new LabeledInputPo(`${ this.selector } [data-testid="auth-secret-${ secretType }-public-key"]`, this.self()); + setBasicAuthSecret(username: string, password: string) { + const usernameInput = new LabeledInputPo(`${ this.selector } [data-testid="auth-secret-basic-username"]`, this.self()); + const passwordInput = new LabeledInputPo(`${ this.selector } [data-testid="auth-secret-basic-password"]`, this.self()); - privateKey.set(username); - publicKey.set(password); + usernameInput.set(username); + passwordInput.set(password); + } + + setSSHSecret(privateKey: string, publicKey: string) { + const privateKeyInput = new LabeledInputPo(`${ this.selector } [data-testid="auth-secret-ssh-private-key"]`, this.self()); + const publicKeyInput = new LabeledInputPo(`${ this.selector } [data-testid="auth-secret-ssh-public-key"]`, this.self()); + + privateKeyInput.set(privateKey); + publicKeyInput.set(publicKey); } createBasicAuth(username = 'auth-test-user', password = 'auth-test-password') { this.authSelect().toggle(); this.authSelect().clickOptionWithLabel('Create a HTTP Basic Auth Secret'); - this.setAuthSecret('basic', username, password); + this.setBasicAuthSecret(username, password); } createSSHAuth(privateKey: string, publicKey: string) { this.authSelect().toggle(); - this.authSelect().clickOptionWithLabel('Create a SSH Auth Secret'); - this.setAuthSecret('ssh', privateKey, publicKey); + this.authSelect().clickOptionWithLabel('Create a SSH Key Secret'); + this.setSSHSecret(privateKey, publicKey); } } diff --git a/cypress/e2e/po/edit/chart-repositories.po.ts b/cypress/e2e/po/edit/chart-repositories.po.ts index 02acb43339b..4d2584a70ba 100644 --- a/cypress/e2e/po/edit/chart-repositories.po.ts +++ b/cypress/e2e/po/edit/chart-repositories.po.ts @@ -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(); diff --git a/cypress/e2e/po/pages/global-settings/home-links.po.ts b/cypress/e2e/po/pages/global-settings/home-links.po.ts index ccb434fe0e6..c186ec02db0 100644 --- a/cypress/e2e/po/pages/global-settings/home-links.po.ts +++ b/cypress/e2e/po/pages/global-settings/home-links.po.ts @@ -44,7 +44,7 @@ export class HomeLinksPagePo extends RootClusterPage { } urlInput(): LabeledInputPo { - return new LabeledInputPo('[data-testid="text-area-auto-grow"]'); + return new LabeledInputPo('[data-testid="value-multiline"]'); } applyButton() { diff --git a/cypress/e2e/tests/pages/manager/repositories.spec.ts b/cypress/e2e/tests/pages/manager/repositories.spec.ts index 8a7f4fa4e14..a480e6bb425 100644 --- a/cypress/e2e/tests/pages/manager/repositories.spec.ts +++ b/cypress/e2e/tests/pages/manager/repositories.spec.ts @@ -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'); + }); }); diff --git a/pkg/rancher-components/src/components/Form/TextArea/TextAreaAutoGrow.vue b/pkg/rancher-components/src/components/Form/TextArea/TextAreaAutoGrow.vue index e69287393f4..67e7dd6a048 100644 --- a/pkg/rancher-components/src/components/Form/TextArea/TextAreaAutoGrow.vue +++ b/pkg/rancher-components/src/components/Form/TextArea/TextAreaAutoGrow.vue @@ -155,7 +155,7 @@ export default Vue.extend({