diff options
| author | Armand Philippot <git@armandphilippot.com> | 2023-11-15 19:11:06 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2023-11-15 19:11:06 +0100 |
| commit | bb2d78e75626a99ce8ccd5be31924bd4dd799faf (patch) | |
| tree | 8f2f24a924d27a7d9b8cf8a81784a3bd157b02b5 /tests/cypress/e2e/pages | |
| parent | 26a1e3a7a08e4b0fdb4dfcc3ed6a6cc21bcef104 (diff) | |
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...
Diffstat (limited to 'tests/cypress/e2e/pages')
| -rw-r--r-- | tests/cypress/e2e/pages/contact.cy.ts | 8 |
1 files changed, 6 insertions, 2 deletions
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); }); }); |
