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');