Skip to content

Commit

Permalink
Add cypress test
Browse files Browse the repository at this point in the history
  • Loading branch information
MiraGeowerkstatt committed Dec 17, 2024
1 parent ec5d534 commit ccd5dee
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions src/client/cypress/e2e/detailPage/coordinates.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,4 +196,44 @@ describe("Tests for editing coordinates of a borehole.", () => {
checkDecimalPlaces("@LV03X-input", 5);
checkDecimalPlaces("@LV03Y-input", 5);
});

it("updates canton and municipality when changing coordinates", () => {
// Type coordinates for Samaden in LV95
cy.get("@LV95X-input").type("2789000");
cy.get("@LV95Y-input").type("1155000");
cy.wait("@location");
cy.wait(4000);

cy.get("@country").should("have.value", "Schweiz");
cy.get("@canton").should("have.value", "Graubünden");
cy.get("@municipality").should("have.value", "Samaden");

// Type coordinates for Unterentfelden in LV95
cy.get("@LV95X-input").clear().type("2646000");
cy.get("@LV95Y-input").clear().type("1247000");

cy.get("@country").should("have.value", "Schweiz");
cy.get("@canton").should("have.value", "Aargau");
cy.get("@municipality").should("have.value", "Unterentfelden");

// switch reference system to LV03
setSelect("originalReferenceSystem", 1);
handlePrompt("Changing the coordinate system will reset the coordinates. Do you want to continue?", "Confirm");

// Type coordinates for Samaden in LV03
cy.get("@LV03X-input").clear().type("789000");
cy.get("@LV03Y-input").clear().type("155000");

cy.get("@country").should("have.value", "Schweiz");
cy.get("@canton").should("have.value", "Graubünden");
cy.get("@municipality").should("have.value", "Samaden");

// Type coordinates for Unterentfelden in LV03
cy.get("@LV03X-input").clear().type("646000");
cy.get("@LV03Y-input").clear().type("247000");

cy.get("@country").should("have.value", "Schweiz");
cy.get("@canton").should("have.value", "Aargau");
cy.get("@municipality").should("have.value", "Unterentfelden");
});
});

0 comments on commit ccd5dee

Please sign in to comment.