Skip to content

Commit 0fcda63

Browse files
committed
Merge pull request rancher#16125 from yonasberhe23/scale_pools
Automation: Scale machine pool tests
2 parents 3a92073 + 4e23743 commit 0fcda63

File tree

11 files changed

+2253
-70
lines changed

11 files changed

+2253
-70
lines changed

browser-logs/out.html

Lines changed: 2037 additions & 0 deletions
Large diffs are not rendered by default.

cypress/e2e/po/detail/provisioning.cattle.io.cluster/cluster-detail.po.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import PagePo from '@/cypress/e2e/po/pages/page.po';
1+
import { BaseDetailPagePo } from '@/cypress/e2e/po/pages/base/base-detail-page.po';
22
import MachinePoolsListPo from '@/cypress/e2e/po/lists/machine-pools-list.po';
33
import ClusterConditionsListPo from '~/cypress/e2e/po/lists/cluster-conditions-list.po';
44
import ClusterProvisioningLogPo from '~/cypress/e2e/po/lists/cluster-provisioning-log.po';
@@ -7,10 +7,11 @@ import ClusterSnapshotsListPo from '~/cypress/e2e/po/lists/cluster-snapshots-lis
77
import TabbedPo from '~/cypress/e2e/po/components/tabbed.po';
88
import ClusterRecentEventsListPo from '~/cypress/e2e/po/lists/cluster-recent-events-list.po';
99
import DetailDrawer from '@/cypress/e2e/po/side-bars/detail-drawer.po';
10+
1011
/**
1112
* Covers core functionality that's common to the dashboard's cluster detail pages
1213
*/
13-
export default abstract class ClusterManagerDetailPagePo extends PagePo {
14+
export default abstract class ClusterManagerDetailPagePo extends BaseDetailPagePo {
1415
private static createPath(clusterId: string, clusterName: string, tab?: string) {
1516
const namespace = clusterName === 'local' ? 'fleet-local' : 'fleet-default';
1617

@@ -45,8 +46,8 @@ export default abstract class ClusterManagerDetailPagePo extends PagePo {
4546
return this.self().get('code');
4647
}
4748

48-
machinePoolsList() {
49-
return new MachinePoolsListPo(this.self().find('[data-testid="sortable-table-list-container"]'));
49+
poolsList(tabId: 'machine' | 'node') {
50+
return new MachinePoolsListPo(this.self().find(`#${ tabId }-pools [data-testid="sortable-table-list-container"]`));
5051
}
5152

5253
conditionsList() {

cypress/e2e/po/lists/machine-pools-list.po.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import BaseResourceList from '@/cypress/e2e/po/lists/base-resource-list.po';
22
import ResourceTablePo from '@/cypress/e2e/po/components/resource-table.po';
3+
import TooltipPo from '@/cypress/e2e/po/components/tooltip.po';
4+
import { GetOptions } from '@/cypress/e2e/po/components/component.po';
35

46
export default class MachinePoolsListPo extends BaseResourceList {
57
details(name: string, index: number) {
@@ -9,4 +11,25 @@ export default class MachinePoolsListPo extends BaseResourceList {
911
downloadYamlButton() {
1012
return new ResourceTablePo(this.self()).downloadYamlButton();
1113
}
14+
15+
machinePoolCount(poolName: string, count: number | RegExp, options?: GetOptions) {
16+
return this.resourceTable().sortableTable().groupElementWithName(poolName)
17+
.find('.group-header-buttons')
18+
.contains(count, options);
19+
}
20+
21+
scaleDownButton(poolName: string) {
22+
return this.resourceTable().sortableTable().groupElementWithName(poolName)
23+
.find('[data-testid="scale-down-button"]');
24+
}
25+
26+
scaleUpButton(poolName: string) {
27+
return this.resourceTable().sortableTable().groupElementWithName(poolName)
28+
.find('[data-testid="scale-up-button"]');
29+
}
30+
31+
scaleButtonTooltip(poolName: string, button: 'plus' | 'minus'): TooltipPo {
32+
return new TooltipPo(this.resourceTable().sortableTable().groupElementWithName(poolName)
33+
.find(`.group-header-buttons button .icon-${ button }`));
34+
}
1235
}

cypress/e2e/po/prompts/genericPrompt.po.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import ComponentPo from '@/cypress/e2e/po/components/component.po';
22
import CardPo from '@/cypress/e2e/po/components/card.po';
33
import LabeledSelectPo from '@/cypress/e2e/po/components/labeled-select.po';
4+
import CheckboxInputPo from '@/cypress/e2e/po/components/checkbox-input.po';
45

56
export default class GenericPrompt extends ComponentPo {
67
card = new CardPo();
@@ -17,6 +18,10 @@ export default class GenericPrompt extends ComponentPo {
1718
return new LabeledSelectPo(selector);
1819
}
1920

21+
checkbox(selector = '[data-checkbox-ctrl]') {
22+
return new CheckboxInputPo(this.self().get(selector));
23+
}
24+
2025
clickActionButton(text: string) {
2126
return this.card.getActionButton().contains(text).click();
2227
}

cypress/e2e/tests/pages/fleet/fleet-clusters.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { WorkloadsDeploymentsListPagePo } from '@/cypress/e2e/po/pages/explorer/
77
import * as path from 'path';
88
import * as jsyaml from 'js-yaml';
99
import { HeaderPo } from '@/cypress/e2e/po/components/header.po';
10-
import { LONG_TIMEOUT_OPT, MEDIUM_TIMEOUT_OPT } from '@/cypress/support/utils/timeouts';
10+
import { LONG_TIMEOUT_OPT, MEDIUM_TIMEOUT_OPT, VERY_LONG_TIMEOUT_OPT } from '@/cypress/support/utils/timeouts';
1111
import { FeatureFlagsPagePo } from '@/cypress/e2e/po/pages/global-settings/feature-flags.po';
1212
import LoadingPo from '@/cypress/e2e/po/components/loading.po';
1313

@@ -84,7 +84,7 @@ describe('Fleet Clusters - bundle manifests are deployed from the BundleDeployme
8484
it('data is populated in fleet cluster list and detail view', () => {
8585
ClusterManagerListPagePo.navTo();
8686
clusterList.waitForPage();
87-
clusterList.list().state(clusterName).contains('Active', { timeout: 700000 });
87+
clusterList.list().state(clusterName).contains('Active', VERY_LONG_TIMEOUT_OPT);
8888

8989
// create gitrepo
9090
cy.createRancherResource('v1', 'fleet.cattle.io.gitrepos', gitRepoTargetAllClustersRequest(namespace, gitRepo, gitRepoUrl, branch, paths)).then(() => {

cypress/e2e/tests/pages/manager/cluster-manager.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -547,8 +547,8 @@ describe('Cluster Manager', { testIsolation: 'off', tags: ['@manager', '@adminUs
547547
clusterDetail.selectTab(tabbedPo, '[data-testid="btn-node-pools"]');
548548

549549
clusterDetail.waitForPage(undefined, 'node-pools');
550-
clusterDetail.machinePoolsList().details('machine-', 2).should('be.visible');
551-
clusterDetail.machinePoolsList().downloadYamlButton().should('be.disabled');
550+
clusterDetail.poolsList('node').details('machine-', 2).should('be.visible');
551+
clusterDetail.poolsList('node').downloadYamlButton().should('be.disabled');
552552
});
553553

554554
it(`Show Configuration allows to edit config and view yaml for local cluster`, () => {

0 commit comments

Comments
 (0)