From: Nizamudeen A Date: Thu, 4 Apr 2024 14:49:50 +0000 (+0530) Subject: mgr/dashboard: adapt dashboard e2e for grafana X-Git-Tag: testing/wip-vshankar-testing-20241122.180834-squid-debug~28^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=1c6d834408fd88b33a23a320ba29dff905230e36;p=ceph-ci.git mgr/dashboard: adapt dashboard e2e for grafana Signed-off-by: Nizamudeen A (cherry picked from commit a4374ab53806f353e49f3f818421b2630aad6f0b) --- diff --git a/src/pybind/mgr/dashboard/frontend/cypress/e2e/common/grafana.feature.po.ts b/src/pybind/mgr/dashboard/frontend/cypress/e2e/common/grafana.feature.po.ts index edd0e9b5632..4f592fb2464 100644 --- a/src/pybind/mgr/dashboard/frontend/cypress/e2e/common/grafana.feature.po.ts +++ b/src/pybind/mgr/dashboard/frontend/cypress/e2e/common/grafana.feature.po.ts @@ -6,13 +6,15 @@ function getIframe() { return cy.iframe(); } +const WAIT_TO_LOAD = 1000; + Then('I should see the grafana panel {string}', (panels: string) => { getIframe().within(() => { for (const panel of panels.split(', ')) { cy.get('.grafana-app') - .wait(100) + .wait(WAIT_TO_LOAD) .within(() => { - cy.get(`[aria-label="${panel} panel"]`).should('be.visible'); + cy.get(`[title="${panel}"]`).should('be.visible'); }); } }); @@ -22,13 +24,13 @@ When('I view the grafana panel {string}', (panels: string) => { getIframe().within(() => { for (const panel of panels.split(', ')) { cy.get('.grafana-app') - .wait(100) + .wait(WAIT_TO_LOAD) .within(() => { - cy.get(`[aria-label="${panel} panel"]`).within(() => { - cy.get('h2').click(); - }); - cy.get('[aria-label="Panel header item View"]').click(); + cy.get(`[data-testid="data-testid Panel header ${panel}"]`).click(); + cy.get(`[aria-label="Menu for panel with title ${panel}"]`).click(); }); + + cy.get('[data-testid="data-testid Panel menu item View"]').click(); } }); }); @@ -37,9 +39,9 @@ Then('I should not see {string} in the panel {string}', (value: string, panels: getIframe().within(() => { for (const panel of panels.split(', ')) { cy.get('.grafana-app') - .wait(100) + .wait(WAIT_TO_LOAD) .within(() => { - cy.get(`[aria-label="${panel} panel"]`) + cy.get(`[data-testid="data-testid Panel header ${panel}"]`) .should('be.visible') .within(() => { cy.get('span').first().should('not.have.text', value); @@ -55,9 +57,9 @@ Then( getIframe().within(() => { for (const panel of panels.split(', ')) { cy.get('.grafana-app') - .wait(100) + .wait(WAIT_TO_LOAD) .within(() => { - cy.get(`[aria-label="${panel} panel"]`) + cy.get(`[data-testid="data-testid Panel header ${panel}"]`) .should('be.visible') .within(() => { for (const legend of legends.split(', ')) { @@ -74,9 +76,9 @@ Then('I should not see No Data in the graph {string}', (panels: string) => { getIframe().within(() => { for (const panel of panels.split(', ')) { cy.get('.grafana-app') - .wait(100) + .wait(WAIT_TO_LOAD) .within(() => { - cy.get(`[aria-label="${panel} panel"]`) + cy.get(`[data-testid="data-testid Panel header ${panel}"]`) .should('be.visible') .within(() => { cy.get('div.datapoints-warning').should('not.exist');