This is an automated email from the ASF dual-hosted git repository.

diegopucci pushed a commit to branch geido/fix/e2e-dashboard-list
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 10f94c74c17bcf58d897708e82f3faac369e5098
Author: Diego Pucci <[email protected]>
AuthorDate: Mon Jan 20 19:23:14 2025 +0100

    fix(E2E): Fix flaky Dashboard list delete test
---
 .../cypress/e2e/dashboard_list/list.test.ts        | 54 ++++++++++++++--------
 1 file changed, 34 insertions(+), 20 deletions(-)

diff --git 
a/superset-frontend/cypress-base/cypress/e2e/dashboard_list/list.test.ts 
b/superset-frontend/cypress-base/cypress/e2e/dashboard_list/list.test.ts
index e6619c3ee0..3cd91fc8ba 100644
--- a/superset-frontend/cypress-base/cypress/e2e/dashboard_list/list.test.ts
+++ b/superset-frontend/cypress-base/cypress/e2e/dashboard_list/list.test.ts
@@ -40,11 +40,25 @@ function openMenu() {
   cy.get('[aria-label="more-vert"]').first().click();
 }
 
-function confirmDelete() {
+function confirmDelete(bulk = false) {
+  interceptDelete();
+  interceptBulkDelete();
+
   // Wait for modal dialog to be present and visible
   cy.get('[role="dialog"][aria-modal="true"]').should('be.visible');
-  
cy.getBySel('delete-modal-input').should('be.visible').clear().type('DELETE');
+  cy.getBySel('delete-modal-input')
+    .should('be.visible')
+    .then($input => {
+      cy.wrap($input).clear();
+      cy.wrap($input).type('DELETE');
+    });
   cy.getBySel('modal-confirm-button').should('be.visible').click();
+
+  if (bulk) {
+    cy.wait('@bulkDelete');
+  } else {
+    cy.wait('@delete');
+  }
 }
 
 describe('Dashboards list', () => {
@@ -159,7 +173,6 @@ describe('Dashboards list', () => {
     });
 
     it('should bulk delete correctly', () => {
-      interceptBulkDelete();
       toggleBulkSelect();
 
       // bulk deletes in card-view
@@ -169,8 +182,7 @@ describe('Dashboards list', () => {
       cy.getBySel('styled-card').eq(0).contains('1 - Sample 
dashboard').click();
       cy.getBySel('styled-card').eq(1).contains('2 - Sample 
dashboard').click();
       cy.getBySel('bulk-select-action').eq(0).contains('Delete').click();
-      confirmDelete();
-      cy.wait('@bulkDelete');
+      confirmDelete(true);
       cy.getBySel('styled-card')
         .eq(0)
         .should('not.contain', '1 - Sample dashboard');
@@ -185,8 +197,7 @@ describe('Dashboards list', () => {
       cy.get('[data-test="table-row"] input[type="checkbox"]').eq(0).click();
       cy.get('[data-test="table-row"] input[type="checkbox"]').eq(1).click();
       cy.getBySel('bulk-select-action').eq(0).contains('Delete').click();
-      confirmDelete();
-      cy.wait('@bulkDelete');
+      confirmDelete(true);
       cy.getBySel('table-row')
         .eq(0)
         .should('not.contain', '3 - Sample dashboard');
@@ -196,30 +207,33 @@ describe('Dashboards list', () => {
     });
 
     it('should delete correctly', () => {
-      interceptDelete();
+      // deletes in list-view
+      setGridMode('list');
+
+      cy.getBySel('table-row')
+        .eq(0)
+        .contains('4 - Sample dashboard')
+        .should('exist');
+      cy.getBySel('dashboard-list-trash-icon').eq(0).click();
+      confirmDelete();
+      cy.getBySel('table-row')
+        .eq(0)
+        .should('not.contain', '4 - Sample dashboard');
 
       // deletes in card-view
       setGridMode('card');
       orderAlphabetical();
 
-      cy.getBySel('styled-card').eq(0).contains('1 - Sample dashboard');
+      cy.getBySel('styled-card')
+        .eq(0)
+        .contains('1 - Sample dashboard')
+        .should('exist');
       openMenu();
       cy.getBySel('dashboard-card-option-delete-button').click();
       confirmDelete();
-      cy.wait('@delete');
       cy.getBySel('styled-card')
         .eq(0)
         .should('not.contain', '1 - Sample dashboard');
-
-      // deletes in list-view
-      setGridMode('list');
-      cy.getBySel('table-row').eq(0).contains('2 - Sample dashboard');
-      cy.getBySel('dashboard-list-trash-icon').eq(0).click();
-      confirmDelete();
-      cy.wait('@delete');
-      cy.getBySel('table-row')
-        .eq(0)
-        .should('not.contain', '2 - Sample dashboard');
     });
 
     it('should edit correctly', () => {

Reply via email to