Skip to content

Commit

Permalink
refactor node detail test to use detail page po (rancher#12074)
Browse files Browse the repository at this point in the history
  • Loading branch information
mantis-toboggan-md authored and nwmac committed Oct 24, 2024
1 parent 94ad8f6 commit 152e27e
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 10 deletions.
18 changes: 18 additions & 0 deletions cypress/e2e/po/detail/node.po.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import PagePo from '@/cypress/e2e/po/pages/page.po';

/**
* Details component for nodes
*/
export default class NodeDetailsPo extends PagePo {
private static createPath(cluster: string, nodeName: string) {
return `/c/${ cluster }/explorer/node/${ nodeName }`;
}

static goTo(path: string): Cypress.Chainable<Cypress.AUTWindow> {
throw new Error('invalid');
}

constructor(cluster: string, nodeName: string) {
super(NodeDetailsPo.createPath(cluster, nodeName));
}
}
2 changes: 1 addition & 1 deletion cypress/e2e/po/pages/cluster-manager/namespace.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ export default class ClusterManagerNamespacePagePo extends PagePo {
}

namespace() {
return cy.get('.mastehead-resource-title');
return cy.get('.masthead-resource-title');
}
}
23 changes: 16 additions & 7 deletions cypress/e2e/tests/pages/explorer2/nodes/node-detail.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import ResourceTable from '@/cypress/e2e/po//components/resource-table.po';
import ClusterDashboardPagePo from '@/cypress/e2e/po/pages/explorer/cluster-dashboard.po';
import HomePagePo from '@/cypress/e2e/po/pages/home.po';
import ProductNavPo from '@/cypress/e2e/po/side-bars/product-side-nav.po';
import NodeDetailsPo from '@/cypress/e2e/po/detail/node.po';

describe('Node detail', { tags: ['@explorer2', '@adminUser'], testIsolation: 'off' }, () => {
before(() => {
Expand All @@ -25,12 +26,20 @@ describe('Node detail', { tags: ['@explorer2', '@adminUser'], testIsolation: 'of
// Wait for loading indicator to go
nodeList.sortableTable().checkLoadingIndicatorNotVisible();

nodeList.sortableTable().rowElementLink(0, 2).click();
cy.get('.title .primaryheader h1').should('be.visible');
cy.get('.title .primaryheader h1').invoke('text').should('contain', 'Node:');
cy.reload();
// check that the page rendered is a detail view
cy.get('.title .primaryheader h1').should('be.visible');
cy.get('.title .primaryheader h1').invoke('text').should('contain', 'Node:');
nodeList.sortableTable().rowNames().then((nodes) => {
const node = nodes[0];

nodeList.sortableTable().rowElementLink(0, 2).click();

const nodeDetail = new NodeDetailsPo('local', node);

nodeDetail.waitForPage();
nodeDetail.mastheadTitle().should('contain', `${ node }`);

cy.reload();

nodeDetail.waitForPage();
nodeDetail.mastheadTitle().should('contain', `${ node }`);
});
});
});
4 changes: 2 additions & 2 deletions shell/components/ResourceDetail/Masthead.vue
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ export default {
<span v-if="value.detailPageHeaderActionOverride && value.detailPageHeaderActionOverride(realMode)">{{ value.detailPageHeaderActionOverride(realMode) }}</span>
<t
v-else
class="mastehead-resource-title"
class="masthead-resource-title"
:k="'resourceDetail.header.' + realMode"
:subtype="resourceSubtype"
:name="displayName"
Expand Down Expand Up @@ -584,7 +584,7 @@ export default {
flex-direction: row;
align-items: center;
.mastehead-resource-title {
.masthead-resource-title {
padding: 0 8px;
text-overflow: ellipsis;
overflow: hidden;
Expand Down

0 comments on commit 152e27e

Please sign in to comment.