Fix home page tests
This commit is contained in:
parent
c094b5175a
commit
9b4efc773b
3 changed files with 37 additions and 0 deletions
35
cypress/integration/misc/home.spec.js
Normal file
35
cypress/integration/misc/home.spec.js
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
import '../../support/authenticateUser'
|
||||||
|
|
||||||
|
const setHours = hours => {
|
||||||
|
const date = new Date()
|
||||||
|
date.setHours(hours)
|
||||||
|
cy.clock(+date)
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Home Page', () => {
|
||||||
|
it('shows the right salutation in the night', () => {
|
||||||
|
setHours(4)
|
||||||
|
cy.visit('/')
|
||||||
|
cy.get('h2').should('contain', 'Good Night')
|
||||||
|
})
|
||||||
|
it('shows the right salutation in the morning', () => {
|
||||||
|
setHours(8)
|
||||||
|
cy.visit('/')
|
||||||
|
cy.get('h2').should('contain', 'Good Morning')
|
||||||
|
})
|
||||||
|
it('shows the right salutation in the day', () => {
|
||||||
|
setHours(13)
|
||||||
|
cy.visit('/')
|
||||||
|
cy.get('h2').should('contain', 'Hi')
|
||||||
|
})
|
||||||
|
it('shows the right salutation in the night', () => {
|
||||||
|
setHours(20)
|
||||||
|
cy.visit('/')
|
||||||
|
cy.get('h2').should('contain', 'Good Evening')
|
||||||
|
})
|
||||||
|
it('shows the right salutation in the night again', () => {
|
||||||
|
setHours(23)
|
||||||
|
cy.visit('/')
|
||||||
|
cy.get('h2').should('contain', 'Good Night')
|
||||||
|
})
|
||||||
|
})
|
|
@ -34,6 +34,7 @@ context('Login', () => {
|
||||||
cy.get('input[id=password]').type(fixture.password)
|
cy.get('input[id=password]').type(fixture.password)
|
||||||
cy.get('.button').contains('Login').click()
|
cy.get('.button').contains('Login').click()
|
||||||
cy.url().should('include', '/')
|
cy.url().should('include', '/')
|
||||||
|
cy.clock(1625656161057) // 13:00
|
||||||
cy.get('h2').should('contain', `Hi ${fixture.username}!`)
|
cy.get('h2').should('contain', `Hi ${fixture.username}!`)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ context('Registration', () => {
|
||||||
cy.get('#password2').type(fixture.password)
|
cy.get('#password2').type(fixture.password)
|
||||||
cy.get('#register-submit').click()
|
cy.get('#register-submit').click()
|
||||||
cy.url().should('include', '/')
|
cy.url().should('include', '/')
|
||||||
|
cy.clock(1625656161057) // 13:00
|
||||||
cy.get('h2').should('contain', `Hi ${fixture.username}!`)
|
cy.get('h2').should('contain', `Hi ${fixture.username}!`)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue