From 688373f46dc0a07b34b83b0a748b81e9610fdf77 Mon Sep 17 00:00:00 2001 From: Yisroel Baum Date: Sun, 12 Apr 2026 21:50:54 +0300 Subject: [PATCH] add cypress tests for admin text summary page --- cypress/e2e/admin.cy.js | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/cypress/e2e/admin.cy.js b/cypress/e2e/admin.cy.js index c277eb9..c06aece 100644 --- a/cypress/e2e/admin.cy.js +++ b/cypress/e2e/admin.cy.js @@ -1,7 +1,24 @@ describe('The admin page', () => { - it('successfully loads texts', () => { - cy.visit('/admin') - cy.get('#newTextname').type('new text') - cy.get('#submit').click() + beforeEach(() => { + cy.visit('/admin') + }) + + it('navigates to texts page', () => { + cy.get('#texts').click() + cy.url().should('include', '/admin/texts') + }) + + it('shows texts page with heading and form', () => { + cy.visit('/admin/texts') + cy.get('h1').should('contain', 'Texts') + cy.get('#newTextName').should('exist') + cy.get('#submit').should('exist') + }) + + it('creates a new text', () => { + cy.visit('/admin/texts') + cy.get('#newTextName').type('Test Text') + cy.get('#submit').click() + cy.contains('Test Text') }) })