|
| 1 | +import { goToRouteAndAcceptTerms, loginAsAdmin, returnToOverview } from "../helpers/testHelpers"; |
| 2 | + |
| 3 | +it("checks that the field settings control the field visibility.", () => { |
| 4 | + loginAsAdmin("/"); |
| 5 | + |
| 6 | + const waitForSettings = () => { |
| 7 | + cy.wait(["@setting", "@codes", "@codelist_GET"]); |
| 8 | + }; |
| 9 | + cy.get('[data-cy="settings-button"]').click(); |
| 10 | + cy.contains("Lithology fields").click(); |
| 11 | + cy.contains("Select all").click(); |
| 12 | + cy.wait("@setting"); |
| 13 | + waitForSettings(); |
| 14 | + |
| 15 | + goToRouteAndAcceptTerms("/1001140/stratigraphy/lithology"); |
| 16 | + cy.get('[data-cy="styled-layer-9"]').click(); |
| 17 | + cy.contains("From depth [m MD]").should("exist"); |
| 18 | + cy.contains("To depth [m MD]").should("exist"); |
| 19 | + cy.contains("End of borehole").should("exist"); |
| 20 | + cy.contains("Completeness of entries").should("exist"); |
| 21 | + cy.contains("Lithology").should("exist"); |
| 22 | + cy.contains("Original lithology").should("exist"); |
| 23 | + cy.contains("USCS original classification").should("exist"); |
| 24 | + cy.contains("USCS way of determination").should("exist"); |
| 25 | + cy.contains("USCS 1").should("exist"); |
| 26 | + cy.contains("Grain size 1").should("exist"); |
| 27 | + cy.contains("USCS 2").should("exist"); |
| 28 | + cy.contains("Grain size 2").should("exist"); |
| 29 | + cy.contains("USCS 3").should("exist"); |
| 30 | + cy.contains("Grain shape").should("exist"); |
| 31 | + cy.contains("Grain angularity").should("exist"); |
| 32 | + cy.contains("Organic components").should("exist"); |
| 33 | + cy.contains("Debris").should("exist"); |
| 34 | + cy.contains("Debris lithology").should("exist"); |
| 35 | + cy.contains("Striations").should("exist"); |
| 36 | + cy.contains("Colour").should("exist"); |
| 37 | + cy.contains("Consistency").should("exist"); |
| 38 | + cy.contains("Plasticity").should("exist"); |
| 39 | + cy.contains("Compactness").should("exist"); |
| 40 | + cy.contains("Cohesion").should("exist"); |
| 41 | + cy.contains("Gradation").should("exist"); |
| 42 | + cy.contains("Humidity").should("exist"); |
| 43 | + cy.contains("Alteration").should("exist"); |
| 44 | + cy.contains("Notes").should("exist"); |
| 45 | + |
| 46 | + returnToOverview(); |
| 47 | + cy.get('[data-cy="settings-button"]').click(); |
| 48 | + cy.contains("Lithology fields").click(); |
| 49 | + cy.contains("Unselect all").click(); |
| 50 | + waitForSettings(); |
| 51 | + |
| 52 | + goToRouteAndAcceptTerms("/1001140/stratigraphy/lithology"); |
| 53 | + cy.get('[data-cy="styled-layer-9"]').click(); |
| 54 | + cy.contains("From depth [m MD]").should("exist"); |
| 55 | + cy.contains("To depth [m MD]").should("exist"); |
| 56 | + cy.contains("End of borehole").should("not.exist"); |
| 57 | + cy.contains("Completeness of entries").should("not.exist"); |
| 58 | + cy.contains("Original lithology").should("not.exist"); |
| 59 | + cy.contains("USCS original classification").should("not.exist"); |
| 60 | + cy.contains("USCS way of determination").should("not.exist"); |
| 61 | + cy.contains("USCS 1").should("not.exist"); |
| 62 | + cy.contains("Grain size 1").should("not.exist"); |
| 63 | + cy.contains("USCS 2").should("not.exist"); |
| 64 | + cy.contains("Grain size 2").should("not.exist"); |
| 65 | + cy.contains("USCS 3").should("not.exist"); |
| 66 | + cy.contains("Grain shape").should("not.exist"); |
| 67 | + cy.contains("Grain angularity").should("not.exist"); |
| 68 | + cy.contains("Organic components").should("not.exist"); |
| 69 | + cy.contains("Debris").should("not.exist"); |
| 70 | + cy.contains("Debris lithology").should("not.exist"); |
| 71 | + cy.contains("Colour").should("not.exist"); |
| 72 | + cy.contains("Consistency").should("not.exist"); |
| 73 | + cy.contains("Plasticity").should("not.exist"); |
| 74 | + cy.contains("Compactness").should("not.exist"); |
| 75 | + cy.contains("Cohesion").should("not.exist"); |
| 76 | + cy.contains("Gradation").should("not.exist"); |
| 77 | + cy.contains("Humidity").should("not.exist"); |
| 78 | + cy.contains("Alteration").should("not.exist"); |
| 79 | + cy.contains("Notes").should("not.exist"); |
| 80 | + |
| 81 | + returnToOverview(); |
| 82 | + cy.get('[data-cy="settings-button"]').click(); |
| 83 | + cy.contains("Lithology fields").click(); |
| 84 | + waitForSettings(); |
| 85 | + cy.wait(500); |
| 86 | + |
| 87 | + // manually check some and verify states |
| 88 | + cy.get('[data-cy="checkbox-original_lithology"]').click(); |
| 89 | + cy.get('[data-cy="checkbox-plasticity"]').click(); |
| 90 | + cy.get('[data-cy="checkbox-uscs_1"]').click(); |
| 91 | + cy.get('[data-cy="checkbox-plasticity"] input').should("be.checked"); |
| 92 | + cy.get('[data-cy="checkbox-original_lithology"] input').should("be.checked"); |
| 93 | + cy.get('[data-cy="checkbox-uscs_1"] input').should("be.checked"); |
| 94 | + |
| 95 | + cy.get('[data-cy="checkbox-humidity"] input').should("not.be.checked"); |
| 96 | + cy.get('[data-cy="checkbox-gradation"] input').should("not.be.checked"); |
| 97 | + cy.get('[data-cy="checkbox-cohesion"] input').should("not.be.checked"); |
| 98 | + cy.get('[data-cy="checkbox-compactness"] input').should("not.be.checked"); |
| 99 | +}); |
0 commit comments