diff options
| author | Armand Philippot <git@armandphilippot.com> | 2023-09-26 15:54:28 +0200 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2023-10-24 12:23:48 +0200 |
| commit | 70efcfeaa0603415dd992cb662d8efb960e6e49a (patch) | |
| tree | 5d37e98fae9aa7e5c3d8ef30a10db9fed9b63e36 /tests/cypress/e2e/pages/contact.cy.ts | |
| parent | 31695306bfed44409f03006ea717fd2cceff8f87 (diff) | |
refactor(routes): replace hardcoded routes with constants
It makes it easier to change a route if needed and it avoid typo
mistakes.
I also refactored a bit the concerned files to be complient with the
new ESlint config. However, I should rewrite the pages to reduce
the number of statements.
Diffstat (limited to 'tests/cypress/e2e/pages/contact.cy.ts')
| -rw-r--r-- | tests/cypress/e2e/pages/contact.cy.ts | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/cypress/e2e/pages/contact.cy.ts b/tests/cypress/e2e/pages/contact.cy.ts index 6e1cdb6..fa5a928 100644 --- a/tests/cypress/e2e/pages/contact.cy.ts +++ b/tests/cypress/e2e/pages/contact.cy.ts @@ -1,3 +1,5 @@ +import { ROUTES } from '../../../../src/utils/constants'; + const userName = 'Cypress Test'; const userEmail = 'cypress@testing.com'; const object = '[Cypress] quos aperiam culpa'; @@ -6,7 +8,7 @@ const message = describe('Contact Page', () => { beforeEach(() => { - cy.visit('/contact'); + cy.visit(ROUTES.CONTACT); }); it('shows a heading and a contact form', () => { @@ -14,7 +16,7 @@ describe('Contact Page', () => { cy.findByRole('form', { name: /Formulaire de contact/i }); }); - it('submits the form', async () => { + it('submits the form', () => { cy.findByRole('textbox', { name: /Nom/i }) .type(userName) .should('have.value', userName); @@ -31,7 +33,7 @@ describe('Contact Page', () => { cy.findByText(/E-mail en cours d'envoi/i).should('be.visible'); }); - it('prevents the form to submit if some fields are missing', async () => { + it('prevents the form to submit if some fields are missing', () => { cy.findByRole('textbox', { name: /E-mail/i }) .type(userEmail) .should('have.value', userEmail); |
