From d363306235f2a48f16e488f20f73e2233ddcf281 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Wed, 29 Nov 2023 18:07:20 +0100 Subject: refactor(pages): improve Homepage * move custom homepage components that does not require props to the MDX file (links should not need to be translated here but where they are defined) * move SEO title and meta desc to MDX file * make Page component the wrapper instead of using a React fragment * fix MDX module types --- tests/cypress/e2e/pages/homepage.cy.ts | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'tests/cypress') diff --git a/tests/cypress/e2e/pages/homepage.cy.ts b/tests/cypress/e2e/pages/homepage.cy.ts index 2d95767..29318be 100644 --- a/tests/cypress/e2e/pages/homepage.cy.ts +++ b/tests/cypress/e2e/pages/homepage.cy.ts @@ -1,9 +1,34 @@ import { CONFIG } from '../../../../src/utils/config'; +import { ROUTES } from '../../../../src/utils/constants'; describe('HomePage', () => { + beforeEach(() => { + cy.visit(ROUTES.HOME); + }); + it('successfully loads', () => { - cy.visit('/'); 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 + ); + }); }); -- cgit v1.2.3