Goal-Calibration/cypress/e2e/adminHomeLink.cy.js

43 lines
1.3 KiB
JavaScript

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