You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2025/01/21 17:11:56 UTC

(superset) branch master updated: fix(E2E): Fix flaky Dashboard list delete test (#31933)

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

rusackas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 79f21b09d2 fix(E2E): Fix flaky Dashboard list delete test (#31933)
79f21b09d2 is described below

commit 79f21b09d256b759307d9b454c1d001b4266d2a5
Author: Geido <60...@users.noreply.github.com>
AuthorDate: Tue Jan 21 18:11:48 2025 +0100

    fix(E2E): Fix flaky Dashboard list delete test (#31933)
---
 .../cypress/e2e/dashboard_list/list.test.ts        | 58 ++++++++++++++--------
 1 file changed, 37 insertions(+), 21 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..77d0953edb 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');
@@ -195,31 +206,36 @@ describe('Dashboards list', () => {
         .should('not.contain', '4 - Sample dashboard');
     });
 
-    it('should delete correctly', () => {
-      interceptDelete();
+    it('should delete correctly in list mode', () => {
+      // 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');
+    });
+
+    it('should delete correctly in card mode', () => {
       // 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', () => {