1 import { IscsiPageHelper } from '../block/iscsi.po';
2 import { HostsPageHelper } from '../cluster/hosts.po';
3 import { ManagerModulesPageHelper } from '../cluster/mgr-modules.po';
4 import { MonitorsPageHelper } from '../cluster/monitors.po';
5 import { OSDsPageHelper } from '../cluster/osds.po';
6 import { PageHelper } from '../page-helper.po';
7 import { PoolPageHelper } from '../pools/pools.po';
8 import { DaemonsPageHelper } from '../rgw/daemons.po';
9 import { DashboardPageHelper } from './dashboard.po';
11 describe('Dashboard Main Page', () => {
12 const dashboard = new DashboardPageHelper();
13 const daemons = new DaemonsPageHelper();
14 const hosts = new HostsPageHelper();
15 const osds = new OSDsPageHelper();
16 const pools = new PoolPageHelper();
17 const monitors = new MonitorsPageHelper();
18 const iscsi = new IscsiPageHelper();
19 const mgrmodules = new ManagerModulesPageHelper();
23 mgrmodules.navigateTo();
24 mgrmodules.navigateEdit('dashboard');
25 cy.get('#FEATURE_TOGGLE_DASHBOARD').uncheck();
26 cy.contains('button', 'Update').click();
31 dashboard.navigateTo();
34 describe('Check that all hyperlinks on info cards lead to the correct page and fields exist', () => {
35 it('should ensure that all linked info cards lead to correct page', () => {
36 const expectationMap = {
40 'Object Gateways': 'Gateways',
41 'iSCSI Gateways': 'Overview',
45 for (const [linkText, breadcrumbText] of Object.entries(expectationMap)) {
46 cy.location('hash').should('eq', '#/dashboard');
47 dashboard.clickInfoCardLink(linkText);
48 dashboard.expectBreadcrumbText(breadcrumbText);
49 dashboard.navigateBack();
53 it('should verify that info cards exist on dashboard in proper order', () => {
54 // Ensures that info cards are all displayed on the dashboard tab while being in the proper
55 // order, checks for card title and position via indexing into a list of all info cards.
72 'Recovery Throughput',
76 for (let i = 0; i < order.length; i++) {
77 dashboard.infoCard(i).should('contain.text', order[i]);
81 it('should verify that info card group titles are present and in the right order', () => {
82 cy.location('hash').should('eq', '#/dashboard');
83 dashboard.infoGroupTitle(0).should('eq', 'Status');
84 dashboard.infoGroupTitle(1).should('eq', 'Capacity');
85 dashboard.infoGroupTitle(2).should('eq', 'Performance');
89 it('Should check that dashboard cards have correct information', () => {
92 regexMatcher?: RegExp;
93 pageObject: PageHelper;
95 const testSpecs: TestSpec[] = [
96 { cardName: 'Object Gateways', regexMatcher: /(\d+)\s+total/, pageObject: daemons },
97 { cardName: 'Monitors', regexMatcher: /(\d+)\s+\(quorum/, pageObject: monitors },
98 { cardName: 'Hosts', regexMatcher: /(\d+)\s+total/, pageObject: hosts },
99 { cardName: 'OSDs', regexMatcher: /(\d+)\s+total/, pageObject: osds },
100 { cardName: 'Pools', pageObject: pools },
101 { cardName: 'iSCSI Gateways', regexMatcher: /(\d+)\s+total/, pageObject: iscsi }
103 for (let i = 0; i < testSpecs.length; i++) {
104 const spec = testSpecs[i];
105 dashboard.navigateTo();
107 dashboard.infoCardBodyText(spec.cardName).then((infoCardBodyText: string) => {
110 if (spec.regexMatcher) {
111 const match = infoCardBodyText.match(new RegExp(spec.regexMatcher));
112 expect(match).to.length.gt(
114 `Regex ${spec.regexMatcher} did not find a match for card with name ` +
117 dashCount = Number(match[1]);
119 dashCount = Number(infoCardBodyText);
122 spec.pageObject.navigateTo();
123 spec.pageObject.getTableCount('total').then((tableCount) => {
124 expect(tableCount).to.eq(
126 `Text of card "${spec.cardName}" and regex "${spec.regexMatcher}" resulted in ${dashCount} ` +
127 `but did not match table count ${tableCount}`
136 mgrmodules.navigateTo();
137 mgrmodules.navigateEdit('dashboard');
138 cy.get('#FEATURE_TOGGLE_DASHBOARD').click();
139 cy.contains('button', 'Update').click();