add cypress tests for admin text summary page

This commit is contained in:
Yisroel Baum 2026-04-12 21:50:54 +03:00
parent bb3397b751
commit 688373f46d
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9

View file

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