From 7961642d76243b57575b632cf2762ea417feae13 Mon Sep 17 00:00:00 2001 From: MiraGeowerkstatt Date: Tue, 13 Aug 2024 16:35:07 +0200 Subject: [PATCH] Fix cy tests --- .../cypress/e2e/editor/boreholeTable.cy.js | 5 ++++- src/client/cypress/e2e/editor/bulkedit.cy.js | 16 +++++++++------- src/client/cypress/e2e/filters/filter.cy.js | 7 +------ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/client/cypress/e2e/editor/boreholeTable.cy.js b/src/client/cypress/e2e/editor/boreholeTable.cy.js index 888a9320b..b2f4fcd75 100644 --- a/src/client/cypress/e2e/editor/boreholeTable.cy.js +++ b/src/client/cypress/e2e/editor/boreholeTable.cy.js @@ -112,10 +112,12 @@ describe("Borehole editor table tests", () => { // navigate to page 4 cy.get('[aria-label="next page"]').click(); + cy.wait("@edit_list"); cy.get('[aria-label="next page"]').click(); + cy.wait("@edit_list"); cy.get('[aria-label="next page"]').click(); + cy.wait("@edit_list"); cy.get('[aria-label="next page"]').click(); - cy.wait("@edit_list"); // verify current page is 4 @@ -132,6 +134,7 @@ describe("Borehole editor table tests", () => { // verify current page is still 4 cy.get('[data-cy="showTableButton"]').click(); + cy.get(".MuiDataGrid-row").should("have.length.greaterThan", 0); cy.get(".MuiTablePagination-displayedRows").should("have.text", "401 - 500 of 1627"); cy.get(".MuiDataGrid-row") .eq(0) diff --git a/src/client/cypress/e2e/editor/bulkedit.cy.js b/src/client/cypress/e2e/editor/bulkedit.cy.js index 361075d74..88e3e2bd5 100644 --- a/src/client/cypress/e2e/editor/bulkedit.cy.js +++ b/src/client/cypress/e2e/editor/bulkedit.cy.js @@ -1,4 +1,4 @@ -import { createBorehole, loginAsAdmin, startBoreholeEditing } from "../helpers/testHelpers"; +import { createBorehole, loginAsAdmin, startBoreholeEditing, stopBoreholeEditing } from "../helpers/testHelpers"; import adminUser from "../../fixtures/adminUser.json"; beforeEach(() => { @@ -132,12 +132,14 @@ describe("Test the borehole bulk edit feature.", () => { cy.get("@borehole_id").then(id => { cy.visit(`/${id}/borehole`); startBoreholeEditing(); + cy.visit("/"); + cy.get('[data-cy="showTableButton"]').click(); + cy.get(".MuiDataGrid-row").should("have.length.greaterThan", 0); + cy.contains(".MuiDataGrid-row", "AAA_JUNIORSOUFFLE") + .find('.MuiCheckbox-root input[type="checkbox"]') + .should("be.disabled"); + cy.visit(`/${id}/borehole`); + stopBoreholeEditing(); }); - cy.visit("/"); - cy.get('[data-cy="showTableButton"]').click(); - cy.get(".MuiDataGrid-row").should("have.length.greaterThan", 0); - cy.contains(".MuiDataGrid-row", "AAA_JUNIORSOUFFLE") - .find('.MuiCheckbox-root input[type="checkbox"]') - .should("be.disabled"); }); }); diff --git a/src/client/cypress/e2e/filters/filter.cy.js b/src/client/cypress/e2e/filters/filter.cy.js index 7399d10a0..4e8dadb26 100644 --- a/src/client/cypress/e2e/filters/filter.cy.js +++ b/src/client/cypress/e2e/filters/filter.cy.js @@ -134,13 +134,8 @@ describe("Search filter tests", () => { cy.wait("@edit_list"); // check content of table - cy.get('[data-cy="showTableButton"]').click(); cy.get(".MuiTablePagination-displayedRows").should("have.text", "1 - 39 of 39"); - cy.get(".MuiDataGrid-row") - .eq(2) - .within(() => { - cy.contains("Darion Rowe").should("exist"); - }); + cy.get(".MuiDataGrid-row").contains("Darion Rowe").should("exist"); }); function filterByOriginalLithology() {