Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/npm_and_yarn/src/client/follow-re…
Browse files Browse the repository at this point in the history
…directs-1.15.6
  • Loading branch information
MiraGeowerkstatt authored Mar 18, 2024
2 parents 597a1bb + d3f28b4 commit 694a236
Show file tree
Hide file tree
Showing 8 changed files with 143 additions and 146 deletions.
4 changes: 1 addition & 3 deletions src/client/cypress/e2e/editor/backfill.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down Expand Up @@ -96,7 +95,6 @@ describe("Backfill crud tests", () => {
});

it("sorts backfill", () => {
cy.wait(1000);
addItem("addBackfill");
cy.wait("@codelist_GET");
setInput("notes", "Lorem.");
Expand All @@ -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.");
Expand Down
2 changes: 1 addition & 1 deletion src/client/cypress/e2e/editor/casing.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
47 changes: 26 additions & 21 deletions src/client/cypress/e2e/editor/completion.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { createBorehole, startBoreholeEditing, loginAsAdmin, handlePrompt } from "../helpers/testHelpers";
import {
createBorehole,
createCompletion,
startBoreholeEditing,
loginAsAdmin,
handlePrompt,
} from "../helpers/testHelpers";
import {
setInput,
evaluateInput,
Expand All @@ -22,7 +28,6 @@ const toggleHeaderOpen = () => {
};

const addCompletion = () => {
cy.wait(500);
addItem("addCompletion");
cy.wait("@codelist_GET");
};
Expand Down Expand Up @@ -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");
Expand All @@ -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");
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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");
Expand All @@ -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");
Expand All @@ -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);
Expand All @@ -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");
Expand All @@ -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);
Expand All @@ -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");
Expand All @@ -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);
Expand All @@ -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);
Expand Down
89 changes: 44 additions & 45 deletions src/client/cypress/e2e/editor/fieldMeasurement.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,68 +9,62 @@ import {
import { evaluateDisplayValue, setInput, setSelect } from "../helpers/formHelpers";
import { addItem, startEditing, saveForm, deleteItem } from "../helpers/buttonHelpers";

describe("Tests for the field measurement editor.", () => {
it("Creates, updates and deletes field measurement", () => {
// Create borehole with completion and casings
createBorehole({ "extended.original_name": "INTEADAL" })
.as("borehole_id")
.then(id =>
createCompletion("test fieldmeasurement", id, 16000002, true)
.as("completion_id")
.then(completionId => {
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 => {
expect(response).to.have.property("status", 200);
});

cy.get("@borehole_id").then(id => {
loginAsAdmin();
cy.visit(`/editor/${id}/completion`);
beforeEach(() => {
createBorehole({ "extended.original_name": "INTEADAL" })
.as("borehole_id")
.then(id =>
createCompletion("test fieldmeasurement", id, 16000002, true)
.as("completion_id")
.then(completionId => {
createCasing("casing-1", id, completionId, "2021-01-01", "2021-01-02", [
{ fromDepth: 0, toDepth: 10, kindId: 25000103 },
]);
}),
)
.then(response => {
expect(response).to.have.property("status", 200);
});
startBoreholeEditing();

cy.get('[data-cy="hydrogeology-menu-item"]').click({ force: true });
cy.get('[data-cy="fieldmeasurement-menu-item"]').click({ force: true });
cy.get("@borehole_id").then(id => {
loginAsAdmin();
cy.visit(`/editor/${id}/hydrogeology/fieldmeasurement`);
});
startBoreholeEditing();
});

describe("Tests for the field measurement editor.", () => {
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 });

cy.wait(1000);
// create field measurement
cy.wait(500);
addItem("addFieldMeasurement");
cy.wait("@casing_GET");

setSelect("reliabilityId", 1);
setInput("startTime", "2012-11-14T12:06");
setSelect("casingId", 1);

// close editing mask
saveForm();

//assert field measurementis displayed
cy.wait("@fieldmeasurement_GET");
evaluateDisplayValue("casingName", "test fieldmeasurement - casing-1");

// edit field measurement
startEditing();
addItem("addFieldMeasurementResult");
setSelect("fieldMeasurementResults.0.sampleTypeId", 0);
setSelect("fieldMeasurementResults.0.parameterId", 0, 9);
setInput("fieldMeasurementResults.0.value", "10");
saveForm();
cy.wait("@fieldmeasurement_GET");

evaluateDisplayValue("casingName", "test fieldmeasurement - casing-1");
evaluateDisplayValue("fieldMeasurementResult.0.sampleType", "Pumpprobe");
evaluateDisplayValue("fieldMeasurementResult.0.parameter", "Temperatur");
evaluateDisplayValue("fieldMeasurementResult.0.value", "10 °C");
evaluateDisplayValue("reliability", "fraglich");

// edit field measurement
startEditing();
setSelect("reliabilityId", 2);
saveForm();
cy.wait("@fieldmeasurement_GET");
evaluateDisplayValue("reliability", "andere");

// delete field measurement
deleteItem();
Expand All @@ -80,29 +74,34 @@ describe("Tests for the field measurement editor.", () => {
});

it("sorts fieldmeasurement", () => {
createBorehole({ "extended.original_name": "INTEADAL" }).as("borehole_id");
cy.get("@borehole_id").then(id => {
loginAsAdmin();
cy.visit(`/editor/${id}/hydrogeology/fieldmeasurement`);
});
startBoreholeEditing();
// Create borehole with completion and casings

addItem("addFieldMeasurement");
cy.wait("@casing_GET");
setInput("fromDepthM", 0);
setInput("toDepthM", 10);
setSelect("reliabilityId", 1);
setInput("startTime", "2012-11-14T12:06");
setSelect("casingId", 1);

setSelect("fieldMeasurementResults.0.sampleTypeId", 0);
setSelect("fieldMeasurementResults.0.parameterId", 0, 9);
setInput("fieldMeasurementResults.0.value", "10");
saveForm();
cy.wait("@fieldmeasurement_GET");

cy.wait(1000);
cy.wait(500);
addItem("addFieldMeasurement");
cy.wait("@casing_GET");
setInput("fromDepthM", 0);
setInput("toDepthM", 12);
setSelect("reliabilityId", 1);
setInput("startTime", "2012-11-14T12:06");
setSelect("casingId", 1);

setSelect("fieldMeasurementResults.0.sampleTypeId", 0);
setSelect("fieldMeasurementResults.0.parameterId", 0, 9);
setInput("fieldMeasurementResults.0.value", "10");
saveForm();
cy.wait("@fieldmeasurement_GET");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions src/client/cypress/e2e/editor/hydrotest.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions src/client/cypress/e2e/editor/waterIngress.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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);
Expand Down
Loading

0 comments on commit 694a236

Please sign in to comment.