diff --git a/cypress/integration/misc/home.spec.js b/cypress/integration/misc/home.spec.js new file mode 100644 index 000000000..82cbeed22 --- /dev/null +++ b/cypress/integration/misc/home.spec.js @@ -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') + }) +}) \ No newline at end of file diff --git a/cypress/integration/user/login.spec.js b/cypress/integration/user/login.spec.js index d1cde64ef..ce6086ce0 100644 --- a/cypress/integration/user/login.spec.js +++ b/cypress/integration/user/login.spec.js @@ -34,6 +34,7 @@ context('Login', () => { cy.get('input[id=password]').type(fixture.password) cy.get('.button').contains('Login').click() cy.url().should('include', '/') + cy.clock(1625656161057) // 13:00 cy.get('h2').should('contain', `Hi ${fixture.username}!`) }) diff --git a/cypress/integration/user/registration.spec.js b/cypress/integration/user/registration.spec.js index 37c238e34..3e7cf1f54 100644 --- a/cypress/integration/user/registration.spec.js +++ b/cypress/integration/user/registration.spec.js @@ -28,6 +28,7 @@ context('Registration', () => { cy.get('#password2').type(fixture.password) cy.get('#register-submit').click() cy.url().should('include', '/') + cy.clock(1625656161057) // 13:00 cy.get('h2').should('contain', `Hi ${fixture.username}!`) })