Skip to content

Commit

Permalink
Update e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
hannyle committed Sep 22, 2021
1 parent 2974c50 commit 9c676bb
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions cypress/integration/home.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe("Home e2e", function () {
cy.contains("Your Draft Submissions", { timeout: 10000 }).should("be.visible")
cy.contains("Your Published Submissions", { timeout: 10000 }).should("be.visible")

cy.get("ul.MuiList-root").eq(0).children().should("have.length.at.most", 5)
// cy.get("ul.MuiList-root").eq(0).children().should("have.length.at.most", 5)

// Create a new Unpublished folder
cy.get("button").contains("Create Submission").click()
Expand Down Expand Up @@ -37,6 +37,12 @@ describe("Home e2e", function () {
cy.get("button[type=button]").contains("Save as Draft").click()
cy.get("div[role=alert]", { timeout: 10000 }).contains("Draft saved with")

// Fill a Sample form draft
cy.clickFillForm("Sample")
cy.get("input[data-testid='title']").type("Test sample")
cy.get("button[type=button]").contains("Save as Draft").click()
cy.get("div[role=alert]", { timeout: 10000 }).contains("Draft saved with")

// Save folder and navigate to Home page
cy.get("button[type=button]").contains("Save and Exit").click()
cy.get('button[aria-label="Save a new folder and move to frontpage"]').contains("Return to homepage").click()
Expand Down Expand Up @@ -72,7 +78,18 @@ describe("Home e2e", function () {

// Navigate to home & edit submitted object
cy.findDraftFolder("Edited unpublished folder")
cy.get('button[aria-label="Edit this object"]').click()

// Edit draft Sample form
cy.get("tr[data-testid='Test sample']").within(() => cy.get('button[aria-label="Edit this object"]').click())
cy.get("input[data-testid='title']").type(" edited")
cy.get("button[type=button]").contains("Update draft").click()
cy.get("div[role=alert]", { timeout: 10000 }).contains("Draft updated with")

// Navigate to home & check updated draft's new title
cy.findDraftFolder("Edited unpublished folder")
cy.get("tr[data-testid='Test sample edited']").should("be.visible")

cy.get("tr[data-testid='Second test title']").within(() => cy.get('button[aria-label="Edit this object"]').click())
cy.get("input[name='descriptor.studyTitle']").type(" edited")
cy.get("button[type=button]").contains("Update").click()
cy.get("div[role=alert]").contains("Object updated")
Expand Down

0 comments on commit 9c676bb

Please sign in to comment.