From b6fa61b33ddd337379b28ba1c594def4d815dcd9 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Wed, 20 Oct 2021 22:25:33 +0100 Subject: [PATCH] test: :white_check_mark: Updated automation tests --- tests/cypress/support/commands.ts | 3 ++- .../details/movie/moviedetails-buttons.spec.ts | 14 +++++++++----- .../tests/discover/discover-cards-requests.spec.ts | 4 ++-- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/tests/cypress/support/commands.ts b/tests/cypress/support/commands.ts index 35d58a63e..5eba842cc 100644 --- a/tests/cypress/support/commands.ts +++ b/tests/cypress/support/commands.ts @@ -23,6 +23,7 @@ // // -- This will overwrite an existing command -- // Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... }) + import 'cypress-wait-until'; Cypress.Commands.add("landingSettings", (enabled) => { @@ -66,7 +67,7 @@ Cypress.Commands.add('removeLogin', () => { }); Cypress.Commands.add('verifyNotification', (text) => { - cy.contains(text); + cy.contains(text, {timeout: 10000}); }); Cypress.Commands.add('createUser', (username, password, claims) => { diff --git a/tests/cypress/tests/details/movie/moviedetails-buttons.spec.ts b/tests/cypress/tests/details/movie/moviedetails-buttons.spec.ts index ea175753a..cff77783b 100644 --- a/tests/cypress/tests/details/movie/moviedetails-buttons.spec.ts +++ b/tests/cypress/tests/details/movie/moviedetails-buttons.spec.ts @@ -10,7 +10,7 @@ describe("Movie Details Buttons", () => { Page.adminOptionsDialog.requestButton.click(); - cy.verifyNotification("Tom & Jerry (2021) has been successfully added"); + cy.verifyNotification("Request for Tom & Jerry has been added successfully"); Page.requestedButton.should("be.visible"); }); @@ -26,7 +26,7 @@ describe("Movie Details Buttons", () => { Page.visit("651571"); Page.requestButton.click(); - cy.verifyNotification("Breach (2020) has been successfully added"); + cy.verifyNotification("Request for Breach has been added successfully"); Page.requestedButton.should("be.visible"); }); @@ -62,7 +62,7 @@ describe("Movie Details Buttons", () => { Page.visit("793723"); Page.requestButton.click(); - cy.verifyNotification("Sentinelle (2021) has been successfully added"); + cy.verifyNotification("Request for Sentinelle has been added successfully"); Page.requestedButton.should("be.visible"); @@ -90,7 +90,7 @@ describe("Movie Details Buttons", () => { Page.adminOptionsDialog.isOpen(); Page.adminOptionsDialog.requestButton.click(); cy.verifyNotification( - "Harry Potter and the Deathly Hallows: Part 1 (2010) has been successfully added" + "Request for Harry Potter and the Deathly Hallows: Part 1 has been added successfully" ); cy.reload(); @@ -98,6 +98,10 @@ describe("Movie Details Buttons", () => { Page.markAvailableButton.should("exist"); Page.markAvailableButton.click(); + cy.waitUntil(() => { + return Page.availableButton.should("be.visible"); + }) + cy.verifyNotification("Request is now available"); Page.availableButton.should("exist"); }); @@ -111,7 +115,7 @@ describe("Movie Details Buttons", () => { Page.adminOptionsDialog.isOpen(); Page.adminOptionsDialog.requestButton.click(); cy.verifyNotification( - "Harry Potter and the Philosopher's Stone (2001) has been successfully added" + "Request for Harry Potter and the Philosopher's Stone has been added successfully" ); cy.reload(); diff --git a/tests/cypress/tests/discover/discover-cards-requests.spec.ts b/tests/cypress/tests/discover/discover-cards-requests.spec.ts index d024225f3..6b330dfa5 100644 --- a/tests/cypress/tests/discover/discover-cards-requests.spec.ts +++ b/tests/cypress/tests/discover/discover-cards-requests.spec.ts @@ -42,7 +42,7 @@ describe("Discover Cards Requests Tests", () => { Page.adminOptionsDialog.isOpen(); Page.adminOptionsDialog.requestButton.click(); - cy.verifyNotification("has been successfully added!"); + cy.verifyNotification("has been added successfully"); card.requestButton.should("not.exist"); card.availabilityText.should("have.text", "Pending"); @@ -91,7 +91,7 @@ describe("Discover Cards Requests Tests", () => { card.requestButton.should("be.visible"); card.requestButton.click(); - cy.verifyNotification("has been successfully added!"); + cy.verifyNotification("has been added successfully"); card.requestButton.should("not.exist"); card.availabilityText.should("have.text", "Pending");