2021-02-09 16:28:01 +01:00
|
|
|
import '@cypress/react/support'
|
|
|
|
import 'givens/setup'
|
2020-05-19 20:48:10 +02:00
|
|
|
import './commands'
|
|
|
|
|
2021-02-09 16:28:01 +01:00
|
|
|
import { unmount } from '@cypress/react'
|
|
|
|
|
|
|
|
try {
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
|
|
require('cypress-terminal-report/src/installLogsCollector')()
|
|
|
|
} catch {}
|
2020-08-11 10:52:43 +02:00
|
|
|
|
2020-05-19 20:48:10 +02:00
|
|
|
beforeEach(() => {
|
2021-02-09 16:28:01 +01:00
|
|
|
if (Cypress.spec.specType === 'component') {
|
|
|
|
// Freeze time to 2021.01.05 Noon UTC - this should be the same date regardless of timezone.
|
|
|
|
cy.clock(1578225600000, ['Date'])
|
|
|
|
} else {
|
|
|
|
cy.visit('/')
|
|
|
|
|
|
|
|
cy.url().then((url) => {
|
|
|
|
if (url.includes('login')) {
|
|
|
|
logIn()
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
2020-05-19 20:48:10 +02:00
|
|
|
|
2021-02-09 16:28:01 +01:00
|
|
|
afterEach(() => {
|
|
|
|
if (Cypress.spec.specType === 'component') {
|
|
|
|
unmount()
|
|
|
|
}
|
2020-05-19 20:48:10 +02:00
|
|
|
})
|
|
|
|
|
2020-09-07 16:23:13 +02:00
|
|
|
const logIn = () => {
|
2020-12-02 14:12:43 +01:00
|
|
|
cy.get('#inputEmail').type('test@posthog.com').should('have.value', 'test@posthog.com')
|
2020-09-07 16:23:13 +02:00
|
|
|
|
2021-02-04 10:53:00 +01:00
|
|
|
cy.get('#inputPassword').type('12345678').should('have.value', '12345678')
|
2020-09-07 16:23:13 +02:00
|
|
|
|
|
|
|
cy.get('.btn').click()
|
|
|
|
}
|
|
|
|
|
2020-06-08 20:34:39 +02:00
|
|
|
Cypress.on('uncaught:exception', () => {
|
2020-05-19 20:48:10 +02:00
|
|
|
return false
|
|
|
|
})
|