Skip to content

Commit cfd000c

Browse files
Merge pull request #711 from etmurasaki/etmura-ou-1064
OU-1064: list perses dashboards automation testing
2 parents 403a5ae + 434ab2c commit cfd000c

12 files changed

Lines changed: 479 additions & 26 deletions

web/cypress/e2e/perses/01.coo_perses.cy.ts renamed to web/cypress/e2e/perses/00.coo_bvt_perses_admin.cy.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { nav } from '../../views/nav';
2-
import { runBVTCOOPersesTests } from '../../support/perses/00.coo_bvt_perses.cy';
2+
import { runBVTCOOPersesTests } from '../../support/perses/00.coo_bvt_perses_admin.cy';
33
import { guidedTour } from '../../views/tour';
44

55
// Set constants for the operators that need to be installed for tests.
@@ -18,16 +18,13 @@ const MP = {
1818
operatorName: 'Cluster Monitoring Operator',
1919
};
2020

21-
describe('BVT: COO - Dashboards (Perses) - Administrator perspective', { tags: ['@smoke', '@dashboards'] }, () => {
21+
describe('BVT: COO - Dashboards (Perses) - Administrator perspective', { tags: ['@smoke', '@dashboards', '@perses'] }, () => {
2222

2323
before(() => {
2424
cy.beforeBlockCOO(MCP, MP);
2525
});
2626

2727
beforeEach(() => {
28-
cy.visit('/');
29-
guidedTour.close();
30-
cy.validateLogin();
3128
nav.sidenav.clickNavLink(['Observe', 'Dashboards (Perses)']);
3229
});
3330

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { nav } from '../../views/nav';
2+
//TODO: rename after customizable-dashboards gets merged
3+
import { runBVTCOOPersesTests1 } from '../../support/perses/00.coo_bvt_perses_admin_1.cy';
4+
import { guidedTour } from '../../views/tour';
5+
6+
// Set constants for the operators that need to be installed for tests.
7+
const MCP = {
8+
namespace: 'openshift-cluster-observability-operator',
9+
packageName: 'cluster-observability-operator',
10+
operatorName: 'Cluster Observability Operator',
11+
config: {
12+
kind: 'UIPlugin',
13+
name: 'monitoring',
14+
},
15+
};
16+
17+
const MP = {
18+
namespace: 'openshift-monitoring',
19+
operatorName: 'Cluster Monitoring Operator',
20+
};
21+
22+
//TODO: change tag to @smoke, @dashboards, @perses when customizable-dashboards gets merged
23+
describe('BVT: COO - Dashboards (Perses) - Administrator perspective', { tags: ['@smoke-', '@dashboards-', '@perses-'] }, () => {
24+
25+
before(() => {
26+
cy.beforeBlockCOO(MCP, MP);
27+
});
28+
29+
beforeEach(() => {
30+
nav.sidenav.clickNavLink(['Observe', 'Dashboards (Perses)']);
31+
});
32+
33+
//TODO: rename after customizable-dashboards gets merged
34+
runBVTCOOPersesTests1({
35+
name: 'Administrator',
36+
});
37+
38+
});
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import { nav } from '../../views/nav';
2+
import { runCOOListPersesTests } from '../../support/perses/01.coo_list_perses_admin.cy';
3+
import { runCOOListPersesTestsNamespace } from '../../support/perses/01.coo_list_perses_admin_namespace.cy';
4+
5+
// Set constants for the operators that need to be installed for tests.
6+
const MCP = {
7+
namespace: 'openshift-cluster-observability-operator',
8+
packageName: 'cluster-observability-operator',
9+
operatorName: 'Cluster Observability Operator',
10+
config: {
11+
kind: 'UIPlugin',
12+
name: 'monitoring',
13+
},
14+
};
15+
16+
const MP = {
17+
namespace: 'openshift-monitoring',
18+
operatorName: 'Cluster Monitoring Operator',
19+
};
20+
21+
//TODO: change tag to @dashboards when customizable-dashboards gets merged
22+
describe('COO - Dashboards (Perses) - List perses dashboards', { tags: ['@perses', '@dashboards-'] }, () => {
23+
24+
before(() => {
25+
cy.beforeBlockCOO(MCP, MP);
26+
});
27+
28+
beforeEach(() => {
29+
nav.sidenav.clickNavLink(['Observe', 'Dashboards (Perses)']);
30+
cy.changeNamespace('All Projects');
31+
});
32+
33+
runCOOListPersesTests({
34+
name: 'Administrator',
35+
});
36+
37+
});
38+
39+
//TODO: change tag to @dashboards when customizable-dashboards gets merged
40+
describe('COO - Dashboards (Perses) - List perses dashboards - Namespace', { tags: ['@perses', '@dashboards-'] }, () => {
41+
42+
before(() => {
43+
cy.beforeBlockCOO(MCP, MP);
44+
});
45+
46+
beforeEach(() => {
47+
nav.sidenav.clickNavLink(['Observe', 'Dashboards (Perses)']);
48+
cy.changeNamespace('All Projects');
49+
});
50+
51+
runCOOListPersesTestsNamespace({
52+
name: 'Administrator',
53+
});
54+
55+
});
56+

web/cypress/fixtures/perses/constants.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,15 @@ export enum persesDashboardsRefreshInterval {
2121
}
2222

2323
export const persesDashboardsDashboardDropdownCOO = {
24-
ACCELERATORS_COMMON_METRICS:['Accelerators common metrics', 'perses'],
25-
K8S_COMPUTE_RESOURCES_CLUSTER: ['Kubernetes / Compute Resources / Cluster', 'perses'],
24+
ACCELERATORS_COMMON_METRICS:['Accelerators common metrics', 'perses', 'accelerators-dashboard'],
25+
APM_DASHBOARD: ['Application Performance Monitoring (APM)', 'perses', 'apm-dashboard'],
26+
K8S_COMPUTE_RESOURCES_CLUSTER: ['Kubernetes / Compute Resources / Cluster', 'perses', 'openshift-cluster-sample-dashboard'],
2627
}
2728

2829
export const persesDashboardsDashboardDropdownPersesDev = {
29-
PERSES_DASHBOARD_SAMPLE: ['Perses Dashboard Sample', 'perses'],
30-
PROMETHEUS_OVERVIEW: ['Prometheus / Overview', 'perses'],
31-
THANOS_COMPACT_OVERVIEW: ['Thanos / Compact / Overview', 'perses'],
30+
PERSES_DASHBOARD_SAMPLE: ['Perses Dashboard Sample', 'perses', 'perses-dashboard-sample'],
31+
PROMETHEUS_OVERVIEW: ['Prometheus / Overview', 'perses', 'prometheus-overview'],
32+
THANOS_COMPACT_OVERVIEW: ['Thanos / Compact / Overview', 'perses', 'thanos-compact-overview'],
3233
}
3334

3435
export enum persesDashboardsAcceleratorsCommonMetricsPanels {
@@ -39,4 +40,12 @@ export enum persesDashboardsAcceleratorsCommonMetricsPanels {
3940
TEMPERATURE_CELCIUS = 'Temperature (Celsius)',
4041
SM_CLOCK_HERTZ = 'SM Clock (Hertz)',
4142
MEMORY_CLOCK_HERTZ = 'Memory Clock (Hertz)',
43+
}
44+
45+
export const listPersesDashboardsPageSubtitle = 'View and manage dashboards.';
46+
47+
export const listPersesDashboardsEmptyState = {
48+
TITLE: 'No results found',
49+
BODY: 'No results match the filter criteria. Clear filters to show results.',
50+
4251
}

web/cypress/support/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ Cypress.on('uncaught:exception', (err) => {
2626
message.includes('Unauthorized') ||
2727
message.includes('Bad Gateway') ||
2828
message.includes(`Cannot read properties of null (reading 'default')`) ||
29-
message.includes(`(intermediate value) is not a function`)
29+
message.includes(`(intermediate value) is not a function`) ||
30+
//TODO: OU-1158
31+
message.includes(`[ Federation Runtime ]: Failed to load script resources. #RUNTIME-008`)
3032
) {
3133
console.warn('Ignored frontend exception:', err.message);
3234
return false;

web/cypress/support/perses/00.coo_bvt_perses.cy.ts renamed to web/cypress/support/perses/00.coo_bvt_perses_admin.cy.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { persesDashboardsAcceleratorsCommonMetricsPanels, persesDashboardsDashboardDropdownCOO, persesDashboardsDashboardDropdownPersesDev } from '../../fixtures/perses/constants';
22
import { commonPages } from '../../views/common';
33
import { persesDashboardsPage } from '../../views/perses-dashboards';
4-
import { persesDataTestIDs } from '../../../src/components/data-test';
4+
import { persesMUIDataTestIDs } from '../../../src/components/data-test';
55

66
export interface PerspectiveConfig {
77
name: string;
@@ -31,7 +31,7 @@ export function testBVTCOOPerses(perspective: PerspectiveConfig) {
3131
cy.log(`2.1. use sidebar nav to go to Observe > Dashboards (Perses) > Accelerators common metrics dashboard`);
3232
cy.changeNamespace('openshift-cluster-observability-operator');
3333
persesDashboardsPage.clickDashboardDropdown(persesDashboardsDashboardDropdownCOO.ACCELERATORS_COMMON_METRICS[0] as keyof typeof persesDashboardsDashboardDropdownCOO);
34-
cy.byDataTestID(persesDataTestIDs.variableDropdown+'-cluster').should('be.visible');
34+
cy.byDataTestID(persesMUIDataTestIDs.variableDropdown+'-cluster').should('be.visible');
3535
persesDashboardsPage.panelGroupHeaderAssertion('Accelerators');
3636
persesDashboardsPage.panelHeadersAcceleratorsCommonMetricsAssertion();
3737
persesDashboardsPage.expandPanel(persesDashboardsAcceleratorsCommonMetricsPanels.GPU_UTILIZATION);
@@ -42,10 +42,10 @@ export function testBVTCOOPerses(perspective: PerspectiveConfig) {
4242
cy.log(`3.1. use sidebar nav to go to Observe > Dashboards (Perses) > Perses Dashboard Sample dashboard`);
4343
cy.changeNamespace('perses-dev');
4444
persesDashboardsPage.clickDashboardDropdown(persesDashboardsDashboardDropdownPersesDev.PERSES_DASHBOARD_SAMPLE[0] as keyof typeof persesDashboardsDashboardDropdownPersesDev);
45-
cy.byDataTestID(persesDataTestIDs.variableDropdown+'-job').should('be.visible');
46-
cy.byDataTestID(persesDataTestIDs.variableDropdown+'-instance').should('be.visible');
47-
cy.byDataTestID(persesDataTestIDs.variableDropdown+'-interval').should('be.visible');
48-
cy.byDataTestID(persesDataTestIDs.variableDropdown+'-text').should('be.visible');
45+
cy.byDataTestID(persesMUIDataTestIDs.variableDropdown+'-job').should('be.visible');
46+
cy.byDataTestID(persesMUIDataTestIDs.variableDropdown+'-instance').should('be.visible');
47+
cy.byDataTestID(persesMUIDataTestIDs.variableDropdown+'-interval').should('be.visible');
48+
cy.byDataTestID(persesMUIDataTestIDs.variableDropdown+'-text').should('be.visible');
4949
persesDashboardsPage.panelGroupHeaderAssertion('Row 1');
5050
persesDashboardsPage.expandPanel('RAM Used');
5151
persesDashboardsPage.collapsePanel('RAM Used');
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import { persesDashboardsAcceleratorsCommonMetricsPanels, persesDashboardsDashboardDropdownCOO, persesDashboardsDashboardDropdownPersesDev } from '../../fixtures/perses/constants';
2+
import { persesDashboardsPage } from '../../views/perses-dashboards';
3+
import { persesMUIDataTestIDs } from '../../../src/components/data-test';
4+
import { listPersesDashboardsPage } from '../../views/list-perses-dashboards';
5+
6+
export interface PerspectiveConfig {
7+
name: string;
8+
beforeEach?: () => void;
9+
}
10+
11+
export function runBVTCOOPersesTests1(perspective: PerspectiveConfig) {
12+
testBVTCOOPerses1(perspective);
13+
}
14+
15+
export function testBVTCOOPerses1(perspective: PerspectiveConfig) {
16+
17+
it(`1.${perspective.name} perspective - Dashboards (Perses) page`, () => {
18+
cy.log(`1.1. use sidebar nav to go to Observe > Dashboards (Perses)`);
19+
listPersesDashboardsPage.shouldBeLoaded();
20+
listPersesDashboardsPage.clickDashboard(persesDashboardsDashboardDropdownCOO.ACCELERATORS_COMMON_METRICS[2]);
21+
persesDashboardsPage.shouldBeLoaded();
22+
});
23+
24+
it(`2.${perspective.name} perspective - Accelerators common metrics dashboard `, () => {
25+
cy.log(`2.1. use sidebar nav to go to Observe > Dashboards (Perses) > Accelerators common metrics dashboard`);
26+
cy.changeNamespace('openshift-cluster-observability-operator');
27+
listPersesDashboardsPage.clickDashboard(persesDashboardsDashboardDropdownCOO.ACCELERATORS_COMMON_METRICS[2]);
28+
cy.wait(2000);
29+
persesDashboardsPage.clickDashboardDropdown(persesDashboardsDashboardDropdownCOO.ACCELERATORS_COMMON_METRICS[0] as keyof typeof persesDashboardsDashboardDropdownCOO);
30+
cy.byDataTestID(persesMUIDataTestIDs.variableDropdown+'-cluster').should('be.visible');
31+
persesDashboardsPage.panelGroupHeaderAssertion('Accelerators');
32+
persesDashboardsPage.panelHeadersAcceleratorsCommonMetricsAssertion();
33+
persesDashboardsPage.expandPanel(persesDashboardsAcceleratorsCommonMetricsPanels.GPU_UTILIZATION);
34+
persesDashboardsPage.collapsePanel(persesDashboardsAcceleratorsCommonMetricsPanels.GPU_UTILIZATION);
35+
});
36+
37+
it(`3.${perspective.name} perspective - Perses Dashboard Sample dashboard`, () => {
38+
cy.log(`3.1. use sidebar nav to go to Observe > Dashboards (Perses) > Perses Dashboard Sample dashboard`);
39+
cy.changeNamespace('perses-dev');
40+
listPersesDashboardsPage.clickDashboard(persesDashboardsDashboardDropdownPersesDev.PERSES_DASHBOARD_SAMPLE[2]);
41+
cy.wait(2000);
42+
persesDashboardsPage.clickDashboardDropdown(persesDashboardsDashboardDropdownPersesDev.PERSES_DASHBOARD_SAMPLE[0] as keyof typeof persesDashboardsDashboardDropdownPersesDev);
43+
cy.byDataTestID(persesMUIDataTestIDs.variableDropdown+'-job').should('be.visible');
44+
cy.byDataTestID(persesMUIDataTestIDs.variableDropdown+'-instance').should('be.visible');
45+
cy.byDataTestID(persesMUIDataTestIDs.variableDropdown+'-interval').should('be.visible');
46+
cy.byDataTestID(persesMUIDataTestIDs.variableDropdown+'-text').should('be.visible');
47+
persesDashboardsPage.panelGroupHeaderAssertion('Row 1');
48+
persesDashboardsPage.expandPanel('RAM Used');
49+
persesDashboardsPage.collapsePanel('RAM Used');
50+
persesDashboardsPage.statChartValueAssertion('RAM Used', true);
51+
persesDashboardsPage.searchAndSelectVariable('job', 'node-exporter');
52+
persesDashboardsPage.statChartValueAssertion('RAM Used', false);
53+
54+
});
55+
56+
}
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import { persesDashboardsDashboardDropdownCOO, persesDashboardsDashboardDropdownPersesDev } from '../../fixtures/perses/constants';
2+
import { commonPages } from '../../views/common';
3+
import { listPersesDashboardsPage } from "../../views/list-perses-dashboards";
4+
import { persesDashboardsPage } from '../../views/perses-dashboards';
5+
6+
export interface PerspectiveConfig {
7+
name: string;
8+
beforeEach?: () => void;
9+
}
10+
11+
export function runCOOListPersesTests(perspective: PerspectiveConfig) {
12+
testCOOListPerses(perspective);
13+
}
14+
15+
export function testCOOListPerses(perspective: PerspectiveConfig) {
16+
17+
it(`1.${perspective.name} perspective - List Dashboards (Perses) page`, () => {
18+
cy.log(`1.1. use sidebar nav to go to Observe > Dashboards (Perses)`);
19+
commonPages.titleShouldHaveText('Dashboards');
20+
listPersesDashboardsPage.shouldBeLoaded();
21+
22+
cy.log(`1.2. Filter by Name`);
23+
listPersesDashboardsPage.filter.byName(persesDashboardsDashboardDropdownCOO.ACCELERATORS_COMMON_METRICS[2]);
24+
listPersesDashboardsPage.countDashboards('1');
25+
26+
cy.log(`1.3. Clear all filters`);
27+
listPersesDashboardsPage.clearAllFilters();
28+
29+
cy.log(`1.4. Filter by Project and Name`);
30+
listPersesDashboardsPage.filter.byProject('perses-dev');
31+
listPersesDashboardsPage.countDashboards('3');
32+
listPersesDashboardsPage.filter.byName(persesDashboardsDashboardDropdownPersesDev.PROMETHEUS_OVERVIEW[2]);
33+
listPersesDashboardsPage.countDashboards('1');
34+
35+
cy.log(`1.5. Clear all filters`);
36+
listPersesDashboardsPage.clearAllFilters();
37+
38+
cy.log(`1.6. Filter by Project`);
39+
listPersesDashboardsPage.filter.byProject('perses-dev');
40+
41+
cy.log(`1.7. Clear all filters`);
42+
listPersesDashboardsPage.clearAllFilters();
43+
44+
cy.log(`1.8. Sort by Dashboard - Ascending`);
45+
listPersesDashboardsPage.sortBy('Dashboard');
46+
listPersesDashboardsPage.assertDashboardName(persesDashboardsDashboardDropdownCOO.ACCELERATORS_COMMON_METRICS[2], 0);
47+
listPersesDashboardsPage.assertDashboardName(persesDashboardsDashboardDropdownCOO.APM_DASHBOARD[2], 1);
48+
listPersesDashboardsPage.assertDashboardName(persesDashboardsDashboardDropdownCOO.K8S_COMPUTE_RESOURCES_CLUSTER[2], 2);
49+
listPersesDashboardsPage.assertDashboardName(persesDashboardsDashboardDropdownPersesDev.PERSES_DASHBOARD_SAMPLE[2], 3);
50+
listPersesDashboardsPage.assertDashboardName(persesDashboardsDashboardDropdownPersesDev.PROMETHEUS_OVERVIEW[2], 4);
51+
listPersesDashboardsPage.assertDashboardName(persesDashboardsDashboardDropdownPersesDev.THANOS_COMPACT_OVERVIEW[2], 5);
52+
53+
cy.log(`1.9. Sort by Dashboard - Descending`);
54+
listPersesDashboardsPage.sortBy('Dashboard');
55+
listPersesDashboardsPage.assertDashboardName(persesDashboardsDashboardDropdownPersesDev.THANOS_COMPACT_OVERVIEW[2], 0);
56+
listPersesDashboardsPage.assertDashboardName(persesDashboardsDashboardDropdownPersesDev.PROMETHEUS_OVERVIEW[2], 1);
57+
listPersesDashboardsPage.assertDashboardName(persesDashboardsDashboardDropdownPersesDev.PERSES_DASHBOARD_SAMPLE[2], 2);
58+
listPersesDashboardsPage.assertDashboardName(persesDashboardsDashboardDropdownCOO.K8S_COMPUTE_RESOURCES_CLUSTER[2], 3);
59+
listPersesDashboardsPage.assertDashboardName(persesDashboardsDashboardDropdownCOO.APM_DASHBOARD[2], 4);
60+
listPersesDashboardsPage.assertDashboardName(persesDashboardsDashboardDropdownCOO.ACCELERATORS_COMMON_METRICS[2], 5);
61+
62+
cy.log(`1.10. Filter by Name - Empty state`);
63+
listPersesDashboardsPage.filter.byName(persesDashboardsDashboardDropdownCOO.ACCELERATORS_COMMON_METRICS[0]);
64+
listPersesDashboardsPage.emptyState();
65+
listPersesDashboardsPage.countDashboards('0');
66+
67+
cy.log(`1.11. Clear all filters`);
68+
listPersesDashboardsPage.clearAllFilters();
69+
70+
cy.log(`1.12. Click on a dashboard`);
71+
listPersesDashboardsPage.clickDashboard(persesDashboardsDashboardDropdownPersesDev.THANOS_COMPACT_OVERVIEW[2]);
72+
//TODO: change back to shouldBeLoaded when customizable-dashboards gets merged
73+
// persesDashboardsPage.shouldBeLoaded1();
74+
});
75+
76+
}

0 commit comments

Comments
 (0)