diff --git a/src/client/cypress/e2e/editor/backfill.cy.js b/src/client/cypress/e2e/editor/backfill.cy.js index 411dcd06d..dd8ee563a 100644 --- a/src/client/cypress/e2e/editor/backfill.cy.js +++ b/src/client/cypress/e2e/editor/backfill.cy.js @@ -46,7 +46,6 @@ describe("Backfill crud tests", () => { it("adds, edits and deletes backfills", () => { // add new backfill card - cy.wait(1000); addItem("addBackfill"); cy.wait("@codelist_GET"); @@ -96,7 +95,6 @@ describe("Backfill crud tests", () => { }); it("sorts backfill", () => { - cy.wait(1000); addItem("addBackfill"); cy.wait("@codelist_GET"); setInput("notes", "Lorem."); @@ -107,7 +105,7 @@ describe("Backfill crud tests", () => { setSelect("casingId", 3); saveForm(); - cy.wait(1000); + cy.wait(500); addItem("addBackfill"); cy.wait("@codelist_GET"); setInput("notes", "Lorem."); diff --git a/src/client/cypress/e2e/editor/casing.cy.js b/src/client/cypress/e2e/editor/casing.cy.js index 0ac637878..4abf3b4f9 100644 --- a/src/client/cypress/e2e/editor/casing.cy.js +++ b/src/client/cypress/e2e/editor/casing.cy.js @@ -86,7 +86,7 @@ describe("Casing crud tests", () => { cy.get("[data-cy=completion-content-tab-instrumentation]").click(); cy.wait("@instrumentation_GET"); - cy.wait(1000); + cy.wait(500); addItem("addInstrument"); cy.wait("@casing_GET"); diff --git a/src/client/cypress/e2e/editor/completion.cy.js b/src/client/cypress/e2e/editor/completion.cy.js index bb0d17efb..9f50635b9 100644 --- a/src/client/cypress/e2e/editor/completion.cy.js +++ b/src/client/cypress/e2e/editor/completion.cy.js @@ -1,4 +1,10 @@ -import { createBorehole, startBoreholeEditing, loginAsAdmin, handlePrompt } from "../helpers/testHelpers"; +import { + createBorehole, + createCompletion, + startBoreholeEditing, + loginAsAdmin, + handlePrompt, +} from "../helpers/testHelpers"; import { setInput, evaluateInput, @@ -22,7 +28,6 @@ const toggleHeaderOpen = () => { }; const addCompletion = () => { - cy.wait(500); addItem("addCompletion"); cy.wait("@codelist_GET"); }; @@ -382,24 +387,24 @@ describe("completion crud tests", () => { }); it("checks completion content validation", () => { - createBorehole({ "extended.original_name": "INTEADAL" }).as("borehole_id"); + createBorehole({ "extended.original_name": "INTEADAL" }) + .as("borehole_id") + .then(id => createCompletion("Compl-1", id, 16000001, true)) + .then(response => { + expect(response).to.be.above(0); + }); + + // open completion editor cy.get("@borehole_id").then(id => { loginAsAdmin(); cy.visit(`/editor/${id}/completion`); }); cy.wait("@get-completions-by-boreholeId"); - cy.contains("No completion available"); // start editing session startBoreholeEditing(); - addCompletion(); - setInput("name", "Compl-1"); - setSelect("kindId", 1); - saveChanges(); - // cancel switching content tabs - cy.wait(1000); addItem("addCasing"); cy.wait("@codelist_GET"); setInput("name", "casing 1", "casing-card.0.edit"); @@ -419,7 +424,7 @@ describe("completion crud tests", () => { cy.get('[data-cy="casing-card.0"]').should("not.exist"); // save when switching content tabs - cy.wait(1000); + cy.wait(500); addItem("addCasing"); cy.wait("@codelist_GET"); setInput("name", "casing 1", "casing-card.0.edit"); @@ -435,7 +440,7 @@ describe("completion crud tests", () => { // cancel switching header tabs when content changes are present setContentTab("backfill"); cy.wait("@backfill_GET"); - cy.wait(1000); + cy.wait(500); addItem("addBackfill"); cy.wait("@casing_GET"); setInput("fromDepth", 0); @@ -458,7 +463,7 @@ describe("completion crud tests", () => { cy.get('[data-cy="backfill-card.0"]').should("not.exist"); // save content changes when switching header tabs - cy.wait(1000); + cy.wait(500); addItem("addBackfill"); cy.wait("@casing_GET"); setInput("fromDepth", 0); @@ -476,7 +481,7 @@ describe("completion crud tests", () => { // cancel header changes, no prompt should be displayed for content changes because tab switching was already canceled setContentTab("instrumentation"); cy.wait("@instrumentation_GET"); - cy.wait(1000); + cy.wait(500); addItem("addInstrument"); cy.wait("@casing_GET"); setInput("fromDepth", "0"); @@ -499,7 +504,7 @@ describe("completion crud tests", () => { // reset header changes, cancel content changes addCompletion(); handlePrompt("Completion: Unsaved changes", "Reset"); - cy.wait(1000); + cy.wait(500); handlePrompt("Instrumentation: Unsaved changes", "Cancel"); isHeaderTabSelected(0); isContentTabSelected("instrumentation"); @@ -512,7 +517,7 @@ describe("completion crud tests", () => { setInput("name", "Compl-1 updated", "completion-header"); addCompletion(); handlePrompt("Completion: Unsaved changes", "Reset"); - cy.wait(1000); + cy.wait(500); handlePrompt("Instrumentation: Unsaved changes", "Reset"); isHeaderTabSelected(1); setHeaderTab(0); @@ -522,7 +527,7 @@ describe("completion crud tests", () => { cy.get('[data-cy="instrumentation-card.0"]').should("not.exist"); //reset header changes, save content changes - cy.wait(1000); + cy.wait(500); addItem("addInstrument"); cy.wait("@casing_GET"); setInput("fromDepth", "0"); @@ -534,7 +539,7 @@ describe("completion crud tests", () => { setInput("name", "Compl-1 updated", "completion-header"); addCompletion(); handlePrompt("Completion: Unsaved changes", "Reset"); - cy.wait(1000); + cy.wait(500); handlePrompt("Instrumentation: Unsaved changes", "Save"); isHeaderTabSelected(1); setHeaderTab(0); @@ -549,7 +554,7 @@ describe("completion crud tests", () => { setInput("name", "Compl-1 updated", "completion-header"); addCompletion(); handlePrompt("Completion: Unsaved changes", "Save"); - cy.wait(1000); + cy.wait(500); handlePrompt("Instrumentation: Unsaved changes", "Cancel"); isHeaderTabSelected(0); isContentTabSelected("instrumentation"); @@ -561,7 +566,7 @@ describe("completion crud tests", () => { setInput("name", "Compl-1 updated again", "completion-header"); addCompletion(); handlePrompt("Completion: Unsaved changes", "Save"); - cy.wait(1000); + cy.wait(500); handlePrompt("Instrumentation: Unsaved changes", "Reset"); isHeaderTabSelected(1); setHeaderTab(0); @@ -577,7 +582,7 @@ describe("completion crud tests", () => { setInput("name", "Compl-1 updated again and again", "completion-header"); addCompletion(); handlePrompt("Completion: Unsaved changes", "Save"); - cy.wait(1000); + cy.wait(500); handlePrompt("Instrumentation: Unsaved changes", "Save"); isHeaderTabSelected(1); setHeaderTab(0); diff --git a/src/client/cypress/e2e/editor/fieldMeasurement.cy.js b/src/client/cypress/e2e/editor/fieldMeasurement.cy.js index ad26df42c..0e626aa72 100644 --- a/src/client/cypress/e2e/editor/fieldMeasurement.cy.js +++ b/src/client/cypress/e2e/editor/fieldMeasurement.cy.js @@ -21,9 +21,6 @@ describe("Tests for the field measurement editor.", () => { createCasing("casing-1", id, completionId, "2021-01-01", "2021-01-02", [ { fromDepth: 0, toDepth: 10, kindId: 25000103 }, ]); - createCasing("casing-2", id, completionId, "2021-01-03", "2021-01-04", [ - { fromDepth: 5, toDepth: 12, kindId: 25000105 }, - ]); }), ) .then(response => { @@ -43,8 +40,8 @@ describe("Tests for the field measurement editor.", () => { cy.get('[data-cy="menu"]').click({ force: true }); cy.contains("span", "DE").click({ force: true }); - cy.wait(1000); // create field measurement + cy.wait(500); addItem("addFieldMeasurement"); cy.wait("@casing_GET"); @@ -96,7 +93,7 @@ describe("Tests for the field measurement editor.", () => { saveForm(); cy.wait("@fieldmeasurement_GET"); - cy.wait(1000); + cy.wait(500); addItem("addFieldMeasurement"); cy.wait("@casing_GET"); setInput("fromDepthM", 0); diff --git a/src/client/cypress/e2e/editor/groundwaterLevelMeasurement.cy.js b/src/client/cypress/e2e/editor/groundwaterLevelMeasurement.cy.js index 137c7d72c..fb15312fa 100644 --- a/src/client/cypress/e2e/editor/groundwaterLevelMeasurement.cy.js +++ b/src/client/cypress/e2e/editor/groundwaterLevelMeasurement.cy.js @@ -42,7 +42,6 @@ describe("Tests for the groundwater level measurement editor.", () => { cy.get('[data-cy="menu"]').click({ force: true }); cy.contains("span", "DE").click({ force: true }); - cy.wait(1000); // create groundwater level measurement addItem("addGroundwaterLevelMeasurement"); cy.wait("@casing_GET"); @@ -96,7 +95,7 @@ describe("Tests for the groundwater level measurement editor.", () => { saveForm(); cy.wait("@groundwaterlevelmeasurement_GET"); - cy.wait(1000); + cy.wait(500); addItem("addGroundwaterLevelMeasurement"); cy.wait("@casing_GET"); setInput("fromDepthM", 0); diff --git a/src/client/cypress/e2e/editor/hydrotest.cy.js b/src/client/cypress/e2e/editor/hydrotest.cy.js index 65ff6002f..d1c95752c 100644 --- a/src/client/cypress/e2e/editor/hydrotest.cy.js +++ b/src/client/cypress/e2e/editor/hydrotest.cy.js @@ -47,7 +47,6 @@ describe("Tests for the hydrotest editor.", () => { cy.get('[data-cy="menu"]').click({ force: true }); cy.contains("span", "DE").click({ force: true }); - cy.wait(1000); // create hydrotest addItem("addHydrotest"); cy.wait("@casing_GET"); @@ -128,7 +127,7 @@ describe("Tests for the hydrotest editor.", () => { saveForm(); cy.wait("@hydrotest_GET"); - cy.wait(1000); + cy.wait(500); addItem("addHydrotest"); cy.wait("@casing_GET"); setInput("fromDepthM", 0); diff --git a/src/client/cypress/e2e/editor/waterIngress.cy.js b/src/client/cypress/e2e/editor/waterIngress.cy.js index a33c56248..238f9d52b 100644 --- a/src/client/cypress/e2e/editor/waterIngress.cy.js +++ b/src/client/cypress/e2e/editor/waterIngress.cy.js @@ -47,7 +47,6 @@ describe("Tests for the wateringress editor.", () => { cy.get('[data-cy="menu"]').click({ force: true }); cy.contains("span", "DE").click({ force: true }); - cy.wait(1000); // create wateringress addItem("addWaterIngress"); cy.wait("@casing_GET"); @@ -98,7 +97,7 @@ describe("Tests for the wateringress editor.", () => { saveForm(); cy.wait("@wateringress_GET"); - cy.wait(1000); + cy.wait(500); addItem("addWaterIngress"); cy.wait("@casing_GET"); setInput("fromDepthM", 0);