forked from rancher/dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* cluster tools tests * skip edit & delete tests until resolution of rancher#9940
- Loading branch information
1 parent
e921f48
commit f092182
Showing
4 changed files
with
145 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import PagePo from '@/cypress/e2e/po/pages/page.po'; | ||
|
||
export default class ClusterToolsPagePo extends PagePo { | ||
private static createPath(clusterId: string) { | ||
return `/c/${ clusterId }/explorer/tools`; | ||
} | ||
|
||
static goTo(clusterId: string): Cypress.Chainable<Cypress.AUTWindow> { | ||
return super.goTo(ClusterToolsPagePo.createPath(clusterId)); | ||
} | ||
|
||
constructor(clusterId: string) { | ||
super(ClusterToolsPagePo.createPath(clusterId)); | ||
} | ||
|
||
featureChartCards(): Cypress.Chainable { | ||
return cy.get('.grid > .item'); | ||
} | ||
|
||
getCardByIndex(index: number): Cypress.Chainable { | ||
return this.featureChartCards().eq(index); | ||
} | ||
|
||
goToInstall(index: number) { | ||
return this.getCardByIndex(index).find('.btn').contains('Install').click(); | ||
} | ||
|
||
deleteChart(index: number) { | ||
return this.getCardByIndex(index).find('.action .btn').eq(0).click(); | ||
} | ||
|
||
editChart(index: number) { | ||
return this.getCardByIndex(index).find('.action .btn').eq(1).click(); | ||
} | ||
|
||
getChartVersion(index: number) { | ||
return this.getCardByIndex(index).find('.version'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import PagePo from '@/cypress/e2e/po/pages/page.po'; | ||
import AsyncButtonPo from '@/cypress/e2e/po/components/async-button.po'; | ||
|
||
export class InstallChartsPage extends PagePo { | ||
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(clusterId: string) { | ||
super(InstallChartsPage.createPath(clusterId)); | ||
} | ||
|
||
nextPage() { | ||
return cy.get('.controls-steps').contains('Next').click(); | ||
} | ||
|
||
installChart(): AsyncButtonPo { | ||
return new AsyncButtonPo('[data-testid="action-button-async-button"]', this.self()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import ClusterToolsPagePo from '@/cypress/e2e/po/pages/explorer/cluster-tools.po'; | ||
import ClusterDashboardPagePo from '@/cypress/e2e/po/pages/explorer/cluster-dashboard.po'; | ||
import { InstallChartsPage } from '@/cypress/e2e/po/pages/explorer/install-charts.po'; | ||
import PromptRemove from '@/cypress/e2e/po/prompts/promptRemove.po'; | ||
|
||
const clusterTools = new ClusterToolsPagePo('local'); | ||
|
||
describe('Cluster Tools', { tags: '@adminUser' }, () => { | ||
beforeEach(() => { | ||
cy.login(); | ||
}); | ||
|
||
it('can navigate to cluster tools and see all feature charts', () => { | ||
const clusterDashboard = new ClusterDashboardPagePo('local'); | ||
|
||
clusterDashboard.goTo(); | ||
clusterDashboard.waitForPage(); | ||
clusterDashboard.clusterToolsButton().click(); | ||
|
||
clusterTools.waitForPage(); | ||
clusterTools.featureChartCards().should('have.length.gte', 10); | ||
}); | ||
|
||
it('can deploy chart successfully', () => { | ||
clusterTools.goTo(); | ||
clusterTools.waitForPage(); | ||
clusterTools.getChartVersion(0).invoke('text').then((el) => { | ||
const chartVersion = el.trim().slice(1); | ||
|
||
const chartType = 'rancher-alerting-drivers'; | ||
const installAlertingDriversPage = `repo-type=cluster&repo=rancher-charts&chart=${ chartType }&version=${ chartVersion }&tools`; | ||
const installCharts = new InstallChartsPage('local'); | ||
|
||
clusterTools.goToInstall(0); | ||
installCharts.waitForPage(installAlertingDriversPage); | ||
installCharts.nextPage(); | ||
|
||
cy.intercept('POST', 'v1/catalog.cattle.io.clusterrepos/rancher-charts?action=install').as('chartInstall'); | ||
installCharts.installChart().click(); | ||
cy.wait('@chartInstall').its('response.statusCode').should('eq', 201); | ||
clusterTools.waitForPage(); | ||
cy.contains('Connected'); | ||
}); | ||
}); | ||
|
||
it.skip('can edit chart successfully', () => { | ||
// Note: this test fails due to https://github.com/rancher/dashboard/issues/9940 | ||
// skipping this test until issue is resolved | ||
clusterTools.goTo(); | ||
clusterTools.waitForPage(); | ||
clusterTools.editChart(0); | ||
|
||
const installCharts = new InstallChartsPage('local'); | ||
|
||
installCharts.nextPage(); | ||
|
||
cy.intercept('POST', 'v1/catalog.cattle.io.clusterrepos/rancher-charts?action=upgrade').as('chartUpdate'); | ||
installCharts.installChart().click(); | ||
cy.wait('@chartUpdate').its('response.statusCode').should('eq', 201); | ||
clusterTools.waitForPage(); | ||
cy.contains('Connected'); | ||
}); | ||
|
||
it.skip('can uninstall chart successfully', () => { | ||
// Note: this test fails due to https://github.com/rancher/dashboard/issues/9940 | ||
// skipping this test until issue is resolved | ||
clusterTools.goTo(); | ||
clusterTools.waitForPage(); | ||
clusterTools.deleteChart(0); | ||
|
||
const promptRemove = new PromptRemove(); | ||
|
||
cy.intercept('POST', '/v1/catalog.cattle.io.apps/default/rancher-alerting-drivers?action=uninstall').as('chartUninstall'); | ||
promptRemove.remove(); | ||
cy.wait('@chartUninstall').its('response.statusCode').should('eq', 201); | ||
cy.contains('Disconnected'); | ||
}); | ||
}); |