-
Notifications
You must be signed in to change notification settings - Fork 334
Expand file tree
/
Copy pathnode-list.spec.ts
More file actions
60 lines (46 loc) · 2.09 KB
/
node-list.spec.ts
File metadata and controls
60 lines (46 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import { dummyNode } from '@/cypress/e2e/blueprints/explorer/nodes';
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';
describe('Nodes list', { tags: ['@explorer2', '@adminUser'], testIsolation: false }, () => {
before(() => {
cy.login();
HomePagePo.goTo();
// Add dummy node that used to cause a problem
cy.createRancherResource('v1', 'nodes', JSON.stringify(dummyNode));
});
after(() => {
// Ensure we delete the dummy node
cy.deleteRancherResource('v1', 'nodes', dummyNode.metadata.name);
});
it('should show the nodes list page', () => {
cy.getRancherResource('v1', 'nodes').then((resp: Cypress.Response<any>) => {
cy.wrap(resp.body.count).as('count');
});
ClusterDashboardPagePo.navTo();
const nav = new ProductNavPo();
nav.navToSideMenuEntryByLabel('Nodes');
cy.contains('.title > h1', 'Nodes').should('be.visible');
const nodeList = new ResourceTable('[data-testid="cluster-node-list"]');
nodeList.sortableTable().checkVisible();
// Wait for loading indicator to go
nodeList.sortableTable().checkLoadingIndicatorNotVisible();
// Check table has 2 rows
cy.get<number>('@count').then((count) => {
nodeList.sortableTable().rowElements({ timeout: 2500 }).should((rows: any) => {
expect(rows).not.to.equal(undefined);
expect(rows).to.have.length(count);
});
// Check the node names
nodeList.sortableTable().rowNames().should((names: any) => {
expect(names).to.have.length(count);
expect(names).to.contain(dummyNode.metadata.name);
});
});
// Simple test to assert we haven't broken Node detail page
// https://github.com/rancher/dashboard/issues/10490
nodeList.sortableTable().rowElementLink(0, 2).click();
cy.get('.title-bar h1.title, .primaryheader h1').invoke('text').should('contain', 'Node:');
});
});