Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set casingId on re-save #1017

Merged
merged 5 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 29 additions & 12 deletions src/client/cypress/e2e/editor/fieldMeasurement.cy.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import {
createBorehole,
createStratigraphy,
loginAsAdmin,
startBoreholeEditing,
createCompletion,
} from "../helpers/testHelpers";
import {
evaluateDisplayValue,
Expand All @@ -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 });
Expand All @@ -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");
Expand All @@ -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 %");
Expand All @@ -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 });
Expand Down
44 changes: 31 additions & 13 deletions src/client/cypress/e2e/editor/groundwaterLevelMeasurement.cy.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import {
createBorehole,
createStratigraphy,
loginAsAdmin,
startBoreholeEditing,
createCompletion,
} from "../helpers/testHelpers";
import {
evaluateDisplayValue,
Expand All @@ -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 });
Expand All @@ -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");
Expand All @@ -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 });
Expand Down
1 change: 1 addition & 0 deletions src/client/cypress/e2e/editor/hydrotest.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"]);
Expand Down
1 change: 1 addition & 0 deletions src/client/cypress/e2e/editor/waterIngress.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ const HydrotestInput = props => {
data.codelistIds = [...data.codelistIds, ...data.evaluationMethodId];
}

if (data.casingId == null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: bei den anderen Hydrogeologytypen (wateringress etc) braucht es das nicht?

data.casingId = item.casingId;
}

delete data.testKindId;
delete data.flowDirectionId;
delete data.evaluationMethodId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down