Skip to content

Commit

Permalink
Merge pull request #11529 from richard-cox/fix-chart-icon-test
Browse files Browse the repository at this point in the history
Ensure we only check for charts that exist for generic chart icons
  • Loading branch information
richard-cox committed Jul 25, 2024
2 parents e108b95 + b76db01 commit f3c02c9
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 31 deletions.
1 change: 0 additions & 1 deletion cypress/e2e/tests/pages/explorer/apps/charts.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ describe('Apps/Charts', { tags: ['@explorer', '@adminUser'] }, () => {
});

it('Charts have expected icons', () => {
chartsPage.checkChartGenericIcon('External IP Webhook', true);
chartsPage.checkChartGenericIcon('Alerting Driver', false);
chartsPage.checkChartGenericIcon('CIS Benchmark', false);
chartsPage.checkChartGenericIcon('Logging', false);
Expand Down
64 changes: 34 additions & 30 deletions cypress/e2e/tests/pages/explorer/apps/repositories.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import { ChartsPage } from '@/cypress/e2e/po/pages/explorer/charts/charts.po';

describe('Apps', () => {
describe('Repositories', { tags: ['@explorer', '@adminUser'] }, () => {
const reposToDelete = [];

describe('Add', () => {
const appRepoList = new ReposListPagePo('local', 'apps');

Expand All @@ -19,29 +17,38 @@ describe('Apps', () => {
cy.createE2EResourceName('helm-repo-dupe-test').as('helmRepoDupeName');
});

it('After add Repo list should not contain multiple entries', function() {
const appRepoCreate = new AppClusterRepoEditPo('local', 'create');
describe('Contained', () => {
const reposToDelete = [];

it('After add Repo list should not contain multiple entries', function() {
const appRepoCreate = new AppClusterRepoEditPo('local', 'create');

appRepoList.sortableTable().checkLoadingIndicatorNotVisible();
appRepoList.sortableTable().rowCount().should('be.lessThan', 10); // catch page size 10...
appRepoList.sortableTable().rowCount().then((count) => {
// track repo rows

const initialRowCount = count;

// create a new cluster repo
appRepoList.create();
appRepoCreate.waitForPage();
appRepoCreate.nameNsDescription().name().self().scrollIntoView()
.should('be.visible');
appRepoCreate.nameNsDescription().name().set(this.helmRepoDupeName);
appRepoCreate.create().self().scrollIntoView();
appRepoCreate.create().click();

// test repo rows
appRepoList.waitForPage();
reposToDelete.push(this.helmRepoDupeName);
appRepoList.sortableTable().rowCount().should('eq', initialRowCount + 1);
});
});

appRepoList.sortableTable().checkLoadingIndicatorNotVisible();
appRepoList.sortableTable().rowCount().should('be.lessThan', 10); // catch page size 10...
appRepoList.sortableTable().rowCount().then((count) => {
// track repo rows

const initialRowCount = count;

// create a new cluster repo
appRepoList.create();
appRepoCreate.waitForPage();
appRepoCreate.nameNsDescription().name().self().scrollIntoView()
.should('be.visible');
appRepoCreate.nameNsDescription().name().set(this.helmRepoDupeName);
appRepoCreate.create().self().scrollIntoView();
appRepoCreate.create().click();

// test repo rows
appRepoList.waitForPage();
reposToDelete.push(this.helmRepoDupeName);
appRepoList.sortableTable().rowCount().should('eq', initialRowCount + 1);
// Ensure this runs after an attempt, rather than all attemps (`after` only runs once after all cypress retries)
afterEach(() => {
reposToDelete.forEach((r) => cy.deleteRancherResource('v1', 'catalog.cattle.io.clusterrepos', r));
});
});

Expand Down Expand Up @@ -139,7 +146,7 @@ describe('Apps', () => {
const appRepoList = new ReposListPagePo(clusterId, 'apps');
const chartsPage = new ChartsPage(clusterId);

before(() => {
beforeEach(() => {
cy.login();

appRepoList.goTo();
Expand Down Expand Up @@ -169,7 +176,8 @@ describe('Apps', () => {
appRepoList.waitForPage();

// Nav back to the summary page for a specific chart
cy.intercept('GET', '/v1/catalog.cattle.io.clusterrepos/rancher-charts?*', cy.spy().as('rancherCharts2'));
// Note we're intercepting a more precise url here to avoid any icon requests made from the charts list
cy.intercept('GET', '/v1/catalog.cattle.io.clusterrepos/rancher-charts?link=info&chartName=rancher-backup&version=*', cy.spy().as('rancherCharts2'));
ChartPage.navTo(clusterId, 'Rancher Backups');
chartPage.waitForPage('repo-type=cluster&repo=rancher-charts&chart=rancher-backup');
// The specific version of the chart (and any other) should NOT be fetched
Expand All @@ -193,9 +201,5 @@ describe('Apps', () => {
cy.wait('@rancherCharts3').its('request.url').should('include', 'version=');
});
});

after(() => {
reposToDelete.forEach((r) => cy.deleteRancherResource('v1', 'catalog.cattle.io.clusterrepos', r));
});
});
});

0 comments on commit f3c02c9

Please sign in to comment.