From f349437f7ed3d110ec609ab0bf5c622b6a4dfdb8 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Fri, 27 May 2022 18:26:28 +0200 Subject: test(e2e): add back to top button visibility test --- tests/cypress/e2e/back-to-top.cy.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 tests/cypress/e2e/back-to-top.cy.ts (limited to 'tests') diff --git a/tests/cypress/e2e/back-to-top.cy.ts b/tests/cypress/e2e/back-to-top.cy.ts new file mode 100644 index 0000000..06ac3e6 --- /dev/null +++ b/tests/cypress/e2e/back-to-top.cy.ts @@ -0,0 +1,14 @@ +describe('Back to top', () => { + it('show a back to top button when scrolling', async () => { + cy.visit('/'); + cy.findByRole('link', { name: /Retour en haut de page/i }).should( + 'not.be.visible' + ); + + // See @components/templates/layout/layout.tsx for scroll position. + cy.scrollTo(0, 300); + cy.findByRole('link', { name: /Retour en haut de page/i }).should( + 'be.visible' + ); + }); +}); -- cgit v1.2.3