diff --git a/cypress/e2e/datasets/datasets-general.cy.js b/cypress/e2e/datasets/datasets-general.cy.js index d264ef6b4..dc56ea08b 100644 --- a/cypress/e2e/datasets/datasets-general.cy.js +++ b/cypress/e2e/datasets/datasets-general.cy.js @@ -93,4 +93,55 @@ describe("Datasets general", () => { cy.deleteProposal(proposalId); }); }); + + describe.only("Dataset page filter and scientific condition UI test", () => { + it("should not be able to add duplicated conditions ", () => { + cy.visit("/datasets"); + + cy.get(".user-button").click(); + + cy.get("[data-cy=logout-button]").click(); + + cy.finishedLoading(); + + cy.visit("/datasets"); + + cy.get('[data-cy="more-filters-button"]').click(); + + cy.get('[data-cy="add-scientific-condition-button"]').click(); + + cy.get('input[name="lhs"]').type("test"); + cy.get('input[name="rhs"]').type("1"); + + cy.get('button[type="submit"]').click(); + + cy.get('[data-cy="add-scientific-condition-button"]').click(); + + cy.get('input[name="lhs"]').type("test"); + cy.get('input[name="rhs"]').type("1"); + + cy.get('button[type="submit"]').click(); + + cy.get(".snackbar-warning") + .should("contain", "Condition already exists") + .contains("Close") + .click(); + + cy.get('[data-cy="scientific-condition-filter-list"').should( + "have.length", + 1, + ); + + cy.get('[data-cy="add-scientific-condition-button"]').click(); + + cy.get('input[name="lhs"]').type("test"); + cy.get('input[name="rhs"]').type("2"); + + cy.get('button[type="submit"]').click(); + + cy.get('[data-cy="scientific-condition-filter-list"]') + .find("input") + .should("have.length", 2); + }); + }); }); diff --git a/src/app/datasets/datasets-filter/datasets-filter.component.html b/src/app/datasets/datasets-filter/datasets-filter.component.html index a4187c7b7..7886cfd33 100644 --- a/src/app/datasets/datasets-filter/datasets-filter.component.html +++ b/src/app/datasets/datasets-filter/datasets-filter.component.html @@ -17,7 +17,11 @@ -