Skip to content

Commit

Permalink
Update e2e test
Browse files Browse the repository at this point in the history
Update e2e test
  • Loading branch information
hannyle committed Sep 23, 2021
1 parent 2974c50 commit e723b56
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
1 change: 1 addition & 0 deletions cypress/integration/draft.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ describe("Draft operations", function () {
cy.get("div[role=button]").contains("Fill Form").click()
cy.get("h2").contains("Would you like to save draft version of this form")
cy.get("div[role=dialog]").contains("Save").click()
cy.wait(500)
cy.get("ul[data-testid='Draft-objects']").find("li").should("have.length", 2)

// Delete a draft
Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const CancelFormDialog = ({
currentObject.accessionId || currentObject.objectId,
objectType,
currentObject.status,
submissionFolder.folderId,
submissionFolder,
currentObject.cleanedValues || currentObject,
dispatch
)
Expand Down

0 comments on commit e723b56

Please sign in to comment.