diff options
Diffstat (limited to 'tests/cypress/e2e/search.cy.ts')
| -rw-r--r-- | tests/cypress/e2e/search.cy.ts | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/tests/cypress/e2e/search.cy.ts b/tests/cypress/e2e/search.cy.ts index f105a5c..5f2081d 100644 --- a/tests/cypress/e2e/search.cy.ts +++ b/tests/cypress/e2e/search.cy.ts @@ -1,7 +1,10 @@ +import { ROUTES } from '../../../src/utils/constants'; + const queryWithArticles = 'Coldark'; const queryWithoutArticles = 'etEtRerum'; describe('Search', () => { + /* eslint-disable max-statements */ it('should open and close search form by clicking on search button', () => { cy.visit('/'); cy.findByLabelText(/Fermer la recherche/i).should('not.exist'); @@ -15,27 +18,28 @@ describe('Search', () => { cy.findByRole('searchbox', { name: /Rechercher/i }).should('not.exist'); cy.findByLabelText(/Ouvrir la recherche/i).should('exist'); }); + /* eslint-enable max-statements */ - it('should navigate the search page', async () => { + it('should navigate the search page', () => { cy.visit('/'); cy.findByLabelText(/Ouvrir la recherche/i).click(); cy.findByRole('searchbox', { name: /Rechercher/i }).type( `${queryWithArticles}{enter}` ); - cy.url().should('include', '/blog'); + cy.url().should('include', ROUTES.SEARCH); cy.findByRole('heading', { level: 1 }).contains( /Résultats de la recherche pour/i ); }); - it('should display the total of articles if successful', async () => { - cy.visit(`/recherche?s=${encodeURIComponent(queryWithArticles)}`); + it('should display the total of articles if successful', () => { + cy.visit(`${ROUTES.SEARCH}?s=${encodeURIComponent(queryWithArticles)}`); const dtSiblings = cy.findByRole('term', { name: /Total/i }).siblings(); dtSiblings.findByRole('definition').contains(/article/i); }); it('should display a search form if unsuccessful', () => { - cy.visit(`/recherche?s=${encodeURIComponent(queryWithoutArticles)}`); + cy.visit(`${ROUTES.SEARCH}?s=${encodeURIComponent(queryWithoutArticles)}`); cy.findByRole('searchbox', { name: /Rechercher/i }).should('exist'); }); }); |
