mirror of
https://github.com/PostHog/posthog.git
synced 2024-11-28 00:46:45 +01:00
f512028bff
Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
42 lines
1.0 KiB
JavaScript
42 lines
1.0 KiB
JavaScript
import '@cypress/react/support'
|
|
import 'givens/setup'
|
|
import './commands'
|
|
|
|
import { unmount } from '@cypress/react'
|
|
|
|
try {
|
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
require('cypress-terminal-report/src/installLogsCollector')()
|
|
} catch {}
|
|
|
|
beforeEach(() => {
|
|
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 {
|
|
if (Cypress.spec.name.includes('Premium')) {
|
|
cy.visit('/login')
|
|
cy.intercept('/api/users/@me/', { fixture: 'api/user-enterprise' })
|
|
cy.login()
|
|
} else {
|
|
cy.visit('/')
|
|
|
|
cy.url().then((url) => {
|
|
if (url.includes('login')) {
|
|
cy.login()
|
|
}
|
|
})
|
|
}
|
|
}
|
|
})
|
|
|
|
afterEach(() => {
|
|
if (Cypress.spec.specType === 'component') {
|
|
unmount()
|
|
}
|
|
})
|
|
|
|
Cypress.on('uncaught:exception', () => {
|
|
return false
|
|
})
|