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') }) })