mirror of
https://github.com/PostHog/posthog.git
synced 2024-11-25 02:49:32 +01:00
30b6692920
* WIP: get cypress something doing * Get a test running * Get css loading, stub posthog * Move helpers to separate file * Givens > given2 It plays nicer with beforeEach * Test for session filters * Test date navigation * Test filtering * Try keep old tests running * Try get tests running under CI * Prettify fixtures * Cleanup, use cypress 6 * Add yarn build * Fix e2e cypress tests * given2 => givens * Rename `frontend-test-runner` to `e2e-test-runner` * Fix cypress test * Add webpack-preprocessor as a devDependency * Improve freezing time * Make css inclusions automatic for component tests
44 lines
1.0 KiB
JavaScript
44 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 {
|
|
cy.visit('/')
|
|
|
|
cy.url().then((url) => {
|
|
if (url.includes('login')) {
|
|
logIn()
|
|
}
|
|
})
|
|
}
|
|
})
|
|
|
|
afterEach(() => {
|
|
if (Cypress.spec.specType === 'component') {
|
|
unmount()
|
|
}
|
|
})
|
|
|
|
const logIn = () => {
|
|
cy.get('#inputEmail').type('test@posthog.com').should('have.value', 'test@posthog.com')
|
|
|
|
cy.get('#inputPassword').type('12345678').should('have.value', '12345678')
|
|
|
|
cy.get('.btn').click()
|
|
}
|
|
|
|
Cypress.on('uncaught:exception', () => {
|
|
return false
|
|
})
|