Skip to content

Commit a4374ab

Browse files
committed
mgr/dashboard: adapt dashboard e2e for grafana
Signed-off-by: Nizamudeen A <[email protected]>
1 parent c719d8a commit a4374ab

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

src/pybind/mgr/dashboard/frontend/cypress/e2e/common/grafana.feature.po.ts

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ function getIframe() {
66
return cy.iframe();
77
}
88

9+
const WAIT_TO_LOAD = 1000;
10+
911
Then('I should see the grafana panel {string}', (panels: string) => {
1012
getIframe().within(() => {
1113
for (const panel of panels.split(', ')) {
1214
cy.get('.grafana-app')
13-
.wait(100)
15+
.wait(WAIT_TO_LOAD)
1416
.within(() => {
15-
cy.get(`[aria-label="${panel} panel"]`).should('be.visible');
17+
cy.get(`[title="${panel}"]`).should('be.visible');
1618
});
1719
}
1820
});
@@ -22,13 +24,13 @@ When('I view the grafana panel {string}', (panels: string) => {
2224
getIframe().within(() => {
2325
for (const panel of panels.split(', ')) {
2426
cy.get('.grafana-app')
25-
.wait(100)
27+
.wait(WAIT_TO_LOAD)
2628
.within(() => {
27-
cy.get(`[aria-label="${panel} panel"]`).within(() => {
28-
cy.get('h2').click();
29-
});
30-
cy.get('[aria-label="Panel header item View"]').click();
29+
cy.get(`[data-testid="data-testid Panel header ${panel}"]`).click();
30+
cy.get(`[aria-label="Menu for panel with title ${panel}"]`).click();
3131
});
32+
33+
cy.get('[data-testid="data-testid Panel menu item View"]').click();
3234
}
3335
});
3436
});
@@ -37,9 +39,9 @@ Then('I should not see {string} in the panel {string}', (value: string, panels:
3739
getIframe().within(() => {
3840
for (const panel of panels.split(', ')) {
3941
cy.get('.grafana-app')
40-
.wait(100)
42+
.wait(WAIT_TO_LOAD)
4143
.within(() => {
42-
cy.get(`[aria-label="${panel} panel"]`)
44+
cy.get(`[data-testid="data-testid Panel header ${panel}"]`)
4345
.should('be.visible')
4446
.within(() => {
4547
cy.get('span').first().should('not.have.text', value);
@@ -55,9 +57,9 @@ Then(
5557
getIframe().within(() => {
5658
for (const panel of panels.split(', ')) {
5759
cy.get('.grafana-app')
58-
.wait(100)
60+
.wait(WAIT_TO_LOAD)
5961
.within(() => {
60-
cy.get(`[aria-label="${panel} panel"]`)
62+
cy.get(`[data-testid="data-testid Panel header ${panel}"]`)
6163
.should('be.visible')
6264
.within(() => {
6365
for (const legend of legends.split(', ')) {
@@ -74,9 +76,9 @@ Then('I should not see No Data in the graph {string}', (panels: string) => {
7476
getIframe().within(() => {
7577
for (const panel of panels.split(', ')) {
7678
cy.get('.grafana-app')
77-
.wait(100)
79+
.wait(WAIT_TO_LOAD)
7880
.within(() => {
79-
cy.get(`[aria-label="${panel} panel"]`)
81+
cy.get(`[data-testid="data-testid Panel header ${panel}"]`)
8082
.should('be.visible')
8183
.within(() => {
8284
cy.get('div.datapoints-warning').should('not.exist');

0 commit comments

Comments
 (0)