From c9be1a53196a7717aa72439012d12be1c7ad239c Mon Sep 17 00:00:00 2001 From: Yisroel Baum Date: Sun, 3 May 2026 19:31:14 +0300 Subject: [PATCH] add admin home link e2e tests --- cypress/e2e/adminHomeLink.cy.js | 43 +++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 cypress/e2e/adminHomeLink.cy.js diff --git a/cypress/e2e/adminHomeLink.cy.js b/cypress/e2e/adminHomeLink.cy.js new file mode 100644 index 0000000..bc9cb28 --- /dev/null +++ b/cypress/e2e/adminHomeLink.cy.js @@ -0,0 +1,43 @@ +describe('The admin home link', () => { + beforeEach(() => { + cy.exec('npm run db:seed') + cy.loginAsAdmin() + }) + afterEach(() => { + cy.exec('npm run db:wipe') + }) + + it('shows the home link on the admin page', () => { + cy.visit('/admin') + cy.get('#home-link') + .should('be.visible') + .and('have.attr', 'href', '/home') + .and('contain', 'Home') + }) + + it('shows the home link on the admin texts page', () => { + cy.visit('/admin/texts') + cy.get('#home-link') + .should('be.visible') + .and('have.attr', 'href', '/home') + .and('contain', 'Home') + }) + + it('shows the home link on an admin text page', () => { + cy.visit('/admin/texts') + cy.get('#newTextName').type('Home Link Text') + cy.get('#submit').click() + cy.get('a').contains('Home Link Text').click() + cy.get('#home-link') + .should('be.visible') + .and('have.attr', 'href', '/home') + .and('contain', 'Home') + }) + + it('navigates to the home page when clicked', () => { + cy.visit('/admin') + cy.get('#home-link').click() + cy.url().should('include', '/home') + cy.get('h1').should('contain', 'Home') + }) +})