aboutsummaryrefslogtreecommitdiffstats
path: root/tests/cypress/e2e/pages/404.cy.ts
blob: 77f3085b9220058edbca407df216f844f83d03a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { ROUTES } from '../../../../src/utils/constants';

describe('404 Page', () => {
  beforeEach(() => {
    cy.visit(ROUTES.NOT_FOUND, { failOnStatusCode: false });
  });

  it('successfully loads', () => {
    cy.findByRole('heading', { level: 1 }).should(
      'contain.text',
      'Page non trouvée'
    );
  });

  it('contains a breadcrumbs', () => {
    cy.findByRole('navigation', { name: 'Fil d’Ariane' }).should('exist');
  });

  it('contains a thematics list widget and a topics list widget', () => {
    cy.findByRole('heading', { level: 2, name: 'Thématiques' }).should('exist');
    cy.findByRole('heading', { level: 2, name: 'Sujets' }).should('exist');
  });

  it('provides a form to search for keywords', () => {
    const keywords = 'coldark';

    cy.findByRole('searchbox').type(keywords);
    cy.findByRole('button', { name: /Rechercher/ })
      .click()
      // eslint-disable-next-line @typescript-eslint/no-magic-numbers
      .wait(500);
    cy.findByRole('heading', { level: 1 }).should('contain.text', keywords);
  });
});