From 9c676bb861032b387a01c1e908ae0e13dd98d805 Mon Sep 17 00:00:00 2001 From: HangLe Date: Wed, 22 Sep 2021 16:48:03 +0300 Subject: [PATCH] Update e2e test --- cypress/integration/home.spec.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/cypress/integration/home.spec.js b/cypress/integration/home.spec.js index 4f0fcdd8b..a847658f3 100644 --- a/cypress/integration/home.spec.js +++ b/cypress/integration/home.spec.js @@ -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() @@ -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() @@ -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")