You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by di...@apache.org on 2022/08/31 14:01:30 UTC

[superset] branch chore/cypress-runtime-enhancements updated (9366d170da -> 04d1a76510)

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

diegopucci pushed a change to branch chore/cypress-runtime-enhancements
in repository https://gitbox.apache.org/repos/asf/superset.git


    from 9366d170da Enhance dashboards list tests
     new 18641150c4 Seed/clean up dashboards
     new 04d1a76510 Enhance dashboards list filtering

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../cypress-base/cypress/fixtures/dashboards.json  |  14 +++
 .../cypress/integration/dashboard/utils.ts}        |  44 +++----
 .../dashboard_list/dashboard_list.helper.ts        |  19 ---
 .../dashboardlist.applitools.test.ts               |   2 +-
 .../integration/dashboard_list/filter.test.ts      | 125 +++++++++-----------
 .../integration/dashboard_list/list.test.ts        | 129 ++++++++++++++-------
 .../cypress-base/cypress/support/index.d.ts        |  16 ++-
 .../cypress-base/cypress/support/index.ts          |  71 +++++++-----
 8 files changed, 235 insertions(+), 185 deletions(-)
 create mode 100644 superset-frontend/cypress-base/cypress/fixtures/dashboards.json
 copy superset-frontend/{src/dashboard/stylesheets/grid.less => cypress-base/cypress/integration/dashboard/utils.ts} (52%)
 delete mode 100644 superset-frontend/cypress-base/cypress/integration/dashboard_list/dashboard_list.helper.ts


[superset] 02/02: Enhance dashboards list filtering

Posted by di...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

diegopucci pushed a commit to branch chore/cypress-runtime-enhancements
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 04d1a765103d3f730590daf3f5c6d055892107b2
Author: geido <di...@gmail.com>
AuthorDate: Wed Aug 31 17:01:08 2022 +0300

    Enhance dashboards list filtering
---
 .../cypress/integration/dashboard/utils.ts         |  47 ++++++++
 .../integration/dashboard_list/filter.test.ts      | 125 ++++++++++-----------
 .../integration/dashboard_list/list.test.ts        |  19 +++-
 3 files changed, 117 insertions(+), 74 deletions(-)

diff --git a/superset-frontend/cypress-base/cypress/integration/dashboard/utils.ts b/superset-frontend/cypress-base/cypress/integration/dashboard/utils.ts
new file mode 100644
index 0000000000..1d29520236
--- /dev/null
+++ b/superset-frontend/cypress-base/cypress/integration/dashboard/utils.ts
@@ -0,0 +1,47 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+export function setGridMode(type: 'card' | 'list') {
+    cy.get(`[aria-label="${type}-view"]`).click();
+}
+
+export function interceptFiltering() {
+    cy.intercept('GET', `/api/v1/dashboard/?q=*`).as('filtering');
+}
+
+export function interceptBulkDelete() {
+    cy.intercept('DELETE', `/api/v1/dashboard/?q=*`).as('bulkDelete');
+}
+
+export function interceptDelete() {
+    cy.intercept('DELETE', `/api/v1/dashboard/*`).as('delete');
+}
+
+export function interceptUpdate() {
+    cy.intercept('PUT', `/api/v1/dashboard/*`).as('update');
+}
+
+export function setFilter(filter: string, option: string) {
+    interceptFiltering();
+
+    cy.get(`[aria-label="${filter}"]`).first().click();
+    cy.get(`[aria-label="${filter}"] [title="${option}"]`).click();
+
+    cy.wait('@filtering');
+}
\ No newline at end of file
diff --git a/superset-frontend/cypress-base/cypress/integration/dashboard_list/filter.test.ts b/superset-frontend/cypress-base/cypress/integration/dashboard_list/filter.test.ts
index bf852fc625..dffeddbe0a 100644
--- a/superset-frontend/cypress-base/cypress/integration/dashboard_list/filter.test.ts
+++ b/superset-frontend/cypress-base/cypress/integration/dashboard_list/filter.test.ts
@@ -16,86 +16,75 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-import { DASHBOARD_LIST } from './dashboard_list.helper';
+ import { DASHBOARD_LIST } from 'cypress/utils/urls';
+ import { setGridMode, setFilter } from '../dashboard/utils';
 
-describe('dashboard filters card view', () => {
-  beforeEach(() => {
+function resetFilters() {
+  cy.get('[aria-label="close-circle"]').click({ multiple: true, force: true });
+}
+
+describe('Dashboards filters', () => {
+  before(() => {
     cy.login();
     cy.visit(DASHBOARD_LIST);
-    cy.get('[aria-label="card-view"]').click();
   });
 
-  it('should filter by owners correctly', () => {
-    // filter by owners
-    cy.get('[data-test="filters-select"]').first().click();
-    cy.get('.rc-virtual-list').contains('alpha user').click();
-    cy.get('[data-test="styled-card"]').should('not.exist');
-    cy.get('[data-test="filters-select"]').first().click();
-    cy.get('.rc-virtual-list').contains('gamma user').click();
-    cy.get('[data-test="styled-card"]').should('not.exist');
+  beforeEach(() => {
+    cy.preserveLogin();
+    resetFilters();
   });
 
-  it('should filter by created by correctly', () => {
-    // filter by created by
-    cy.get('[data-test="filters-select"]').eq(1).click();
-    cy.get('.rc-virtual-list').contains('alpha user').click();
-    cy.get('.ant-card').should('not.exist');
-    cy.get('[data-test="filters-select"]').eq(1).click();
-    cy.get('.rc-virtual-list').contains('gamma user').click();
-    cy.get('.ant-card').should('not.exist');
-  });
+  describe('card-view', () => {
+    before(() => {
+      setGridMode('card');
+    });
 
-  it('should filter by published correctly', () => {
-    // filter by published
-    cy.get('[data-test="filters-select"]').eq(2).click();
-    cy.get('.rc-virtual-list').contains('Published').click({ timeout: 5000 });
-    cy.get('[data-test="styled-card"]').should('have.length', 3);
-    cy.get('[data-test="styled-card"]')
-      .contains('USA Births Names')
-      .should('be.visible');
-    cy.get('[data-test="filters-select"]').eq(1).click();
-    cy.get('[data-test="filters-select"]').eq(1).type('unpub{enter}');
-    cy.get('[data-test="styled-card"]').should('have.length', 3);
-  });
-});
+    it('should filter by owners correctly', () => {
+      setFilter('Owner', 'alpha user');
+      cy.getBySel('styled-card').should('not.exist');
+      setFilter('Owner', 'admin user');
+      cy.getBySel('styled-card').should('have.length', 1);
+    });
 
-describe('dashboard filters list view', () => {
-  beforeEach(() => {
-    cy.login();
-    cy.visit(DASHBOARD_LIST);
-    cy.get('[aria-label="list-view"]').click();
-  });
+    it('should filter by created by correctly', () => {
+      setFilter('Created by', 'alpha user');
+      cy.getBySel('styled-card').should('not.exist');
+      setFilter('Created by', 'admin user')
+      cy.getBySel('styled-card').should('have.length', 1);
+    });
 
-  it('should filter by owners correctly', () => {
-    // filter by owners
-    cy.get('[data-test="filters-select"]').first().click();
-    cy.get('.rc-virtual-list').contains('alpha user').click();
-    cy.get('[data-test="table-row"]').should('not.exist');
-    cy.get('[data-test="filters-select"]').first().click();
-    cy.get('.rc-virtual-list').contains('gamma user').click();
-    cy.get('[data-test="table-row"]').should('not.exist');
+    it('should filter by published correctly', () => {
+      setFilter('Status', 'Published');
+      cy.getBySel('styled-card').should('have.length', 3);
+      setFilter('Status', 'Draft');
+      cy.get('[data-test="styled-card"]').should('have.length', 2);
+    });
   });
 
-  it('should filter by created by correctly', () => {
-    // filter by created by
-    cy.get('[data-test="filters-select"]').eq(1).click();
-    cy.get('.rc-virtual-list').contains('alpha user').click();
-    cy.get('[data-test="table-row"]').should('not.exist');
-    cy.get('[data-test="filters-select"]').eq(1).click();
-    cy.get('.rc-virtual-list').contains('gamma user').click();
-    cy.get('[data-test="table-row"]').should('not.exist');
-  });
+  describe('list-view', () => {
+    before(() => {
+      setGridMode('list');
+    });
+
+    it('should filter by created by correctly', () => {
+      setFilter('Owner', 'alpha user');
+      cy.getBySel('table-row').should('not.exist');
+      setFilter('Owner', 'admin user');
+      cy.getBySel('table-row').should('have.length', 1);
+    });
+
+    it('should filter by created by correctly', () => {
+      setFilter('Created by', 'alpha user');
+      cy.getBySel('table-row').should('not.exist');
+      setFilter('Created by', 'admin user')
+      cy.getBySel('table-row').should('have.length', 1);
+    });
 
-  it('should filter by published correctly', () => {
-    // filter by published
-    cy.get('[data-test="filters-select"]').eq(2).click();
-    cy.get('.rc-virtual-list').contains('Published').click();
-    cy.get('[data-test="table-row"]').should('have.length', 3);
-    cy.get('[data-test="table-row"]')
-      .contains('USA Births Names')
-      .should('be.visible');
-    cy.get('[data-test="filters-select"]').eq(2).click();
-    cy.get('[data-test="filters-select"]').eq(2).type('unpub{enter}');
-    cy.get('[data-test="table-row"]').should('have.length', 3);
+    it('should filter by published correctly', () => {
+      setFilter('Status', 'Published');
+      cy.getBySel('table-row').should('have.length', 3);
+      setFilter('Status', 'Draft');
+      cy.getBySel('table-row').should('have.length', 2);
+    });
   });
 });
diff --git a/superset-frontend/cypress-base/cypress/integration/dashboard_list/list.test.ts b/superset-frontend/cypress-base/cypress/integration/dashboard_list/list.test.ts
index 8378370ba6..b1baefd170 100644
--- a/superset-frontend/cypress-base/cypress/integration/dashboard_list/list.test.ts
+++ b/superset-frontend/cypress-base/cypress/integration/dashboard_list/list.test.ts
@@ -17,18 +17,14 @@
  * under the License.
  */
 import { DASHBOARD_LIST } from 'cypress/utils/urls';
+import { setGridMode, setFilter, interceptBulkDelete, interceptUpdate, interceptDelete } from '../dashboard/utils';
 
 function toggleBulkSelect() {
   cy.getBySel("bulk-select").click();
 }
 
-function setGridMode(type: 'card' | 'list') {
-  cy.get(`[aria-label="${type}-view"]`).click();
-}
-
 function orderAlphabetical() {
-  cy.get('[aria-label="Sort"]').first().click();
-  cy.get('[title="Alphabetical"]').click();
+  setFilter('Sort', 'Alphabetical');
 }
 
 function openProperties() {
@@ -154,6 +150,7 @@ describe('Dashboards list', () => {
     });
 
     it('should bulk delete correctly', () => {
+      interceptBulkDelete();
       toggleBulkSelect();
 
       // bulk deletes in card-view
@@ -164,6 +161,7 @@ describe('Dashboards list', () => {
       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');
       cy.getBySel("styled-card").eq(0).should('not.contain', '1 - Sample dashboard');
       cy.getBySel("styled-card").eq(1).should('not.contain', '2 - Sample dashboard');
 
@@ -175,11 +173,14 @@ describe('Dashboards list', () => {
       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');
       cy.getBySel("table-row").eq(0).should('not.contain', '3 - Sample dashboard');
       cy.getBySel("table-row").eq(1).should('not.contain', '4 - Sample dashboard');
     });
 
    it('should delete correctly', () => {
+      interceptDelete();
+
       // deletes in card-view
       setGridMode('card');
       orderAlphabetical();
@@ -188,6 +189,7 @@ describe('Dashboards list', () => {
       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
@@ -195,11 +197,14 @@ describe('Dashboards 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', () => {
+      interceptUpdate();
+
       // edits in card-view
       setGridMode('card');
       orderAlphabetical();
@@ -209,6 +214,7 @@ describe('Dashboards list', () => {
       openProperties();
       cy.getBySel('dashboard-title-input').type(' | EDITED');
       cy.get('button:contains("Save")').click();
+      cy.wait('@update');
       cy.getBySel("styled-card").eq(0).contains('1 - Sample dashboard | EDITED');
 
       // edits in list-view
@@ -216,6 +222,7 @@ describe('Dashboards list', () => {
       cy.getBySel("edit-alt").eq(0).click();
       cy.getBySel('dashboard-title-input').clear().type('1 - Sample dashboard');
       cy.get('button:contains("Save")').click();
+      cy.wait('@update');
       cy.getBySel("table-row").eq(0).contains('1 - Sample dashboard');
     });
   });


[superset] 01/02: Seed/clean up dashboards

Posted by di...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

diegopucci pushed a commit to branch chore/cypress-runtime-enhancements
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 18641150c40dac1655fa99aff024a5cd8eafb50d
Author: geido <di...@gmail.com>
AuthorDate: Wed Aug 31 16:14:31 2022 +0300

    Seed/clean up dashboards
---
 .../cypress-base/cypress/fixtures/dashboards.json  |  14 +++
 .../dashboard_list/dashboard_list.helper.ts        |  19 ----
 .../dashboardlist.applitools.test.ts               |   2 +-
 .../integration/dashboard_list/list.test.ts        | 116 ++++++++++++++-------
 .../cypress-base/cypress/support/index.d.ts        |  16 ++-
 .../cypress-base/cypress/support/index.ts          |  71 +++++++------
 6 files changed, 149 insertions(+), 89 deletions(-)

diff --git a/superset-frontend/cypress-base/cypress/fixtures/dashboards.json b/superset-frontend/cypress-base/cypress/fixtures/dashboards.json
new file mode 100644
index 0000000000..6972cb0552
--- /dev/null
+++ b/superset-frontend/cypress-base/cypress/fixtures/dashboards.json
@@ -0,0 +1,14 @@
+[
+    {
+        "dashboard_title": "1 - Sample dashboard"
+    },
+    {
+        "dashboard_title": "2 - Sample dashboard"
+    },
+    {
+        "dashboard_title": "3 - Sample dashboard"
+    },
+    {
+        "dashboard_title": "4 - Sample dashboard"
+    }
+]
\ No newline at end of file
diff --git a/superset-frontend/cypress-base/cypress/integration/dashboard_list/dashboard_list.helper.ts b/superset-frontend/cypress-base/cypress/integration/dashboard_list/dashboard_list.helper.ts
deleted file mode 100644
index 5ccb39432c..0000000000
--- a/superset-frontend/cypress-base/cypress/integration/dashboard_list/dashboard_list.helper.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-export const DASHBOARD_LIST = '/dashboard/list/';
diff --git a/superset-frontend/cypress-base/cypress/integration/dashboard_list/dashboardlist.applitools.test.ts b/superset-frontend/cypress-base/cypress/integration/dashboard_list/dashboardlist.applitools.test.ts
index d85d9b11ae..c4c62e6c6c 100644
--- a/superset-frontend/cypress-base/cypress/integration/dashboard_list/dashboardlist.applitools.test.ts
+++ b/superset-frontend/cypress-base/cypress/integration/dashboard_list/dashboardlist.applitools.test.ts
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-import { DASHBOARD_LIST } from './dashboard_list.helper';
+ import { DASHBOARD_LIST } from 'cypress/utils/urls';
 
 describe('dashboard list view', () => {
   beforeEach(() => {
diff --git a/superset-frontend/cypress-base/cypress/integration/dashboard_list/list.test.ts b/superset-frontend/cypress-base/cypress/integration/dashboard_list/list.test.ts
index d8dc3285ec..8378370ba6 100644
--- a/superset-frontend/cypress-base/cypress/integration/dashboard_list/list.test.ts
+++ b/superset-frontend/cypress-base/cypress/integration/dashboard_list/list.test.ts
@@ -18,20 +18,6 @@
  */
 import { DASHBOARD_LIST } from 'cypress/utils/urls';
 
-function refresh() {
-  cy.loginGoTo(DASHBOARD_LIST);
-}
-
-function revertChanges() {
-  cy.deleteDashboardByName('0 - Sample dashboard');
-  cy.deleteDashboardByName('1 - Sample dashboard');
-  cy.deleteDashboardByName('0 - Sample dashboard | EDITED');
-}
-
-function ensureAuth() {
-  cy.login();
-}
-
 function toggleBulkSelect() {
   cy.getBySel("bulk-select").click();
 }
@@ -45,15 +31,32 @@ function orderAlphabetical() {
   cy.get('[title="Alphabetical"]').click();
 }
 
+function openProperties() {
+  cy.get('[aria-label="more-vert"]').first().click();
+  cy.getBySel('dashboard-card-option-edit-button').click();
+}
+
+function openMenu() {
+  cy.get('[aria-label="more-vert"]').first().click();
+}
+
+function confirmDelete() {
+  cy.getBySel('delete-modal-input').type('DELETE');
+  cy.getBySel('modal-confirm-button').click();
+}
+
 describe('Dashboards list', () => {
+  before(() => {
+    cy.login();
+  });
+
   beforeEach(() => {
-    ensureAuth();
-    revertChanges();
+    cy.preserveLogin();
   });
 
   describe('list mode', () => {
     before(() => {
-      refresh()
+      cy.visit(DASHBOARD_LIST);
       setGridMode('list');
     });
 
@@ -96,7 +99,7 @@ describe('Dashboards list', () => {
 
   describe('card mode', () => {
     before(() => {
-      refresh();
+      cy.visit(DASHBOARD_LIST);
       setGridMode('card');
     });
 
@@ -126,18 +129,18 @@ describe('Dashboards list', () => {
 
   describe('common actions', () => {
     beforeEach(() => {
-      cy.createDashboard('0 - Sample dashboard');
-      cy.createDashboard('1 - Sample dashboard');
-      refresh();
-      setGridMode('card');
-      orderAlphabetical();
+      cy.createSampleDashboards();
+      cy.visit(DASHBOARD_LIST);
     });
 
     it('should allow to favorite/unfavorite dashboard', () => {
       cy.intercept(`/superset/favstar/Dashboard/*/select/`).as('select');
       cy.intercept(`/superset/favstar/Dashboard/*/unselect/`).as('unselect');
 
-      cy.getBySel('styled-card').first().contains('0 - Sample dashboard')
+      setGridMode('card');
+      orderAlphabetical();
+
+      cy.getBySel('styled-card').first().contains('1 - Sample dashboard')
       cy.getBySel('styled-card').first().find("[aria-label='favorite-unselected']")
         .click();
       cy.wait('@select');
@@ -153,32 +156,67 @@ describe('Dashboards list', () => {
     it('should bulk delete correctly', () => {
       toggleBulkSelect();
 
-      cy.getBySel("styled-card").eq(0).contains('0 - Sample dashboard').click();
-      cy.getBySel("styled-card").eq(1).contains('1 - Sample dashboard').click();
+      // bulk deletes in card-view
+      setGridMode('card');
+      orderAlphabetical();
+
+      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();
-      cy.getBySel('delete-modal-input').type('DELETE');
-      cy.getBySel('modal-confirm-button').click();
-      cy.getBySel("styled-card").eq(0).should('not.contain', '0 - Sample dashboard');
-      cy.getBySel("styled-card").eq(1).should('not.contain', '1 - Sample dashboard');
+      confirmDelete();
+      cy.getBySel("styled-card").eq(0).should('not.contain', '1 - Sample dashboard');
+      cy.getBySel("styled-card").eq(1).should('not.contain', '2 - Sample dashboard');
 
+      // bulk deletes in list-view
+      setGridMode('list');
+      cy.getBySel("table-row").eq(0).contains('3 - Sample dashboard');
+      cy.getBySel("table-row").eq(1).contains('4 - Sample dashboard');
+      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.getBySel("table-row").eq(0).should('not.contain', '3 - Sample dashboard');
+      cy.getBySel("table-row").eq(1).should('not.contain', '4 - Sample dashboard');
     });
 
    it('should delete correctly', () => {
-      cy.getBySel("styled-card").eq(0).contains('0 - Sample dashboard');
-      cy.get('[aria-label="more-vert"]').first().click();
+      // deletes in card-view
+      setGridMode('card');
+      orderAlphabetical();
+
+      cy.getBySel("styled-card").eq(0).contains('1 - Sample dashboard');
+      openMenu();
       cy.getBySel('dashboard-card-option-delete-button').click();
-      cy.getBySel('delete-modal-input').type('DELETE');
-      cy.getBySel('modal-confirm-button').click();
-      cy.getBySel("styled-card").eq(0).should('not.contain', '0 - Sample dashboard');
+      confirmDelete();
+      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.getBySel("table-row").eq(0).should('not.contain', '2 - Sample dashboard');
+
     });
 
     it('should edit correctly', () => {
-      cy.getBySel("styled-card").eq(0).contains('0 - Sample dashboard');
-      cy.get('[aria-label="more-vert"]').first().click();
-      cy.getBySel('dashboard-card-option-edit-button').click();
+      // edits in card-view
+      setGridMode('card');
+      orderAlphabetical();
+      cy.getBySel("styled-card").eq(0).contains('1 - Sample dashboard');
+
+      // change title
+      openProperties();
       cy.getBySel('dashboard-title-input').type(' | EDITED');
       cy.get('button:contains("Save")').click();
-      cy.getBySel("styled-card").eq(0).contains('0 - Sample dashboard | EDITED');
+      cy.getBySel("styled-card").eq(0).contains('1 - Sample dashboard | EDITED');
+
+      // edits in list-view
+      setGridMode('list');
+      cy.getBySel("edit-alt").eq(0).click();
+      cy.getBySel('dashboard-title-input').clear().type('1 - Sample dashboard');
+      cy.get('button:contains("Save")').click();
+      cy.getBySel("table-row").eq(0).contains('1 - Sample dashboard');
     });
   });
 });
diff --git a/superset-frontend/cypress-base/cypress/support/index.d.ts b/superset-frontend/cypress-base/cypress/support/index.d.ts
index eca68a7ced..edb9a9c18b 100644
--- a/superset-frontend/cypress-base/cypress/support/index.d.ts
+++ b/superset-frontend/cypress-base/cypress/support/index.d.ts
@@ -29,6 +29,15 @@ declare namespace Cypress {
      * Login test user.
      */
     login(): void;
+    preserveLogin(): void;
+
+    /**
+     *
+     * Utils
+     */
+
+    getBySel(selector: string): cy;
+    getBySelLike(selector: string): cy;
 
     visitChartByParams(params: string | Record<string, unknown>): cy;
     visitChartByName(name: string): cy;
@@ -54,11 +63,16 @@ declare namespace Cypress {
     getDashboards(): cy;
     getCharts(): cy;
 
+    /**
+     * Create
+     */
+    createSampleDashboards(): void;
+
     /**
      * Delete
      */
     deleteDashboard(id: number): cy;
-    deleteDashboardByName(name: string): cy;
+    deleteDashboardByName(dashboardName: string): cy;
     deleteChartByName(name: string): cy;
     deleteChart(id: number): cy;
   }
diff --git a/superset-frontend/cypress-base/cypress/support/index.ts b/superset-frontend/cypress-base/cypress/support/index.ts
index 782490b250..90442649a2 100644
--- a/superset-frontend/cypress-base/cypress/support/index.ts
+++ b/superset-frontend/cypress-base/cypress/support/index.ts
@@ -19,10 +19,22 @@
 import '@cypress/code-coverage/support';
 import '@applitools/eyes-cypress/commands';
 
+require('cy-verify-downloads').addCustomCommand();
+
 const BASE_EXPLORE_URL = '/explore/?form_data=';
 const TokenName = Cypress.env('TOKEN_NAME');
 
-require('cy-verify-downloads').addCustomCommand();
+function resetSamples() {
+  cy.fixture('dashboards.json').then((dashboards) => {
+    dashboards.forEach((d: { dashboard_title: string }) => {
+      cy.deleteDashboardByName(d.dashboard_title);
+    });
+  });
+}
+
+beforeEach(() => {
+  resetSamples();
+});
 
 Cypress.Commands.add('getBySel', (selector, ...args) => {
   return cy.get(`[data-test=${selector}]`, ...args)
@@ -53,9 +65,8 @@ Cypress.Commands.add('login', () => {
   });
 });
 
-Cypress.Commands.add('loginGoTo', url => {
-  cy.login();
-  cy.visit(url);
+Cypress.Commands.add('preserveLogin', () => {
+  Cypress.Cookies.preserveOnce('session');
 });
 
 Cypress.Commands.add('visitChartByName', name => {
@@ -154,35 +165,37 @@ Cypress.Commands.add(
   },
 );
 
-Cypress.Commands.add('createDashboard', (dashboardName: string) =>
-  cy
-  .request({
-    method: 'POST',
-    url: `/api/v1/dashboard/`,
-    body: {
-      dashboard_title: dashboardName,
-    },
-    headers: {
-      Cookie: `csrf_access_token=${window.localStorage.getItem(
-        'access_token',
-      )}`,
-      'Content-Type': 'application/json',
-      Authorization: `Bearer ${TokenName}`,
-      'X-CSRFToken': `${window.localStorage.getItem('access_token')}`,
-      Referer: `${Cypress.config().baseUrl}/`,
-    },
+Cypress.Commands.add('createSampleDashboards', () =>
+  cy.fixture('dashboards.json').then((dashboards) => {
+    dashboards.forEach((d: { dashboard_title: string }) => {
+      cy
+      .request({
+        method: 'POST',
+        url: `/api/v1/dashboard/`,
+        body: {
+          dashboard_title: d.dashboard_title,
+        },
+        headers: {
+          Cookie: `csrf_access_token=${window.localStorage.getItem(
+            'access_token',
+          )}`,
+          'Content-Type': 'application/json',
+          Authorization: `Bearer ${TokenName}`,
+          'X-CSRFToken': `${window.localStorage.getItem('access_token')}`,
+          Referer: `${Cypress.config().baseUrl}/`,
+        },
+      })
+      .then(resp => resp);
+    });
   })
-  .then(resp => resp),
 );
 
-Cypress.Commands.add('deleteDashboardByName', (name: string) =>
+Cypress.Commands.add('deleteDashboardByName', (dashboardName: string) =>
   cy.getDashboards().then((dashboards: any) => {
-    dashboards?.forEach((element: any) => {
-      if (element.dashboard_title === name) {
-        const elementId = element.id;
-        cy.deleteDashboard(elementId);
-      }
-    });
+    const dashboard = dashboards.find(d => d.dashboard_title === dashboardName);
+    if (dashboard) {
+      cy.deleteDashboard(dashboard.id);
+    }
   }),
 );