koel/cypress/integration/authentication.spec.js
2019-04-21 23:43:19 +02:00

19 lines
No EOL
586 B
JavaScript

describe('authentication', () => {
it('requires login', () => {
cy.visit('/')
cy.get('[data-cy=loginForm]').should('be.visible')
})
it('logs in with valid username and password', () => {
cy.login()
cy.get('[data-cy=appHeader]').should('be.visible')
})
it('logs out', () => {
cy.login()
cy.route('DELETE', '/api/me', [])
cy.get('[data-cy=btnLogOut]').click({ force: true }) // https://github.com/cypress-io/cypress/issues/695
cy.get('[data-cy=loginForm]').should('be.visible')
cy.get('[data-cy=appHeader]').should('not.be.visible')
})
})