From e04c6152a4e1601047d0e4f31822bd2e8cd075aa Mon Sep 17 00:00:00 2001 From: Suzanne Aitchison Date: Wed, 2 Jun 2021 11:39:24 +0100 Subject: [PATCH] fix flake in delete listing test (#13899) --- cypress/integration/listingFlows/deleteListing.spec.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cypress/integration/listingFlows/deleteListing.spec.js b/cypress/integration/listingFlows/deleteListing.spec.js index c86f37503..c2eb7191f 100644 --- a/cypress/integration/listingFlows/deleteListing.spec.js +++ b/cypress/integration/listingFlows/deleteListing.spec.js @@ -19,10 +19,20 @@ describe('Delete listing', () => { cy.findByRole('link', { name: 'Delete' }).click(); + // Wait until the confirmation page loads + cy.findByRole('heading', { + name: 'Are you sure you want to delete this listing?', + }); + cy.findByRole('main') .findByRole('button', { name: /^Delete$/i }) .click(); + // Wait for the form to submit and the user to be returned to the dashboard + cy.findByRole('heading', { + name: 'Are you sure you want to delete this listing?', + }).should('not.exist'); + cy.findByRole('main') .findByRole('heading', { name: 'Listing title' }) .should('not.exist');