improvements and header spec
parent
b577a6bf2f
commit
95be0423df
@ -0,0 +1,26 @@
|
||||
import header from '../selectors/header.sel'
|
||||
|
||||
describe('Header', () => {
|
||||
it('contains correct elements when logged out', () => {
|
||||
// when visit is empty, it will visit baseUrl
|
||||
cy.visit('')
|
||||
cy.get(header.navbarLinks).should('be.visible')
|
||||
.and('have.length', 3)
|
||||
.and('contain', 'Home')
|
||||
.and('contain', 'Sign in')
|
||||
.and('contain', 'Sign up')
|
||||
})
|
||||
|
||||
it('contains correct elements when logged in', () => {
|
||||
cy.register().then((email) => {
|
||||
cy.login(email)
|
||||
})
|
||||
cy.visit('')
|
||||
cy.get(header.navbarLinks).should('be.visible')
|
||||
.and('have.length', 4)
|
||||
.and('contain', 'Home')
|
||||
.and('contain', 'New Article')
|
||||
.and('contain', 'Settings')
|
||||
.and('contain', 'cy')
|
||||
})
|
||||
})
|
@ -1,7 +1,7 @@
|
||||
import registration from '../selectors/register.sel'
|
||||
import header from '../selectors/header.sel'
|
||||
|
||||
describe('Register', () => {
|
||||
describe('Register - duplicate of register.spec', () => {
|
||||
beforeEach(() => {
|
||||
// we need random username and email each test
|
||||
const random = `cy${Math.random().toString().slice(2, 8)}`
|
@ -1,3 +1,4 @@
|
||||
module.exports = {
|
||||
settingsLink: '[ui-sref*=settings]'
|
||||
settingsLink: '[ui-sref*=settings]',
|
||||
navbarLinks: '.navbar ul > li:visible'
|
||||
}
|
||||
|
Loading…
Reference in New Issue