Skip to content

Commit

Permalink
Fix cy routing
Browse files Browse the repository at this point in the history
  • Loading branch information
MiraGeowerkstatt committed Aug 19, 2024
1 parent 848264c commit 3700bb2
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
15 changes: 10 additions & 5 deletions src/client/cypress/e2e/editor/bulkedit.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { createBorehole, loginAsAdmin, startBoreholeEditing, stopBoreholeEditing } from "../helpers/testHelpers";
import {
createBorehole,
goToRouteAndAccptTerms,
loginAsAdmin,
startBoreholeEditing,
stopBoreholeEditing,
} from "../helpers/testHelpers";
import adminUser from "../../fixtures/adminUser.json";
import { checkAllVisibleRows, checkRowWithText, showTableAndWaitForData } from "../helpers/dataGridHelpers";

Expand Down Expand Up @@ -74,7 +80,6 @@ describe("Test the borehole bulk edit feature.", () => {
cy.get('[data-cy="borehole-table"]').within(() => {
checkRowWithText("AAA_NINTIC");
checkRowWithText("AAA_LOMONE");
section;
});
cy.contains("button", "Bulk editing").click();

Expand Down Expand Up @@ -119,14 +124,14 @@ describe("Test the borehole bulk edit feature.", () => {
it("cannot select locked boreholes for bulk edit", () => {
createBorehole({ "extended.original_name": "AAA_JUNIORSOUFFLE" }).as("borehole_id");
cy.get("@borehole_id").then(id => {
cy.visit(`/${id}/borehole`);
goToRouteAndAccptTerms(`/${id}/borehole`);
startBoreholeEditing();
cy.visit("/");
goToRouteAndAccptTerms(`/`);
showTableAndWaitForData();
cy.contains(".MuiDataGrid-row", "AAA_JUNIORSOUFFLE")
.find('.MuiCheckbox-root input[type="checkbox"]')
.should("be.disabled");
cy.visit(`/${id}/borehole`);
goToRouteAndAccptTerms(`/${id}/borehole`);
stopBoreholeEditing();
});
});
Expand Down
4 changes: 2 additions & 2 deletions src/client/cypress/e2e/editor/completion.cy.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
createBorehole,
createCompletion,
goToRouteAndAccptTerms,
handlePrompt,
loginAsAdmin,
startBoreholeEditing,
Expand Down Expand Up @@ -612,8 +613,7 @@ describe("completion crud tests", () => {
cy.get("@borehole_id").then(id => {
cy.get("@completion1_id").then(completion1Id => {
// Preserves hash when reloading
cy.visit(`/${id}/completion/${completion1Id}`);
cy.get('[data-cy="accept-button"]').click();
goToRouteAndAccptTerms(`/${id}/completion/${completion1Id}`);
cy.location().should(location => {
expect(location.hash).to.eq("#casing");
});
Expand Down
4 changes: 2 additions & 2 deletions src/client/cypress/e2e/editor/fieldMeasurement.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
createCasing,
createCompletion,
createFieldMeasurement,
goToRouteAndAccptTerms,
handlePrompt,
loginAsAdmin,
selectLanguage,
Expand Down Expand Up @@ -90,8 +91,7 @@ describe("Tests for the field measurement editor.", () => {
cy.get("@borehole_id").then(id => {
createFieldMeasurement(id, "2012-11-14T12:06Z", 15203157, 15203209, 15203219, 10, null, 0, 10);
createFieldMeasurement(id, "2012-11-14T12:07Z", 15203157, 15203209, 15203219, 10, null, 0, 12);
cy.visit(`/${id}/hydrogeology/fieldmeasurement`);
cy.get('[data-cy="accept-button"]').click();
goToRouteAndAccptTerms(`/${id}/hydrogeology/fieldmeasurement`);

startBoreholeEditing();
cy.get('[data-cy="fieldMeasurement-card.0"] [data-cy="todepth-formDisplay"]').contains("10");
Expand Down
2 changes: 1 addition & 1 deletion src/client/cypress/e2e/helpers/testHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export const login = user => {
* Login into the application as admin.
*/

const goToRouteAndAccptTerms = route => {
export const goToRouteAndAccptTerms = route => {
cy.visit(route);
cy.get('[data-cy="accept-button"]').click();
};
Expand Down

0 comments on commit 3700bb2

Please sign in to comment.