Skip to content

Commit

Permalink
add e2e test for disabling/enabling a repo
Browse files Browse the repository at this point in the history
  • Loading branch information
Mo Mesgin authored and Mo Mesgin committed Jan 21, 2025
1 parent 3812fc8 commit a547bf8
Showing 1 changed file with 47 additions and 3 deletions.
50 changes: 47 additions & 3 deletions cypress/e2e/tests/pages/manager/repositories.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import * as jsyaml from 'js-yaml';
import { LONG_TIMEOUT_OPT } from '@/cypress/support/utils/timeouts';

const chartBranch = `release-v${ CURRENT_RANCHER_VERSION }`;
const gitRepoUrl = 'https://github.com/rancher/charts';

describe('Cluster Management Helm Repositories', { testIsolation: 'off', tags: ['@manager', '@adminUser'] }, () => {
const repositoriesPage = new ChartRepositoriesPagePo(undefined, 'manager');
Expand All @@ -27,7 +28,7 @@ describe('Cluster Management Helm Repositories', { testIsolation: 'off', tags: [
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://github.com/rancher/charts');
repositoriesPage.createEditRepositories().gitRepoUrl().set(gitRepoUrl);
repositoriesPage.createEditRepositories().gitBranch().set(chartBranch);
repositoriesPage.createEditRepositories().saveAndWaitForRequests('POST', '/v1/catalog.cattle.io.clusterrepos').its('response.statusCode').should('eq', 201);
repositoriesPage.waitForPage();
Expand Down Expand Up @@ -129,7 +130,7 @@ describe('Cluster Management Helm Repositories', { testIsolation: 'off', tags: [
repositoriesPage.createEditRepositories().nameNsDescription().name().set(`${ this.repoName }basic`);
repositoriesPage.createEditRepositories().nameNsDescription().description().set(`${ this.repoName }-description`);
repositoriesPage.createEditRepositories().repoRadioBtn().set(1);
repositoriesPage.createEditRepositories().gitRepoUrl().set('https://github.com/rancher/charts');
repositoriesPage.createEditRepositories().gitRepoUrl().set(gitRepoUrl);
repositoriesPage.createEditRepositories().gitBranch().set(chartBranch);
repositoriesPage.createEditRepositories().clusterRepoAuthSelectOrCreate().createBasicAuth('test', 'test');
repositoriesPage.createEditRepositories().saveAndWaitForRequests('POST', '/v1/catalog.cattle.io.clusterrepos');
Expand All @@ -148,7 +149,7 @@ describe('Cluster Management Helm Repositories', { testIsolation: 'off', tags: [
repositoriesPage.createEditRepositories().nameNsDescription().name().set(`${ this.repoName }ssh`);
repositoriesPage.createEditRepositories().nameNsDescription().description().set(`${ this.repoName }-description`);
repositoriesPage.createEditRepositories().repoRadioBtn().set(1);
repositoriesPage.createEditRepositories().gitRepoUrl().set('https://github.com/rancher/charts');
repositoriesPage.createEditRepositories().gitRepoUrl().set(gitRepoUrl);
repositoriesPage.createEditRepositories().gitBranch().set(chartBranch);
repositoriesPage.createEditRepositories().clusterRepoAuthSelectOrCreate().createSSHAuth('privateKey', 'publicKey');
repositoriesPage.createEditRepositories().saveAndWaitForRequests('POST', '/v1/catalog.cattle.io.clusterrepos');
Expand Down Expand Up @@ -254,4 +255,47 @@ describe('Cluster Management Helm Repositories', { testIsolation: 'off', tags: [
// check list details
cy.contains(this.repoName).should('not.exist');
});

it('can disable/enable a repository', function() {
// create repo
ChartRepositoriesPagePo.navTo();
repositoriesPage.waitForPage();
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(gitRepoUrl);
repositoriesPage.createEditRepositories().gitBranch().set(chartBranch);
repositoriesPage.createEditRepositories().saveAndWaitForRequests('POST', '/v1/catalog.cattle.io.clusterrepos').its('response.statusCode').should('eq', 201);
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');

// disable repo
repositoriesPage.list().actionMenu(this.repoName).getMenuItem('Disable').click();
repositoriesPage.list().details(this.repoName, 1).contains('Disabled', { timeout: 10000 }).scrollIntoView()
.should('be.visible');

// enable repo
repositoriesPage.list().actionMenu(this.repoName).getMenuItem('Enable').click();
repositoriesPage.list().details(this.repoName, 1).contains('Active', LONG_TIMEOUT_OPT).scrollIntoView()
.should('be.visible');

// delete repo
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');
});
});

0 comments on commit a547bf8

Please sign in to comment.