Skip to content

Commit

Permalink
Same for e2e/editPage.cy
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjaminCharmes committed Mar 18, 2024
1 parent 130d04f commit fbff3bf
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions webapp/cypress/e2e/editPage.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ describe("Edit Page", () => {
cy.findByLabelText("ID:").type("editable_sample");
cy.findByLabelText("Date Created:").type("1990-01-07T00:00");

cy.findByLabelText("Name:").type("This is a sample name");
cy.contains("Submit").click();
cy.get("#sample-name").type("This is a sample name");
cy.get("#sample-submit").click();

cy.findByText("editable_sample");
cy.findByText("This is a sample name");
Expand All @@ -52,21 +52,21 @@ describe("Edit Page", () => {
cy.findByText("Add an item").click();
cy.findByText("Add new sample");
cy.findByLabelText("ID:").type("component1");
cy.findByLabelText("Name:").type("This is a component");
cy.contains("Submit").click();
cy.get("#sample-name").type("This is a component");
cy.get("#sample-submit").click();
});

it("Adds a third valid sample, to use as a component", () => {
cy.findByText("Add an item").click();
cy.findByText("Add new sample");
cy.findByLabelText("ID:").type("component2");
cy.findByLabelText("Name:").type("This is another component");
cy.contains("Submit").click();
cy.get("#sample-name").type("This is another component");
cy.get("#sample-submit").click();
});

it("Checks editing the sample edit page", () => {
cy.findByText("editable_sample").click();
cy.findByLabelText("Name").should("have.value", "This is a sample name");
cy.get("#sample-name").should("have.value", "This is a sample name");
cy.findByLabelText("Chemical formula").type("NaCoO2", { force: true });

cy.findByText("Unsaved changes");
Expand Down Expand Up @@ -218,7 +218,7 @@ describe("Edit Page", () => {

it("Add some blocks to the sample and checks unsaved warning behavior", () => {
cy.findByText("editable_sample").click();
cy.findByLabelText("Name").should("have.value", "This is a sample name");
cy.get("#sample-name").should("have.value", "This is a sample name");

cy.findByText("Add a block").click();
cy.get(".dropdown-menu").within(() => {
Expand Down Expand Up @@ -255,7 +255,7 @@ describe("Edit Page", () => {
cy.contains("Unsaved changes").should("not.exist");

cy.get(".datablock-content div").eq(1).type("The second comment box; further changes");
cy.findByLabelText("Name").type("name change");
cy.get("#sample-name").type("name change");
cy.contains("Unsaved changes");

cy.get(".fa-save").click();
Expand Down

0 comments on commit fbff3bf

Please sign in to comment.