aboutsummaryrefslogtreecommitdiffstats
path: root/tests/cypress/e2e/pages/homepage.cy.ts
blob: 29318bec09e0f0e0e5e618f3a5bf17d314ab0606 (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 { CONFIG } from '../../../../src/utils/config';
import { ROUTES } from '../../../../src/utils/constants';

describe('HomePage', () => {
  beforeEach(() => {
    cy.visit(ROUTES.HOME);
  });

  it('successfully loads', () => {
    cy.findByRole('heading', { level: 1 }).contains(CONFIG.name);
    cy.findByText(CONFIG.baseline).should('exist');
  });

  it('contains the three most recent articles', () => {
    // eslint-disable-next-line @typescript-eslint/no-magic-numbers
    cy.findAllByRole('link', { name: /^Consulter/i }).should('have.length', 3);
  });

  it('contains a link to contact me', () => {
    cy.findByRole('link', { name: 'Me contacter' }).should(
      'have.attr',
      'href',
      ROUTES.CONTACT
    );
  });

  it('contains a link to RSS feed', () => {
    cy.findByRole('link', { name: 'S’abonner' }).should(
      'have.attr',
      'href',
      ROUTES.RSS
    );
  });
});