Skip to content

Commit

Permalink
Cluster Details - Conditions and Related
Browse files Browse the repository at this point in the history
  • Loading branch information
izaac committed May 1, 2024
1 parent f459aa9 commit 2d2b45b
Show file tree
Hide file tree
Showing 7 changed files with 96 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cypress/e2e/po/components/sortable-table.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ export default class SortableTablePo extends ComponentPo {
return new CheckboxInputPo(this.rowWithName(clusterName).column(0));
}

rowWithClusterName(clusterName: string) {
return this.rowWithName(clusterName).column(2);
}

/**
* Select all list items
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import PagePo from '@/cypress/e2e/po/pages/page.po';
import ResourceTablePo from '@/cypress/e2e/po/components/resource-table.po';
import MachinePoolsListPo from '@/cypress/e2e/po/lists/machine-pools-list.po';
import ClusterConditionsListPo from '~/cypress/e2e/po/lists/cluster-conditions-list.po';
import ClusterProvisioningLogPo from '~/cypress/e2e/po/lists/cluster-provisioning-log.po';
import ClusterReferredToListPo from '~/cypress/e2e/po/lists/cluster-referred-to-list.po';
import TabbedPo from '~/cypress/e2e/po/components/tabbed.po';

/**
* Covers core functionality that's common to the dashboard's cluster detail pages
Expand All @@ -21,11 +26,33 @@ export default abstract class ClusterManagerDetailPagePo extends PagePo {
return this.self().find('.primaryheader h1');
}

logsContainer() {
return new ClusterProvisioningLogPo(this.self()).logsContainer();
}

kubectlCommandForImported() {
return this.self().get('code').contains('--insecure');
}

machinePoolsList() {
return new MachinePoolsListPo(this.self().find('[data-testid="sortable-table-list-container"]'));
}

conditionsList() {
return new ClusterConditionsListPo(this.self().find('.sortable-table'));
}

referredToList() {
return new ClusterReferredToListPo(this.self().find('[data-testid="sortable-table-list-container"]'));
}

downloadYamlButton() {
return new ResourceTablePo(this.self()).downloadYamlButton();
}

selectTab(options: TabbedPo, selector: string) {
options.clickTabWithSelector(selector);

return this;
}
}
7 changes: 7 additions & 0 deletions cypress/e2e/po/lists/cluster-conditions-list.po.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import BaseResourceList from '@/cypress/e2e/po/lists/base-resource-list.po';

export default class ClusterConditionsListPo extends BaseResourceList {
details(name: string, index: number) {
return this.resourceTable().sortableTable().rowWithPartialName(name).column(index);
}
}
7 changes: 7 additions & 0 deletions cypress/e2e/po/lists/cluster-provisioning-log.po.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import BaseResourceList from '@/cypress/e2e/po/lists/base-resource-list.po';

export default class ClusterProvisioningLogPo extends BaseResourceList {
logsContainer() {
return this.self().find('.logs-container');
}
}
7 changes: 7 additions & 0 deletions cypress/e2e/po/lists/cluster-referred-to-list.po.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import BaseResourceList from '@/cypress/e2e/po/lists/base-resource-list.po';

export default class ClusterReferredToListPo extends BaseResourceList {
details(name: string, index: number) {
return this.resourceTable().sortableTable().rowWithName(name).column(index);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,8 @@ export default class ClusterManagerListPagePo extends PagePo {
editCluster(name: string) {
this.sortableTable().rowActionMenuOpen(name).getMenuItem('Edit Config').click();
}

clickOnClusterName(name: string) {
this.sortableTable().rowWithClusterName(name).click();
}
}
40 changes: 40 additions & 0 deletions cypress/e2e/tests/pages/manager/cluster-manager.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import HomePagePo from '@/cypress/e2e/po/pages/home.po';
import { nodeDriveResponse } from '@/cypress/e2e/tests/pages/manager/mock-responses';
import LabeledSelectPo from '@/cypress/e2e/po/components/labeled-select.po';
import ProductNavPo from '@/cypress/e2e/po/side-bars/product-side-nav.po';
import TabbedPo from '~/cypress/e2e/po/components/tabbed.po';

// At some point these will come from somewhere central, then we can make tools to remove resources from this or all runs
const runTimestamp = +new Date();
Expand Down Expand Up @@ -528,6 +529,45 @@ describe('Cluster Manager', { testIsolation: 'off', tags: ['@manager', '@adminUs
clusterList.waitForPage();
});

describe('Cluster Details Tabs', () => {
const tabbedPo = new TabbedPo('[data-testid="tabbed-block"]');
const clusterDetail = new ClusterManagerDetailImportedGenericPagePo(undefined, 'local');

beforeEach( () => {
ClusterManagerListPagePo.navTo();
const clusterList = new ClusterManagerListPagePo('_');

clusterList.waitForPage();
clusterList.clickOnClusterName('local');
});

it('can navigate to Cluster Conditions Page', () => {
clusterDetail.selectTab(tabbedPo, '[data-testid="btn-conditions"]');

clusterDetail.conditionsList().details('Ready', 1).should('include.text', 'True');
});

it('can navigate to Cluster Related Page', () => {
clusterDetail.selectTab(tabbedPo, '[data-testid="btn-related"]');

clusterDetail.referredToList().details('Mgmt', 2).should('include.text', 'local');
});

it('can navigate to Cluster Provisioning Log Page', () => {
clusterDetail.selectTab(tabbedPo, '[data-testid="btn-log"]');

clusterDetail.logsContainer().should('be.visible');
});

it('can navigate to Cluster Machines Page', () => {
clusterDetail.selectTab(tabbedPo, '[data-testid="btn-node-pools"]');

clusterDetail.machinePoolsList().resourceTable().sortableTable().noRowsShouldNotExist();
clusterDetail.machinePoolsList().details('machine-', 2).should('be.visible');
clusterDetail.downloadYamlButton().should('be.disabled');
});
});

it(`can navigate to local cluster's explore product`, () => {
const clusterName = 'local';
const clusterDashboard = new ClusterDashboardPagePo(clusterName);
Expand Down

0 comments on commit 2d2b45b

Please sign in to comment.