mirror of
https://github.com/PostHog/posthog.git
synced 2024-12-01 12:21:02 +01:00
fded6fdf62
* test: Regular checkup of visual regression tests * Fix billing gauge animation Animations done in JS can't be stopped automatically by the Storybook test runner. CSS animations can, easily, and they are anyway the cleaner and more performant way of achieving the same here. * Rename misleading feature flag `recentInsights` to `relatedInsights` * Mock homepage endpoints to avoid error toasts * Wait for the recordings list in the notebook node story * Fix `featureFlagLogic` * Wait for `.NotebookNode__content` * Try to optimize * Screenshot failures and upload as artifacts * Fix remaining failures * Increase timeouts * Fix rendering of Survey stories * Remove `clang-format` * Update UI snapshots for `chromium` (2) * Update UI snapshots for `chromium` (2) * Update UI snapshots for `chromium` (2) * Fix alignment of series name in insights details * Try to fix experiment story flakiness * Include toasts in loaders * Fix superfluous toast * Fix un-awaited breakpoints * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (1) * Make login snapshots slightly stabler * Update UI snapshots for `chromium` (2) * Update UI snapshots for `chromium` (2) * Skip incorrect Surveys story * Update UI snapshots for `chromium` (2) * Revert msw upgrade --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
28 lines
1014 B
JavaScript
28 lines
1014 B
JavaScript
const { setupPage } = require('@storybook/test-runner')
|
|
const PlaywrightEnvironment = require('jest-playwright-preset/lib/PlaywrightEnvironment').default
|
|
|
|
class CustomEnvironment extends PlaywrightEnvironment {
|
|
async setup() {
|
|
await super.setup()
|
|
await setupPage(this.global.page, this.global.context)
|
|
}
|
|
|
|
async teardown() {
|
|
await super.teardown()
|
|
}
|
|
|
|
async handleTestEvent(event) {
|
|
if (event.name === 'test_done' && event.test.errors.length > 0) {
|
|
// Take screenshots on test failures - these become Actions artifacts
|
|
const parentName = event.test.parent.parent.name.replace(/\W/g, '-').toLowerCase()
|
|
const specName = event.test.parent.name.replace(/\W/g, '-').toLowerCase()
|
|
await this.global.page.screenshot({
|
|
path: `frontend/__snapshots__/__failures__/${parentName}--${specName}.png`,
|
|
})
|
|
}
|
|
await super.handleTestEvent(event)
|
|
}
|
|
}
|
|
|
|
module.exports = CustomEnvironment
|