From c9be1a53196a7717aa72439012d12be1c7ad239c Mon Sep 17 00:00:00 2001 From: Yisroel Baum Date: Sun, 3 May 2026 19:31:14 +0300 Subject: [PATCH 1/2] 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') + }) +}) From d5864ad526b8d4710ab0021ddb3a5e4b0099c861 Mon Sep 17 00:00:00 2001 From: Yisroel Baum Date: Sun, 3 May 2026 19:33:47 +0300 Subject: [PATCH 2/2] add home link to admin navbar --- views/templates/admin.php | 3 +++ views/templates/text.php | 3 +++ views/templates/texts.php | 3 +++ 3 files changed, 9 insertions(+) diff --git a/views/templates/admin.php b/views/templates/admin.php index d69f685..9356654 100644 --- a/views/templates/admin.php +++ b/views/templates/admin.php @@ -11,6 +11,9 @@

Admin

+ + Home +
diff --git a/views/templates/text.php b/views/templates/text.php index 6c62559..d599ced 100644 --- a/views/templates/text.php +++ b/views/templates/text.php @@ -10,6 +10,9 @@