diff options
Diffstat (limited to 'tests/cypress/e2e/search.cy.ts')
| -rw-r--r-- | tests/cypress/e2e/search.cy.ts | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/tests/cypress/e2e/search.cy.ts b/tests/cypress/e2e/search.cy.ts index 5f2081d..be9aa9f 100644 --- a/tests/cypress/e2e/search.cy.ts +++ b/tests/cypress/e2e/search.cy.ts @@ -4,21 +4,22 @@ 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'); + // findByLabelText does not return the input but the label... + cy.findByLabelText(/Ouvrir la recherche/i) + .prev() + .should('not.be.checked'); cy.findByRole('searchbox', { name: /Rechercher/i }).should('not.exist'); cy.findByLabelText(/Ouvrir la recherche/i).click(); - cy.findByLabelText(/Ouvrir la recherche/i).should('not.exist'); - cy.findByLabelText(/Fermer la recherche/i).should('exist'); + cy.findByLabelText(/Ouvrir la recherche/i) + .prev() + .should('be.checked'); cy.findByRole('searchbox', { name: /Rechercher/i }).should('exist'); - cy.findByLabelText(/Fermer la recherche/i).click(); - cy.findByLabelText(/Fermer la recherche/i).should('not.exist'); + cy.findByLabelText(/Ouvrir la recherche/i).click(); + cy.findByLabelText(/Ouvrir la recherche/i).should('not.be.checked'); 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', () => { cy.visit('/'); @@ -34,8 +35,9 @@ describe('Search', () => { 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); + const metaList = cy.findByRole('heading', { level: 1 }).next(); + metaList.findByRole('term').contains(/Total/i); + metaList.findByRole('definition').contains(/article/i); }); it('should display a search form if unsuccessful', () => { |
