]> git.proxmox.com Git - ceph.git/blame - ceph/src/pybind/mgr/dashboard/frontend/cypress/integration/common/grafana.feature.po.ts
buildsys: change download over to reef release
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / cypress / integration / common / grafana.feature.po.ts
CommitLineData
2a845540
TL
1import { e2e } from '@grafana/e2e';
2import { Then, When } from 'cypress-cucumber-preprocessor/steps';
3import 'cypress-iframe';
4
5function getIframe() {
6 cy.frameLoaded('#iframe');
7 return cy.iframe();
8}
9
10Then('I should see the grafana panel {string}', (panels: string) => {
11 getIframe().within(() => {
12 for (const panel of panels.split(', ')) {
13 cy.get('.grafana-app')
14 .wait(100)
15 .within(() => {
16 e2e.components.Panels.Panel.title(panel).should('be.visible');
17 });
18 }
19 });
20});
21
22When('I view the grafana panel {string}', (panels: string) => {
23 getIframe().within(() => {
24 for (const panel of panels.split(', ')) {
25 cy.get('.grafana-app')
26 .wait(100)
27 .within(() => {
28 e2e.components.Panels.Panel.title(panel).should('be.visible').click();
29 e2e.components.Panels.Panel.headerItems('View').should('be.visible').click();
30 });
31 }
32 });
33});
34
35Then('I should not see {string} in the panel {string}', (value: string, panels: string) => {
36 getIframe().within(() => {
37 for (const panel of panels.split(', ')) {
38 cy.get('.grafana-app')
39 .wait(100)
40 .within(() => {
41 cy.get(`[aria-label="${panel} panel"]`)
42 .should('be.visible')
43 .within(() => {
44 cy.get('span').first().should('not.have.text', value);
45 });
46 });
47 }
48 });
49});
50
51Then(
52 'I should see the legends {string} in the graph {string}',
53 (legends: string, panels: string) => {
54 getIframe().within(() => {
55 for (const panel of panels.split(', ')) {
56 cy.get('.grafana-app')
57 .wait(100)
58 .within(() => {
59 cy.get(`[aria-label="${panel} panel"]`)
60 .should('be.visible')
61 .within(() => {
62 for (const legend of legends.split(', ')) {
63 cy.get('a').contains(legend);
64 }
65 });
66 });
67 }
68 });
69 }
70);
71
72Then('I should not see No Data in the graph {string}', (panels: string) => {
73 getIframe().within(() => {
74 for (const panel of panels.split(', ')) {
75 cy.get('.grafana-app')
76 .wait(100)
77 .within(() => {
78 cy.get(`[aria-label="${panel} panel"]`)
79 .should('be.visible')
80 .within(() => {
81 cy.get('div.datapoints-warning').should('not.exist');
82 });
83 });
84 }
85 });
86});