From bb2d78e75626a99ce8ccd5be31924bd4dd799faf Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Wed, 15 Nov 2023 19:11:06 +0100 Subject: test: fix most of the e2e tests errors * back-to-top test is not working: for some reasons, the link only appears when manually scrolling * search test has failure test: it seems the page meta is too long to load Anyway, the pages will be refactored and the e2e should also be refactored. But the back to top test remains problematic... --- tests/cypress/e2e/pages/contact.cy.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'tests/cypress/e2e/pages') diff --git a/tests/cypress/e2e/pages/contact.cy.ts b/tests/cypress/e2e/pages/contact.cy.ts index fa5a928..64f8bdb 100644 --- a/tests/cypress/e2e/pages/contact.cy.ts +++ b/tests/cypress/e2e/pages/contact.cy.ts @@ -1,3 +1,4 @@ +import { CONFIG } from '../../../../src/utils/config'; import { ROUTES } from '../../../../src/utils/constants'; const userName = 'Cypress Test'; @@ -17,6 +18,7 @@ describe('Contact Page', () => { }); it('submits the form', () => { + cy.intercept('POST', CONFIG.api.url ?? '').as('sendMail'); cy.findByRole('textbox', { name: /Nom/i }) .type(userName) .should('have.value', userName); @@ -30,7 +32,9 @@ describe('Contact Page', () => { .type(message) .should('have.value', message); cy.findByRole('button', { name: /Envoyer/i }).click(); - cy.findByText(/E-mail en cours d'envoi/i).should('be.visible'); + cy.findByText(/Mail en cours/i).should('be.visible'); + cy.wait('@sendMail'); + cy.get('body').should('not.contain.text', /Mail en cours/i); }); it('prevents the form to submit if some fields are missing', () => { @@ -38,6 +42,6 @@ describe('Contact Page', () => { .type(userEmail) .should('have.value', userEmail); cy.findByRole('button', { name: /Envoyer/i }).click(); - cy.findByText(/E-mail en cours d'envoi/i).should('not.be.visible'); + cy.get('body').should('not.contain.text', /Mail en cours/i); }); }); -- cgit v1.2.3