diff --git a/cypress/e2e/today.cy.js b/cypress/e2e/today.cy.js new file mode 100644 index 0000000..7332662 --- /dev/null +++ b/cypress/e2e/today.cy.js @@ -0,0 +1,32 @@ +describe('The today page', () => { + beforeEach(() => { + cy.exec('npm run db:seed') + }) + + afterEach(() => { + cy.exec('npm run db:wipe') + }) + + it('redirects to login when not authenticated', () => { + cy.visit('/today') + cy.url().should('include', '/login') + }) + + it('displays a Today heading when authenticated', () => { + cy.loginAsUser() + cy.visit('/today') + cy.get('h1').should('contain', 'Today') + }) + + it('has a list element for scheduled nodes', () => { + cy.loginAsUser() + cy.visit('/today') + cy.get('#scheduled-nodes-list').should('exist') + }) + + it('home page links to the today page', () => { + cy.loginAsUser() + cy.visit('/home') + cy.get('a[href="/today"]').should('be.visible') + }) +})