From 70efcfeaa0603415dd992cb662d8efb960e6e49a Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Tue, 26 Sep 2023 15:54:28 +0200 Subject: 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. --- tests/cypress/e2e/pages/contact.cy.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'tests/cypress/e2e/pages/contact.cy.ts') 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); -- cgit v1.2.3