From f4dc81bce32763336a623dd44508658224597889 Mon Sep 17 00:00:00 2001 From: Oliver Eyton-Williams Date: Fri, 23 Jul 2021 23:27:12 +0200 Subject: [PATCH] fix: improve cert claiming test (#42989) cy.intercept to ensure that the server has saved the submission should('not.exist') since the modal leaves the dom Co-authored-by: gikf <60067306+gikf@users.noreply.github.com> Co-authored-by: gikf <60067306+gikf@users.noreply.github.com> --- .../learn/responsive-web-design/claim-cert-from-learn.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cypress/integration/learn/responsive-web-design/claim-cert-from-learn.js b/cypress/integration/learn/responsive-web-design/claim-cert-from-learn.js index 00443fc6a4..fe4095e790 100644 --- a/cypress/integration/learn/responsive-web-design/claim-cert-from-learn.js +++ b/cypress/integration/learn/responsive-web-design/claim-cert-from-learn.js @@ -62,7 +62,13 @@ describe('Responsive Web Design Superblock', () => { cy.contains("I've completed this challenge") .should('not.be.disabled') .click(); + cy.intercept('http://localhost:3000/project-completed').as( + 'challengeCompleted' + ); cy.contains('Submit and go to next challenge').click(); + cy.wait('@challengeCompleted') + .its('response.statusCode') + .should('eq', 200); cy.location().should(loc => { expect(loc.pathname).to.not.eq(url); }); @@ -74,7 +80,7 @@ describe('Responsive Web Design Superblock', () => { }); cy.get('.donation-modal').should('be.visible'); cy.contains('Ask me later').click(); - cy.get('.donation-modal').should('not.be.visible'); + cy.get('.donation-modal').should('not.exist'); // directed to claim-cert-block section cy.url().should('include', '#claim-cert-block'); cy.contains('Claim Certification').should('not.be.disabled').click();