28 lines
685 B
JavaScript
28 lines
685 B
JavaScript
describe('The admin page', () => {
|
|
beforeEach(() => {
|
|
cy.exec('npm run db:seed')
|
|
cy.visit('/admin')
|
|
})
|
|
afterEach(() => {
|
|
cy.exec('npm run db:wipe')
|
|
})
|
|
|
|
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')
|
|
})
|
|
})
|