1 import { IscsiPageHelper } from '../block/iscsi.po';
2 import { HostsPageHelper } from '../cluster/hosts.po';
3 import { MonitorsPageHelper } from '../cluster/monitors.po';
4 import { OSDsPageHelper } from '../cluster/osds.po';
5 import { PageHelper } from '../page-helper.po';
6 import { PoolPageHelper } from '../pools/pools.po';
7 import { DaemonsPageHelper } from '../rgw/daemons.po';
8 import { DashboardPageHelper } from './dashboard.po';
10 describe('Dashboard Main Page', () => {
11 const dashboard = new DashboardPageHelper();
12 const daemons = new DaemonsPageHelper();
13 const hosts = new HostsPageHelper();
14 const osds = new OSDsPageHelper();
15 const pools = new PoolPageHelper();
16 const monitors = new MonitorsPageHelper();
17 const iscsi = new IscsiPageHelper();
21 Cypress.Cookies.preserveOnce('token');
22 dashboard.navigateTo();
25 describe('Check that all hyperlinks on info cards lead to the correct page and fields exist', () => {
26 it('should ensure that all linked info cards lead to correct page', () => {
27 const expectationMap = {
31 'Object Gateways': 'Daemons',
32 'iSCSI Gateways': 'Overview',
36 for (const [linkText, breadcrumbText] of Object.entries(expectationMap)) {
37 cy.location('hash').should('eq', '#/dashboard');
38 dashboard.clickInfoCardLink(linkText);
39 dashboard.expectBreadcrumbText(breadcrumbText);
40 dashboard.navigateBack();
44 it('should verify that info cards exist on dashboard in proper order', () => {
45 // Ensures that info cards are all displayed on the dashboard tab while being in the proper
46 // order, checks for card title and position via indexing into a list of all info cards.
63 'Recovery Throughput',
67 for (let i = 0; i < order.length; i++) {
68 dashboard.infoCard(i).should('contain.text', order[i]);
72 it('should verify that info card group titles are present and in the right order', () => {
73 cy.location('hash').should('eq', '#/dashboard');
74 dashboard.infoGroupTitle(0).should('eq', 'Status');
75 dashboard.infoGroupTitle(1).should('eq', 'Capacity');
76 dashboard.infoGroupTitle(2).should('eq', 'Performance');
80 it('Should check that dashboard cards have correct information', () => {
83 regexMatcher?: RegExp;
84 pageObject: PageHelper;
86 const testSpecs: TestSpec[] = [
87 { cardName: 'Object Gateways', regexMatcher: /(\d+)\s+total/, pageObject: daemons },
88 { cardName: 'Monitors', regexMatcher: /(\d+)\s+\(quorum/, pageObject: monitors },
89 { cardName: 'Hosts', regexMatcher: /(\d+)\s+total/, pageObject: hosts },
90 { cardName: 'OSDs', regexMatcher: /(\d+)\s+total/, pageObject: osds },
91 { cardName: 'Pools', pageObject: pools },
92 { cardName: 'iSCSI Gateways', regexMatcher: /(\d+)\s+total/, pageObject: iscsi }
94 for (let i = 0; i < testSpecs.length; i++) {
95 const spec = testSpecs[i];
96 dashboard.navigateTo();
98 dashboard.infoCardBodyText(spec.cardName).then((infoCardBodyText: string) => {
101 if (spec.regexMatcher) {
102 const match = infoCardBodyText.match(new RegExp(spec.regexMatcher));
103 expect(match).to.length.gt(
105 `Regex ${spec.regexMatcher} did not find a match for card with name ` +
108 dashCount = Number(match[1]);
110 dashCount = Number(infoCardBodyText);
113 spec.pageObject.navigateTo();
114 spec.pageObject.getTableCount('total').then((tableCount) => {
115 expect(tableCount).to.eq(
117 `Text of card "${spec.cardName}" and regex "${spec.regexMatcher}" resulted in ${dashCount} ` +
118 `but did not match table count ${tableCount}`