Skip to content

Commit

Permalink
make url dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
Yonas Berhe authored and Yonas Berhe committed Oct 19, 2023
1 parent 41c2a5e commit 765ea43
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
13 changes: 9 additions & 4 deletions cypress/e2e/po/pages/explorer/install-charts.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@ import PagePo from '@/cypress/e2e/po/pages/page.po';
import AsyncButtonPo from '@/cypress/e2e/po/components/async-button.po';

export class InstallChartsPage extends PagePo {
static url = '/c/local/apps/charts/install?repo-type=cluster&repo=rancher-charts'
private static createPath(clusterId: string) {
return `/c/${ clusterId }/apps/charts/install`;
}

static goTo(clusterId: string): Cypress.Chainable<Cypress.AUTWindow> {
return super.goTo(InstallChartsPage.createPath(clusterId));
}

constructor(pageUrl = InstallChartsPage.url) {
InstallChartsPage.url = pageUrl;
super(InstallChartsPage.url);
constructor(clusterId: string) {
super(InstallChartsPage.createPath(clusterId));
}

nextPage() {
Expand Down
11 changes: 4 additions & 7 deletions cypress/e2e/tests/pages/explorer/cluster-tools.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,12 @@ describe('Cluster Tools', { tags: '@adminUser' }, () => {
clusterTools.getChartVersion(0).invoke('text').then((el) => {
const chartVersion = el.trim().slice(1);

const chartsPageUrl = '/c/local/apps/charts/install?repo-type=cluster&repo=rancher-charts';
const chartType = 'rancher-alerting-drivers';

const installAlertingDriversPage = `${ chartsPageUrl }&chart=${ chartType }&version=${ chartVersion }&tools`;

const installCharts = new InstallChartsPage(installAlertingDriversPage);
const installAlertingDriversPage = `repo-type=cluster&repo=rancher-charts&chart=${ chartType }&version=${ chartVersion }&tools`;
const installCharts = new InstallChartsPage('local');

clusterTools.goToInstall(0);
installCharts.waitForPage();
installCharts.waitForPage(installAlertingDriversPage);
installCharts.nextPage();

cy.intercept('POST', 'v1/catalog.cattle.io.clusterrepos/rancher-charts?action=install').as('chartInstall');
Expand All @@ -51,7 +48,7 @@ describe('Cluster Tools', { tags: '@adminUser' }, () => {
clusterTools.waitForPage();
clusterTools.editChart(0);

const installCharts = new InstallChartsPage();
const installCharts = new InstallChartsPage('local');

installCharts.nextPage();

Expand Down

0 comments on commit 765ea43

Please sign in to comment.