]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/dashboard: adapt dashboard e2e for grafana
authorNizamudeen A <nia@redhat.com>
Thu, 4 Apr 2024 14:49:50 +0000 (20:19 +0530)
committerNizamudeen A <nia@redhat.com>
Thu, 7 Nov 2024 12:31:55 +0000 (18:01 +0530)
Signed-off-by: Nizamudeen A <nia@redhat.com>
(cherry picked from commit a4374ab53806f353e49f3f818421b2630aad6f0b)

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

index edd0e9b56322fdb33e0e02796cd2de11d0905b72..4f592fb2464e95275b04cbd0b242e997ecd37eb3 100644 (file)
@@ -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');