diff --git a/src/client/cypress/e2e/editor/fieldMeasurement.cy.js b/src/client/cypress/e2e/editor/fieldMeasurement.cy.js index 60efef7d2..d7d61460e 100644 --- a/src/client/cypress/e2e/editor/fieldMeasurement.cy.js +++ b/src/client/cypress/e2e/editor/fieldMeasurement.cy.js @@ -1,7 +1,8 @@ import { createBorehole, - createStratigraphy, loginAsAdmin, + startBoreholeEditing, + createCompletion, } from "../helpers/testHelpers"; import { evaluateDisplayValue, @@ -10,27 +11,40 @@ import { } from "../helpers/formHelpers"; describe("Tests for the field measurement editor.", () => { - beforeEach(function () { - // add new borehole + it("Creates, updates and deletes field measurement", () => { createBorehole({ "extended.original_name": "INTEADAL" }) .as("borehole_id") - .then(id => createStratigraphy(id, 3000)) + .then(id => createCompletion("test hydrotest", id, 16000002, true)) .then(response => { expect(response).to.have.property("status", 200); }); - - // open field measurement editor cy.get("@borehole_id").then(id => { loginAsAdmin(); - cy.visit(`editor/${id}/hydrogeology/fieldmeasurement`); + cy.visit(`/editor/${id}/completion`); }); + startBoreholeEditing(); + cy.get("[data-cy=completion-content-header-tab-casing]").click(); + cy.wait("@casing_GET"); - // start editing session - cy.contains("a", "Start editing").click(); - cy.wait("@edit_lock"); - }); + cy.get('[data-cy="addCasing-button"]').click({ force: true }); + cy.wait("@codelist_GET"); + + setInput("name", "casing-1"); + setInput("fromDepth", "0"); + setInput("toDepth", "10"); + setSelect("kindId", 2); + setSelect("materialId", 3); + setInput("dateStart", "2021-01-01"); + setInput("dateFinish", "2021-01-02"); + setInput("innerDiameter", "3"); + setInput("outerDiameter", "4"); + + cy.get('[data-cy="save-button"]').click(); + cy.wait("@casing_GET"); + + cy.get('[data-cy="hydrogeology-menu-item"]').click({ force: true }); + cy.get('[data-cy="fieldmeasurement-menu-item"]').click({ force: true }); - it("Creates, updates and deletes field measurement", () => { // switch to german cy.get('[data-cy="menu"]').click({ force: true }); cy.contains("span", "DE").click({ force: true }); @@ -43,6 +57,7 @@ describe("Tests for the field measurement editor.", () => { setSelect("reliabilityId", 1); setInput("startTime", "2012-11-14T12:06"); + setSelect("casingId", 1); setSelect("sampleTypeId", 1); setSelect("parameterId", 5); setInput("value", "77.1045"); @@ -51,6 +66,7 @@ describe("Tests for the field measurement editor.", () => { cy.get('[data-cy="save-button"]').click({ force: true }); //assert field measurementis displayed + evaluateDisplayValue("casingName", "casing-1"); evaluateDisplayValue("field_measurement_sample_type", "Schöpfprobe"); evaluateDisplayValue("parameter", "Sauerstoffsättigung"); evaluateDisplayValue("value", "77.1045 %"); @@ -60,6 +76,7 @@ describe("Tests for the field measurement editor.", () => { setSelect("sampleTypeId", 0); cy.get('[data-cy="save-button"]').click({ force: true }); evaluateDisplayValue("field_measurement_sample_type", "Pumpprobe"); + evaluateDisplayValue("casingName", "casing-1"); // delete field measurement cy.get('[data-cy="delete-button"]').click({ force: true }); diff --git a/src/client/cypress/e2e/editor/groundwaterLevelMeasurement.cy.js b/src/client/cypress/e2e/editor/groundwaterLevelMeasurement.cy.js index f5aec087b..28d89726f 100644 --- a/src/client/cypress/e2e/editor/groundwaterLevelMeasurement.cy.js +++ b/src/client/cypress/e2e/editor/groundwaterLevelMeasurement.cy.js @@ -1,7 +1,8 @@ import { createBorehole, - createStratigraphy, loginAsAdmin, + startBoreholeEditing, + createCompletion, } from "../helpers/testHelpers"; import { evaluateDisplayValue, @@ -10,27 +11,42 @@ import { } from "../helpers/formHelpers"; describe("Tests for the groundwater level measurement editor.", () => { - beforeEach(function () { - // add new borehole + it("Creates, updates and deletes groundwater level measurement", () => { createBorehole({ "extended.original_name": "INTEADAL" }) .as("borehole_id") - .then(id => createStratigraphy(id, 3000)) + .then(id => createCompletion("test hydrotest", id, 16000002, true)) .then(response => { expect(response).to.have.property("status", 200); }); - - // open groundwater level measurement editor cy.get("@borehole_id").then(id => { loginAsAdmin(); - cy.visit(`editor/${id}/hydrogeology/groundwaterlevelmeasurement`); + cy.visit(`/editor/${id}/completion`); }); + startBoreholeEditing(); + cy.get("[data-cy=completion-content-header-tab-casing]").click(); + cy.wait("@casing_GET"); - // start editing session - cy.contains("a", "Start editing").click(); - cy.wait("@edit_lock"); - }); + cy.get('[data-cy="addCasing-button"]').click({ force: true }); + cy.wait("@codelist_GET"); + + setInput("name", "casing-1"); + setInput("fromDepth", "0"); + setInput("toDepth", "10"); + setSelect("kindId", 2); + setSelect("materialId", 3); + setInput("dateStart", "2021-01-01"); + setInput("dateFinish", "2021-01-02"); + setInput("innerDiameter", "3"); + setInput("outerDiameter", "4"); + + cy.get('[data-cy="save-button"]').click(); + cy.wait("@casing_GET"); + + cy.get('[data-cy="hydrogeology-menu-item"]').click({ force: true }); + cy.get('[data-cy="groundwaterlevelmeasurement-menu-item"]').click({ + force: true, + }); - it("Creates, updates and deletes groundwater level measurement", () => { // switch to german cy.get('[data-cy="menu"]').click({ force: true }); cy.contains("span", "DE").click({ force: true }); @@ -43,13 +59,14 @@ describe("Tests for the groundwater level measurement editor.", () => { setSelect("kindId", 2); setSelect("reliabilityId", 1); + setSelect("casingId", 1); setInput("startTime", "2012-11-14T12:06"); setInput("levelM", "789.12"); setInput("levelMasl", "5.4567"); // close editing mask cy.get('[data-cy="save-button"]').click({ force: true }); - + evaluateDisplayValue("casingName", "casing-1"); evaluateDisplayValue("gwlm_kind", "Manometer"); evaluateDisplayValue("gwlm_levelm", "789.12"); evaluateDisplayValue("gwlm_levelmasl", "5.4567"); @@ -60,6 +77,7 @@ describe("Tests for the groundwater level measurement editor.", () => { setSelect("kindId", 1); cy.get('[data-cy="save-button"]').click({ force: true }); evaluateDisplayValue("gwlm_kind", "Drucksonde"); + evaluateDisplayValue("casingName", "casing-1"); // delete groundwater level measurement cy.get('[data-cy="delete-button"]').click({ force: true }); diff --git a/src/client/cypress/e2e/editor/hydrotest.cy.js b/src/client/cypress/e2e/editor/hydrotest.cy.js index 31d3b637b..e9d6eb68b 100644 --- a/src/client/cypress/e2e/editor/hydrotest.cy.js +++ b/src/client/cypress/e2e/editor/hydrotest.cy.js @@ -91,6 +91,7 @@ describe("Tests for the hydrotest editor.", () => { cy.get('[data-cy="save-button"]').click({ force: true }); cy.wait("@hydrotest_GET"); + evaluateDisplayValue("casingName", "casing-1"); evaluateDisplayValue("testKind", "Pump-/Injektionsversuch, variable Rate"); evaluateDisplayValue("flowDirection", ["Entnahme", "Injektion"]); evaluateDisplayValue("evaluationMethod", ["stationär", "instationär"]); diff --git a/src/client/cypress/e2e/editor/waterIngress.cy.js b/src/client/cypress/e2e/editor/waterIngress.cy.js index 1a4bae6de..85aeab7a2 100644 --- a/src/client/cypress/e2e/editor/waterIngress.cy.js +++ b/src/client/cypress/e2e/editor/waterIngress.cy.js @@ -82,6 +82,7 @@ describe("Tests for the wateringress editor.", () => { setSelect("quantityId", 1); cy.get('[data-cy="save-button"]').click({ force: true }); evaluateDisplayValue("quantity", "mittel (30 - 120 l/min)"); + evaluateDisplayValue("casingName", "casing-1"); // delete wateringress cy.get('[data-cy="delete-button"]').click({ force: true }); diff --git a/src/client/src/commons/form/borehole/hydrogeology/fieldMeasurementInput.js b/src/client/src/commons/form/borehole/hydrogeology/fieldMeasurementInput.js index 943f17277..8c47a774c 100644 --- a/src/client/src/commons/form/borehole/hydrogeology/fieldMeasurementInput.js +++ b/src/client/src/commons/form/borehole/hydrogeology/fieldMeasurementInput.js @@ -20,6 +20,9 @@ const FieldMeasurementInput = props => { data?.endTime ? (data.endTime += ":00.000Z") : (data.endTime = null); data.type = ObservationType.fieldMeasurement; data.boreholeId = parentId; + if (data.casingId == null) { + data.casingId = item.casingId; + } return data; }; diff --git a/src/client/src/commons/form/borehole/hydrogeology/groundwaterLevelMeasurementInput.js b/src/client/src/commons/form/borehole/hydrogeology/groundwaterLevelMeasurementInput.js index 31e9d40cd..8f41e9afb 100644 --- a/src/client/src/commons/form/borehole/hydrogeology/groundwaterLevelMeasurementInput.js +++ b/src/client/src/commons/form/borehole/hydrogeology/groundwaterLevelMeasurementInput.js @@ -18,6 +18,9 @@ const GroundwaterLevelMeasurementInput = props => { data?.endTime ? (data.endTime += ":00.000Z") : (data.endTime = null); data.type = ObservationType.groundwaterLevelMeasurement; data.boreholeId = parentId; + if (data.casingId == null) { + data.casingId = item.casingId; + } return data; }; diff --git a/src/client/src/commons/form/borehole/hydrogeology/hydrotestInput.js b/src/client/src/commons/form/borehole/hydrogeology/hydrotestInput.js index 287af0de6..9c87791a4 100644 --- a/src/client/src/commons/form/borehole/hydrogeology/hydrotestInput.js +++ b/src/client/src/commons/form/borehole/hydrogeology/hydrotestInput.js @@ -146,6 +146,10 @@ const HydrotestInput = props => { data.codelistIds = [...data.codelistIds, ...data.evaluationMethodId]; } + if (data.casingId == null) { + data.casingId = item.casingId; + } + delete data.testKindId; delete data.flowDirectionId; delete data.evaluationMethodId; diff --git a/src/client/src/commons/form/borehole/hydrogeology/waterIngressInput.js b/src/client/src/commons/form/borehole/hydrogeology/waterIngressInput.js index f856a85be..6777fe6a8 100644 --- a/src/client/src/commons/form/borehole/hydrogeology/waterIngressInput.js +++ b/src/client/src/commons/form/borehole/hydrogeology/waterIngressInput.js @@ -18,6 +18,9 @@ const WaterIngressInput = props => { data?.endTime ? (data.endTime += ":00.000Z") : (data.endTime = null); data.type = ObservationType.waterIngress; data.boreholeId = parentId; + if (data.casingId == null) { + data.casingId = item.casingId; + } return data; };