diff --git a/.storybook/decorators/withSnapshotsDisabled.tsx b/.storybook/decorators/withSnapshotsDisabled.tsx index 9d353aee82a..54260102840 100644 --- a/.storybook/decorators/withSnapshotsDisabled.tsx +++ b/.storybook/decorators/withSnapshotsDisabled.tsx @@ -3,7 +3,7 @@ import { DecoratorFn } from '@storybook/react' /** Workaround for https://github.com/storybookjs/test-runner/issues/74 */ // TODO: Smoke-test all the stories by removing this decorator, once all the stories pass export const withSnapshotsDisabled: DecoratorFn = (Story, { parameters }) => { - if (parameters?.chromatic?.disableSnapshot && navigator.userAgent.includes('StorybookTestRunner')) { + if (parameters?.testOptions?.skip && navigator.userAgent.includes('StorybookTestRunner')) { return <>Disabled for Test Runner } return diff --git a/.storybook/main.js b/.storybook/main.ts similarity index 65% rename from .storybook/main.js rename to .storybook/main.ts index 9d616f2f2aa..903ce97b50a 100644 --- a/.storybook/main.js +++ b/.storybook/main.ts @@ -1,7 +1,7 @@ -const { createEntry } = require('../webpack.config') -const babelConfig = require('../babel.config') +import type { StorybookConfig } from '@storybook/react/types' +import { createEntry } from '../webpack.config' -module.exports = { +const config: StorybookConfig = { stories: ['../frontend/src/**/*.stories.@(js|jsx|ts|tsx|mdx)'], addons: [ { @@ -19,28 +19,20 @@ module.exports = { 'storybook-addon-pseudo-states', ], staticDirs: ['public'], - babel: async () => { - // compile babel to "defaults" target (ES5) - const envPreset = babelConfig.presets.find( - (preset) => Array.isArray(preset) && preset[0] === '@babel/preset-env' - ) - envPreset[1].targets = 'defaults' - return babelConfig - }, webpackFinal: (config) => { const mainConfig = createEntry('main') return { ...config, resolve: { ...config.resolve, - extensions: [...config.resolve.extensions, ...mainConfig.resolve.extensions], - alias: { ...config.resolve.alias, ...mainConfig.resolve.alias }, + extensions: [...config.resolve!.extensions!, ...mainConfig.resolve.extensions], + alias: { ...config.resolve!.alias, ...mainConfig.resolve.alias }, }, module: { ...config.module, rules: [ ...mainConfig.module.rules, - ...config.module.rules.filter((rule) => rule.test.toString().includes('.mdx')), + ...config.module!.rules.filter((rule) => rule.test!.toString().includes('.mdx')), { test: /\.stories\.tsx?$/, use: [ @@ -59,3 +51,5 @@ module.exports = { postcss: false, }, } + +export default config diff --git a/.storybook/preview.tsx b/.storybook/preview.tsx index 15ea841edd2..ab034bbb3f1 100644 --- a/.storybook/preview.tsx +++ b/.storybook/preview.tsx @@ -1,6 +1,6 @@ import '~/styles' import './storybook.scss' -import type { Meta } from '@storybook/react' +import type { Meta, Parameters } from '@storybook/react' import { worker } from '~/mocks/browser' import { loadPostHogJS } from '~/loadPostHogJS' import { getStorybookAppContext } from './app-context' @@ -29,7 +29,7 @@ const setupPosthogJs = () => { setupPosthogJs() /** Storybook global parameters. See https://storybook.js.org/docs/react/writing-stories/parameters#global-parameters */ -export const parameters = { +export const parameters: Parameters = { actions: { argTypesRegex: '^on[A-Z].*', disabled: true }, controls: { matchers: { @@ -51,7 +51,6 @@ export const parameters = { 'Filters', 'Layout', ], - includeName: true, }, }, viewMode: 'docs', diff --git a/.storybook/test-runner.ts b/.storybook/test-runner.ts index db850cd2f9e..c78ed93dc80 100644 --- a/.storybook/test-runner.ts +++ b/.storybook/test-runner.ts @@ -1,8 +1,35 @@ import { toMatchImageSnapshot } from 'jest-image-snapshot' +import { OptionsParameter } from '@storybook/addons' import { getStoryContext, TestRunnerConfig, TestContext } from '@storybook/test-runner' -import { Locator, Page, LocatorScreenshotOptions } from 'playwright-core' +import type { Locator, Page, LocatorScreenshotOptions } from 'playwright-core' +import type { Mocks } from '~/mocks/utils' + +// Extend Storybook interface `Parameters` with Chromatic parameters +declare module '@storybook/react' { + interface Parameters { + options?: OptionsParameter + layout?: 'padded' | 'fullscreen' | 'centered' + testOptions?: { + /** Whether the test should be a no-op (doesn't jest.skip as @storybook/test-runner doesn't allow that). **/ + skip?: boolean + /** + * Whether navigation (sidebar + topbar) should be excluded from the snapshot. + * Warning: Fails if enabled for stories in which navigation is not present. + */ + excludeNavigationFromSnapshot?: boolean + } + mockDate?: string | number | Date + msw?: { + mocks?: Mocks + } + [name: string]: any + } +} + +const RETRY_TIMES = 3 const customSnapshotsDir = `${process.cwd()}/frontend/__snapshots__` +const updateSnapshot = expect.getState().snapshotState._updateSnapshot === 'all' async function expectStoryToMatchFullPageSnapshot(page: Page, context: TestContext): Promise { await expectLocatorToMatchStorySnapshot(page, context) @@ -15,13 +42,11 @@ async function expectStoryToMatchSceneSnapshot(page: Page, context: TestContext) async function expectStoryToMatchComponentSnapshot(page: Page, context: TestContext): Promise { await page.evaluate(() => { const rootEl = document.getElementById('root') - if (rootEl) { // don't expand the container element to limit the screenshot // to the component's size rootEl.style.display = 'inline-block' } - // make the body transparent to take the screenshot // without background document.body.style.background = 'transparent' @@ -35,7 +60,7 @@ async function expectLocatorToMatchStorySnapshot( context: TestContext, options?: LocatorScreenshotOptions ): Promise { - const image = await locator.screenshot(options) + const image = await locator.screenshot({ timeout: 3000, ...options }) expect(image).toMatchImageSnapshot({ customSnapshotsDir, customSnapshotIdentifier: context.id, @@ -45,7 +70,7 @@ async function expectLocatorToMatchStorySnapshot( module.exports = { setup() { expect.extend({ toMatchImageSnapshot }) - jest.retryTimes(3, { logErrorsBeforeRetry: true }) + jest.retryTimes(RETRY_TIMES, { logErrorsBeforeRetry: true }) }, async postRender(page, context) { const storyContext = await getStoryContext(page, context) @@ -55,13 +80,13 @@ module.exports = { document.body.classList.add('dangerously-stop-all-animations') }) - if (!storyContext.parameters?.chromatic?.disableSnapshot) { + if (!storyContext.parameters?.testOptions?.skip) { let expectStoryToMatchSnapshot: (page: Page, context: TestContext) => Promise if (storyContext.parameters?.layout === 'fullscreen') { - if (storyContext.parameters.testRunner?.includeNavigation) { - expectStoryToMatchSnapshot = expectStoryToMatchFullPageSnapshot - } else { + if (storyContext.parameters.testOptions?.excludeNavigationFromSnapshot) { expectStoryToMatchSnapshot = expectStoryToMatchSceneSnapshot + } else { + expectStoryToMatchSnapshot = expectStoryToMatchFullPageSnapshot } } else { expectStoryToMatchSnapshot = expectStoryToMatchComponentSnapshot @@ -70,7 +95,9 @@ module.exports = { // You'd expect that the 'load' state which @storybook/test-runner waits for would already mean // the story is ready, and definitely that 'networkidle' would indicate all assets to be ready. // But that's not the case, so we need to introduce a bit of a delay. - await page.waitForTimeout(200) + // The delay is extended when updating snapshots, so that we're 100% sure they represent the final state. + const delayMultiplier: number = updateSnapshot ? RETRY_TIMES : 1 + await page.waitForTimeout(250 * delayMultiplier) await expectStoryToMatchSnapshot(page, context) // Don't retry when updating } }, diff --git a/Dockerfile.playwright b/Dockerfile.playwright index e7e895ec475..00bd7b0b853 100644 --- a/Dockerfile.playwright +++ b/Dockerfile.playwright @@ -18,5 +18,3 @@ RUN pnpm install COPY playwright.config.ts webpack.config.js babel.config.js tsconfig.json ./ COPY .storybook/ .storybook/ - -COPY frontend/ frontend/ diff --git a/babel.config.js b/babel.config.js index 6fd9be01fea..33e6a139458 100644 --- a/babel.config.js +++ b/babel.config.js @@ -12,6 +12,7 @@ module.exports = { { useBuiltIns: 'usage', corejs: 3, + targets: 'defaults', // browserlist's defaults - https://github.com/browserslist/browserslist#full-list }, ], [ diff --git a/docker-compose.playwright.yml b/docker-compose.playwright.yml index c51df2d22ed..729f3e7a212 100644 --- a/docker-compose.playwright.yml +++ b/docker-compose.playwright.yml @@ -5,7 +5,9 @@ services: dockerfile: Dockerfile.playwright network_mode: host volumes: - - './frontend/__snapshots__:/work/frontend/__snapshots__' + # Mount the whole frontend/ directory to avoid to a new Docker image being generated each time + # frontend code changes. Also, this allows frontend/__snapshots__/ to be updated. + - './frontend:/work/frontend' - './playwright:/work/playwright' - './playwright-report:/work/playwright-report' - './test-results:/work/test-results' diff --git a/frontend/__snapshots__/components-insighttooltip--columns.png b/frontend/__snapshots__/components-insighttooltip--columns.png new file mode 100644 index 00000000000..0f78cbfe3e1 Binary files /dev/null and b/frontend/__snapshots__/components-insighttooltip--columns.png differ diff --git a/frontend/__snapshots__/components-insighttooltip--default.png b/frontend/__snapshots__/components-insighttooltip--default.png new file mode 100644 index 00000000000..9f51296d301 Binary files /dev/null and b/frontend/__snapshots__/components-insighttooltip--default.png differ diff --git a/frontend/__snapshots__/components-integrations-slack--slack-integration-added.png b/frontend/__snapshots__/components-integrations-slack--slack-integration-added.png new file mode 100644 index 00000000000..d55b52a4400 Binary files /dev/null and b/frontend/__snapshots__/components-integrations-slack--slack-integration-added.png differ diff --git a/frontend/__snapshots__/components-integrations-slack--slack-integration-instance-not-configured.png b/frontend/__snapshots__/components-integrations-slack--slack-integration-instance-not-configured.png new file mode 100644 index 00000000000..78d798488bf Binary files /dev/null and b/frontend/__snapshots__/components-integrations-slack--slack-integration-instance-not-configured.png differ diff --git a/frontend/__snapshots__/components-integrations-slack--slack-integration.png b/frontend/__snapshots__/components-integrations-slack--slack-integration.png new file mode 100644 index 00000000000..78d798488bf Binary files /dev/null and b/frontend/__snapshots__/components-integrations-slack--slack-integration.png differ diff --git a/frontend/__snapshots__/components-sharing--dashboard-sharing-licensed.png b/frontend/__snapshots__/components-sharing--dashboard-sharing-licensed.png new file mode 100644 index 00000000000..1d4fee758d6 Binary files /dev/null and b/frontend/__snapshots__/components-sharing--dashboard-sharing-licensed.png differ diff --git a/frontend/__snapshots__/components-sharing--dashboard-sharing.png b/frontend/__snapshots__/components-sharing--dashboard-sharing.png new file mode 100644 index 00000000000..9dc07f3221a Binary files /dev/null and b/frontend/__snapshots__/components-sharing--dashboard-sharing.png differ diff --git a/frontend/__snapshots__/components-sharing--insight-sharing-licensed.png b/frontend/__snapshots__/components-sharing--insight-sharing-licensed.png new file mode 100644 index 00000000000..2fa9335eef5 Binary files /dev/null and b/frontend/__snapshots__/components-sharing--insight-sharing-licensed.png differ diff --git a/frontend/__snapshots__/components-sharing--insight-sharing.png b/frontend/__snapshots__/components-sharing--insight-sharing.png new file mode 100644 index 00000000000..2fa9335eef5 Binary files /dev/null and b/frontend/__snapshots__/components-sharing--insight-sharing.png differ diff --git a/frontend/__snapshots__/components-subscriptions--subscription-no-integrations.png b/frontend/__snapshots__/components-subscriptions--subscription-no-integrations.png new file mode 100644 index 00000000000..75c640f286c Binary files /dev/null and b/frontend/__snapshots__/components-subscriptions--subscription-no-integrations.png differ diff --git a/frontend/__snapshots__/components-subscriptions--subscriptions-edit.png b/frontend/__snapshots__/components-subscriptions--subscriptions-edit.png new file mode 100644 index 00000000000..89000783959 Binary files /dev/null and b/frontend/__snapshots__/components-subscriptions--subscriptions-edit.png differ diff --git a/frontend/__snapshots__/components-subscriptions--subscriptions-empty.png b/frontend/__snapshots__/components-subscriptions--subscriptions-empty.png new file mode 100644 index 00000000000..c158ccefb2a Binary files /dev/null and b/frontend/__snapshots__/components-subscriptions--subscriptions-empty.png differ diff --git a/frontend/__snapshots__/components-subscriptions--subscriptions-new.png b/frontend/__snapshots__/components-subscriptions--subscriptions-new.png new file mode 100644 index 00000000000..75c640f286c Binary files /dev/null and b/frontend/__snapshots__/components-subscriptions--subscriptions-new.png differ diff --git a/frontend/__snapshots__/components-subscriptions--subscriptions-unavailable.png b/frontend/__snapshots__/components-subscriptions--subscriptions-unavailable.png new file mode 100644 index 00000000000..72074e28e9e Binary files /dev/null and b/frontend/__snapshots__/components-subscriptions--subscriptions-unavailable.png differ diff --git a/frontend/__snapshots__/components-subscriptions--subscriptions.png b/frontend/__snapshots__/components-subscriptions--subscriptions.png new file mode 100644 index 00000000000..99a30e59330 Binary files /dev/null and b/frontend/__snapshots__/components-subscriptions--subscriptions.png differ diff --git a/frontend/__snapshots__/filters-propertyfilters--comparing-property-filters.png b/frontend/__snapshots__/filters-propertyfilters--comparing-property-filters.png new file mode 100644 index 00000000000..620ccd6fb77 Binary files /dev/null and b/frontend/__snapshots__/filters-propertyfilters--comparing-property-filters.png differ diff --git a/frontend/__snapshots__/filters-propertyfilters--with-no-close-button.png b/frontend/__snapshots__/filters-propertyfilters--with-no-close-button.png new file mode 100644 index 00000000000..9bee5ffe3e2 Binary files /dev/null and b/frontend/__snapshots__/filters-propertyfilters--with-no-close-button.png differ diff --git a/frontend/__snapshots__/filters-propertygroupfilters--empty-group-property-filters.png b/frontend/__snapshots__/filters-propertygroupfilters--empty-group-property-filters.png new file mode 100644 index 00000000000..15a52858e1f Binary files /dev/null and b/frontend/__snapshots__/filters-propertygroupfilters--empty-group-property-filters.png differ diff --git a/frontend/__snapshots__/filters-propertygroupfilters--group-property-filters.png b/frontend/__snapshots__/filters-propertygroupfilters--group-property-filters.png new file mode 100644 index 00000000000..bbec104c605 Binary files /dev/null and b/frontend/__snapshots__/filters-propertygroupfilters--group-property-filters.png differ diff --git a/frontend/__snapshots__/layout-navigation--app-page-with-side-bar-hidden.png b/frontend/__snapshots__/layout-navigation--app-page-with-side-bar-hidden.png index bfd3bffd055..a9b252de7c2 100644 Binary files a/frontend/__snapshots__/layout-navigation--app-page-with-side-bar-hidden.png and b/frontend/__snapshots__/layout-navigation--app-page-with-side-bar-hidden.png differ diff --git a/frontend/__snapshots__/layout-navigation--app-page-with-side-bar-shown.png b/frontend/__snapshots__/layout-navigation--app-page-with-side-bar-shown.png index 901758fd10e..b592df9a1b1 100644 Binary files a/frontend/__snapshots__/layout-navigation--app-page-with-side-bar-shown.png and b/frontend/__snapshots__/layout-navigation--app-page-with-side-bar-shown.png differ diff --git a/frontend/__snapshots__/scenes-app-insights--funnel-historical-trends.png b/frontend/__snapshots__/scenes-app-insights--funnel-historical-trends.png new file mode 100644 index 00000000000..841796c6446 Binary files /dev/null and b/frontend/__snapshots__/scenes-app-insights--funnel-historical-trends.png differ diff --git a/frontend/__snapshots__/scenes-app-insights--funnel-left-to-right-breakdown.png b/frontend/__snapshots__/scenes-app-insights--funnel-left-to-right-breakdown.png new file mode 100644 index 00000000000..b7c861780e8 Binary files /dev/null and b/frontend/__snapshots__/scenes-app-insights--funnel-left-to-right-breakdown.png differ diff --git a/frontend/__snapshots__/scenes-app-insights--funnel-left-to-right.png b/frontend/__snapshots__/scenes-app-insights--funnel-left-to-right.png new file mode 100644 index 00000000000..094f971517c Binary files /dev/null and b/frontend/__snapshots__/scenes-app-insights--funnel-left-to-right.png differ diff --git a/frontend/__snapshots__/scenes-app-insights--funnel-time-to-convert.png b/frontend/__snapshots__/scenes-app-insights--funnel-time-to-convert.png new file mode 100644 index 00000000000..7552cea6a5c Binary files /dev/null and b/frontend/__snapshots__/scenes-app-insights--funnel-time-to-convert.png differ diff --git a/frontend/__snapshots__/scenes-app-insights--funnel-top-to-bottom-breakdown.png b/frontend/__snapshots__/scenes-app-insights--funnel-top-to-bottom-breakdown.png new file mode 100644 index 00000000000..95149461cf3 Binary files /dev/null and b/frontend/__snapshots__/scenes-app-insights--funnel-top-to-bottom-breakdown.png differ diff --git a/frontend/__snapshots__/scenes-app-insights--funnel-top-to-bottom.png b/frontend/__snapshots__/scenes-app-insights--funnel-top-to-bottom.png new file mode 100644 index 00000000000..b05a6cee6fa Binary files /dev/null and b/frontend/__snapshots__/scenes-app-insights--funnel-top-to-bottom.png differ diff --git a/frontend/__snapshots__/scenes-app-insights--lifecycle.png b/frontend/__snapshots__/scenes-app-insights--lifecycle.png new file mode 100644 index 00000000000..c40566a445b Binary files /dev/null and b/frontend/__snapshots__/scenes-app-insights--lifecycle.png differ diff --git a/frontend/__snapshots__/scenes-app-insights--retention-breakdown.png b/frontend/__snapshots__/scenes-app-insights--retention-breakdown.png new file mode 100644 index 00000000000..17303b9c8c4 Binary files /dev/null and b/frontend/__snapshots__/scenes-app-insights--retention-breakdown.png differ diff --git a/frontend/__snapshots__/scenes-app-insights--retention.png b/frontend/__snapshots__/scenes-app-insights--retention.png new file mode 100644 index 00000000000..7ed8fc24c34 Binary files /dev/null and b/frontend/__snapshots__/scenes-app-insights--retention.png differ diff --git a/frontend/__snapshots__/scenes-app-insights--stickiness.png b/frontend/__snapshots__/scenes-app-insights--stickiness.png new file mode 100644 index 00000000000..b090cd9c4c0 Binary files /dev/null and b/frontend/__snapshots__/scenes-app-insights--stickiness.png differ diff --git a/frontend/__snapshots__/scenes-app-insights--trends-area-breakdown.png b/frontend/__snapshots__/scenes-app-insights--trends-area-breakdown.png new file mode 100644 index 00000000000..3a4cf778a61 Binary files /dev/null and b/frontend/__snapshots__/scenes-app-insights--trends-area-breakdown.png differ diff --git a/frontend/__snapshots__/scenes-app-insights--trends-area.png b/frontend/__snapshots__/scenes-app-insights--trends-area.png new file mode 100644 index 00000000000..f58a7af128b Binary files /dev/null and b/frontend/__snapshots__/scenes-app-insights--trends-area.png differ diff --git a/frontend/__snapshots__/scenes-app-insights--trends-bar-breakdown.png b/frontend/__snapshots__/scenes-app-insights--trends-bar-breakdown.png new file mode 100644 index 00000000000..6484078f7bd Binary files /dev/null and b/frontend/__snapshots__/scenes-app-insights--trends-bar-breakdown.png differ diff --git a/frontend/__snapshots__/scenes-app-insights--trends-bar.png b/frontend/__snapshots__/scenes-app-insights--trends-bar.png new file mode 100644 index 00000000000..ed5fcfac80e Binary files /dev/null and b/frontend/__snapshots__/scenes-app-insights--trends-bar.png differ diff --git a/frontend/__snapshots__/scenes-app-insights--trends-line-breakdown.png b/frontend/__snapshots__/scenes-app-insights--trends-line-breakdown.png new file mode 100644 index 00000000000..7c6bd1b5647 Binary files /dev/null and b/frontend/__snapshots__/scenes-app-insights--trends-line-breakdown.png differ diff --git a/frontend/__snapshots__/scenes-app-insights--trends-line.png b/frontend/__snapshots__/scenes-app-insights--trends-line.png new file mode 100644 index 00000000000..e6f15a052f2 Binary files /dev/null and b/frontend/__snapshots__/scenes-app-insights--trends-line.png differ diff --git a/frontend/__snapshots__/scenes-app-insights--trends-number.png b/frontend/__snapshots__/scenes-app-insights--trends-number.png new file mode 100644 index 00000000000..e1a05fd69f6 Binary files /dev/null and b/frontend/__snapshots__/scenes-app-insights--trends-number.png differ diff --git a/frontend/__snapshots__/scenes-app-insights--trends-pie-breakdown.png b/frontend/__snapshots__/scenes-app-insights--trends-pie-breakdown.png new file mode 100644 index 00000000000..5cafbbc38ba Binary files /dev/null and b/frontend/__snapshots__/scenes-app-insights--trends-pie-breakdown.png differ diff --git a/frontend/__snapshots__/scenes-app-insights--trends-pie.png b/frontend/__snapshots__/scenes-app-insights--trends-pie.png new file mode 100644 index 00000000000..f9687e6b26e Binary files /dev/null and b/frontend/__snapshots__/scenes-app-insights--trends-pie.png differ diff --git a/frontend/__snapshots__/scenes-app-insights--trends-table-breakdown.png b/frontend/__snapshots__/scenes-app-insights--trends-table-breakdown.png new file mode 100644 index 00000000000..fdc78bc833e Binary files /dev/null and b/frontend/__snapshots__/scenes-app-insights--trends-table-breakdown.png differ diff --git a/frontend/__snapshots__/scenes-app-insights--trends-table.png b/frontend/__snapshots__/scenes-app-insights--trends-table.png new file mode 100644 index 00000000000..58520e3b9e5 Binary files /dev/null and b/frontend/__snapshots__/scenes-app-insights--trends-table.png differ diff --git a/frontend/__snapshots__/scenes-app-insights--trends-value-breakdown.png b/frontend/__snapshots__/scenes-app-insights--trends-value-breakdown.png new file mode 100644 index 00000000000..d06dae8a55b Binary files /dev/null and b/frontend/__snapshots__/scenes-app-insights--trends-value-breakdown.png differ diff --git a/frontend/__snapshots__/scenes-app-insights--trends-value.png b/frontend/__snapshots__/scenes-app-insights--trends-value.png new file mode 100644 index 00000000000..7a9e164658d Binary files /dev/null and b/frontend/__snapshots__/scenes-app-insights--trends-value.png differ diff --git a/frontend/__snapshots__/scenes-app-insights--trends-world-map.png b/frontend/__snapshots__/scenes-app-insights--trends-world-map.png new file mode 100644 index 00000000000..8cfc8702f03 Binary files /dev/null and b/frontend/__snapshots__/scenes-app-insights--trends-world-map.png differ diff --git a/frontend/__snapshots__/scenes-app-insights--user-paths.png b/frontend/__snapshots__/scenes-app-insights--user-paths.png new file mode 100644 index 00000000000..a1a57da5337 Binary files /dev/null and b/frontend/__snapshots__/scenes-app-insights--user-paths.png differ diff --git a/frontend/__snapshots__/scenes-app-insights-error-states--empty-state.png b/frontend/__snapshots__/scenes-app-insights-error-states--empty-state.png new file mode 100644 index 00000000000..e865b014325 Binary files /dev/null and b/frontend/__snapshots__/scenes-app-insights-error-states--empty-state.png differ diff --git a/frontend/__snapshots__/scenes-app-insights-error-states--error-state.png b/frontend/__snapshots__/scenes-app-insights-error-states--error-state.png new file mode 100644 index 00000000000..9f8766bc126 Binary files /dev/null and b/frontend/__snapshots__/scenes-app-insights-error-states--error-state.png differ diff --git a/frontend/__snapshots__/scenes-app-insights-error-states--funnel-single-step.png b/frontend/__snapshots__/scenes-app-insights-error-states--funnel-single-step.png new file mode 100644 index 00000000000..b8782afbb8e Binary files /dev/null and b/frontend/__snapshots__/scenes-app-insights-error-states--funnel-single-step.png differ diff --git a/frontend/__snapshots__/scenes-app-insights-error-states--timeout-state.png b/frontend/__snapshots__/scenes-app-insights-error-states--timeout-state.png new file mode 100644 index 00000000000..b5784710f6e Binary files /dev/null and b/frontend/__snapshots__/scenes-app-insights-error-states--timeout-state.png differ diff --git a/frontend/__snapshots__/scenes-app-saved-insights--card-view.png b/frontend/__snapshots__/scenes-app-saved-insights--card-view.png new file mode 100644 index 00000000000..d6dc836cf82 Binary files /dev/null and b/frontend/__snapshots__/scenes-app-saved-insights--card-view.png differ diff --git a/frontend/__snapshots__/scenes-app-saved-insights--empty-state.png b/frontend/__snapshots__/scenes-app-saved-insights--empty-state.png new file mode 100644 index 00000000000..252a4448dd3 Binary files /dev/null and b/frontend/__snapshots__/scenes-app-saved-insights--empty-state.png differ diff --git a/frontend/__snapshots__/scenes-app-saved-insights--list-view.png b/frontend/__snapshots__/scenes-app-saved-insights--list-view.png new file mode 100644 index 00000000000..d1eb801d11d Binary files /dev/null and b/frontend/__snapshots__/scenes-app-saved-insights--list-view.png differ diff --git a/frontend/__snapshots__/scenes-app-web-performance--performance-block-with-no-performance-details.png b/frontend/__snapshots__/scenes-app-web-performance--performance-block-with-no-performance-details.png new file mode 100644 index 00000000000..08c156fb65a Binary files /dev/null and b/frontend/__snapshots__/scenes-app-web-performance--performance-block-with-no-performance-details.png differ diff --git a/frontend/__snapshots__/scenes-app-web-performance--performance-block-with-performance-details.png b/frontend/__snapshots__/scenes-app-web-performance--performance-block-with-performance-details.png new file mode 100644 index 00000000000..653824be4e1 Binary files /dev/null and b/frontend/__snapshots__/scenes-app-web-performance--performance-block-with-performance-details.png differ diff --git a/frontend/__snapshots__/scenes-app-web-performance--web-performance.png b/frontend/__snapshots__/scenes-app-web-performance--web-performance.png new file mode 100644 index 00000000000..a7fa792eb96 Binary files /dev/null and b/frontend/__snapshots__/scenes-app-web-performance--web-performance.png differ diff --git a/frontend/__snapshots__/scenes-other-invitesignup--cloud.png b/frontend/__snapshots__/scenes-other-invitesignup--cloud.png new file mode 100644 index 00000000000..ed9ed3fd919 Binary files /dev/null and b/frontend/__snapshots__/scenes-other-invitesignup--cloud.png differ diff --git a/frontend/__snapshots__/scenes-other-invitesignup--invalid-link.png b/frontend/__snapshots__/scenes-other-invitesignup--invalid-link.png new file mode 100644 index 00000000000..c3216e2a481 Binary files /dev/null and b/frontend/__snapshots__/scenes-other-invitesignup--invalid-link.png differ diff --git a/frontend/__snapshots__/scenes-other-invitesignup--logged-in-wrong-user.png b/frontend/__snapshots__/scenes-other-invitesignup--logged-in-wrong-user.png new file mode 100644 index 00000000000..12ee0e0ed48 Binary files /dev/null and b/frontend/__snapshots__/scenes-other-invitesignup--logged-in-wrong-user.png differ diff --git a/frontend/__snapshots__/scenes-other-invitesignup--logged-in.png b/frontend/__snapshots__/scenes-other-invitesignup--logged-in.png new file mode 100644 index 00000000000..b76e461dcf8 Binary files /dev/null and b/frontend/__snapshots__/scenes-other-invitesignup--logged-in.png differ diff --git a/frontend/__snapshots__/scenes-other-invitesignup--self-hosted.png b/frontend/__snapshots__/scenes-other-invitesignup--self-hosted.png new file mode 100644 index 00000000000..3ed468d2ee9 Binary files /dev/null and b/frontend/__snapshots__/scenes-other-invitesignup--self-hosted.png differ diff --git a/frontend/__snapshots__/scenes-other-login--cloud.png b/frontend/__snapshots__/scenes-other-login--cloud.png new file mode 100644 index 00000000000..1631b65b115 Binary files /dev/null and b/frontend/__snapshots__/scenes-other-login--cloud.png differ diff --git a/frontend/__snapshots__/scenes-other-login--self-hosted-with-saml.png b/frontend/__snapshots__/scenes-other-login--self-hosted-with-saml.png new file mode 100644 index 00000000000..0d94295df9f Binary files /dev/null and b/frontend/__snapshots__/scenes-other-login--self-hosted-with-saml.png differ diff --git a/frontend/__snapshots__/scenes-other-login--self-hosted.png b/frontend/__snapshots__/scenes-other-login--self-hosted.png new file mode 100644 index 00000000000..4554e36acc6 Binary files /dev/null and b/frontend/__snapshots__/scenes-other-login--self-hosted.png differ diff --git a/frontend/__snapshots__/scenes-other-login--sso-error.png b/frontend/__snapshots__/scenes-other-login--sso-error.png new file mode 100644 index 00000000000..f8048ef8b8b Binary files /dev/null and b/frontend/__snapshots__/scenes-other-login--sso-error.png differ diff --git a/frontend/__snapshots__/scenes-other-password-reset--initial.png b/frontend/__snapshots__/scenes-other-password-reset--initial.png new file mode 100644 index 00000000000..b6bba885727 Binary files /dev/null and b/frontend/__snapshots__/scenes-other-password-reset--initial.png differ diff --git a/frontend/__snapshots__/scenes-other-password-reset--no-smtp.png b/frontend/__snapshots__/scenes-other-password-reset--no-smtp.png new file mode 100644 index 00000000000..a557541bed9 Binary files /dev/null and b/frontend/__snapshots__/scenes-other-password-reset--no-smtp.png differ diff --git a/frontend/__snapshots__/scenes-other-password-reset--success.png b/frontend/__snapshots__/scenes-other-password-reset--success.png new file mode 100644 index 00000000000..83b045b949e Binary files /dev/null and b/frontend/__snapshots__/scenes-other-password-reset--success.png differ diff --git a/frontend/__snapshots__/scenes-other-password-reset-complete--default.png b/frontend/__snapshots__/scenes-other-password-reset-complete--default.png new file mode 100644 index 00000000000..b7b7e11a444 Binary files /dev/null and b/frontend/__snapshots__/scenes-other-password-reset-complete--default.png differ diff --git a/frontend/__snapshots__/scenes-other-password-reset-complete--invalid-link.png b/frontend/__snapshots__/scenes-other-password-reset-complete--invalid-link.png new file mode 100644 index 00000000000..d5f6503dbfa Binary files /dev/null and b/frontend/__snapshots__/scenes-other-password-reset-complete--invalid-link.png differ diff --git a/frontend/__snapshots__/scenes-other-preflight--preflight.png b/frontend/__snapshots__/scenes-other-preflight--preflight.png new file mode 100644 index 00000000000..9bb5fc66402 Binary files /dev/null and b/frontend/__snapshots__/scenes-other-preflight--preflight.png differ diff --git a/frontend/__snapshots__/scenes-other-signup--cloud.png b/frontend/__snapshots__/scenes-other-signup--cloud.png new file mode 100644 index 00000000000..58dad671145 Binary files /dev/null and b/frontend/__snapshots__/scenes-other-signup--cloud.png differ diff --git a/frontend/__snapshots__/scenes-other-signup--self-hosted-sso.png b/frontend/__snapshots__/scenes-other-signup--self-hosted-sso.png new file mode 100644 index 00000000000..a0e7589f330 Binary files /dev/null and b/frontend/__snapshots__/scenes-other-signup--self-hosted-sso.png differ diff --git a/frontend/__snapshots__/scenes-other-signup--self-hosted.png b/frontend/__snapshots__/scenes-other-signup--self-hosted.png new file mode 100644 index 00000000000..c1869a13114 Binary files /dev/null and b/frontend/__snapshots__/scenes-other-signup--self-hosted.png differ diff --git a/frontend/__snapshots__/scenes-other-unsubscribe--unsubscribe-scene.png b/frontend/__snapshots__/scenes-other-unsubscribe--unsubscribe-scene.png new file mode 100644 index 00000000000..4c1e72c47cc Binary files /dev/null and b/frontend/__snapshots__/scenes-other-unsubscribe--unsubscribe-scene.png differ diff --git a/frontend/src/layout/navigation/Navigation.stories.tsx b/frontend/src/layout/navigation/Navigation.stories.tsx index 281fbe110e1..669656da505 100644 --- a/frontend/src/layout/navigation/Navigation.stories.tsx +++ b/frontend/src/layout/navigation/Navigation.stories.tsx @@ -13,7 +13,6 @@ export default { layout: 'fullscreen', options: { showPanel: false }, viewMode: 'story', - testRunner: { includeNavigation: true }, }, } as Meta diff --git a/frontend/src/lib/components/ActivityLog/ActivityLog.stories.tsx b/frontend/src/lib/components/ActivityLog/ActivityLog.stories.tsx index e185d5ed7e8..16c1667394a 100644 --- a/frontend/src/lib/components/ActivityLog/ActivityLog.stories.tsx +++ b/frontend/src/lib/components/ActivityLog/ActivityLog.stories.tsx @@ -11,7 +11,7 @@ import { ActivityScope } from 'lib/components/ActivityLog/humanizeActivity' export default { title: 'Components/ActivityLog', component: ActivityLog, - parameters: { chromatic: { disableSnapshot: true } }, // FIXME: Currently disabled as the Timeout story is flaky + parameters: { testOptions: { skip: true } }, // FIXME: Currently disabled as the Timeout story is flaky decorators: [ mswDecorator({ get: { diff --git a/frontend/src/lib/components/Animation/Animation.stories.tsx b/frontend/src/lib/components/Animation/Animation.stories.tsx index f36ca6e0908..fe4e00159d0 100644 --- a/frontend/src/lib/components/Animation/Animation.stories.tsx +++ b/frontend/src/lib/components/Animation/Animation.stories.tsx @@ -11,7 +11,7 @@ export default { 'Animations are [LottieFiles.com](https://lottiefiles.com/) animations that we load asynchronously.', }, }, - chromatic: { disableSnapshot: true }, + testOptions: { skip: true }, // Animations aren't particularly snapshotable }, argTypes: { size: { diff --git a/frontend/src/lib/components/HedgehogBuddy/HedgehogBuddy.stories.tsx b/frontend/src/lib/components/HedgehogBuddy/HedgehogBuddy.stories.tsx index 62c9459689a..f99c5904e8b 100644 --- a/frontend/src/lib/components/HedgehogBuddy/HedgehogBuddy.stories.tsx +++ b/frontend/src/lib/components/HedgehogBuddy/HedgehogBuddy.stories.tsx @@ -5,7 +5,7 @@ export default { title: 'Components/Hedgehog Buddy', component: HedgehogBuddy, parameters: { - chromatic: { disableSnapshot: true }, + testOptions: { skip: true }, // Hedgehogs aren't particularly snapshotable }, } as ComponentMeta diff --git a/frontend/src/lib/components/PropertyFilters/PropertyFilters.stories.tsx b/frontend/src/lib/components/PropertyFilters/PropertyFilters.stories.tsx index 778a96adf81..2e1de568239 100644 --- a/frontend/src/lib/components/PropertyFilters/PropertyFilters.stories.tsx +++ b/frontend/src/lib/components/PropertyFilters/PropertyFilters.stories.tsx @@ -8,9 +8,6 @@ import { personPropertiesModel } from '~/models/personPropertiesModel' export default { title: 'Filters/PropertyFilters', component: PropertyFilters, - parameters: { - chromatic: { disableSnapshot: true }, - }, } as ComponentMeta const propertyFilters = [ diff --git a/frontend/src/lib/components/PropertyGroupFilters/PropertyGroupFilters.stories.tsx b/frontend/src/lib/components/PropertyGroupFilters/PropertyGroupFilters.stories.tsx index 75f93046c82..a5db8e6396d 100644 --- a/frontend/src/lib/components/PropertyGroupFilters/PropertyGroupFilters.stories.tsx +++ b/frontend/src/lib/components/PropertyGroupFilters/PropertyGroupFilters.stories.tsx @@ -10,9 +10,6 @@ import { cohortsModel } from '~/models/cohortsModel' export default { title: 'Filters/PropertyGroupFilters', component: PropertyGroupFilters, - parameters: { - chromatic: { disableSnapshot: true }, - }, } as ComponentMeta const propertyFilters = [ diff --git a/frontend/src/lib/components/PropertyIcon.stories.tsx b/frontend/src/lib/components/PropertyIcon.stories.tsx index c5c788929de..810356add58 100644 --- a/frontend/src/lib/components/PropertyIcon.stories.tsx +++ b/frontend/src/lib/components/PropertyIcon.stories.tsx @@ -7,7 +7,7 @@ export default { title: 'Lemon UI/Icons/Property Icon', component: PropertyIcon, parameters: { - chromatic: { disableSnapshot: true }, // There are too many icons, the snapshots get very big in table form + testOptions: { skip: true }, // There are too many icons, the snapshots are huge in table form }, } as ComponentMeta diff --git a/frontend/src/lib/components/PropertyKeyInfo.stories.tsx b/frontend/src/lib/components/PropertyKeyInfo.stories.tsx index 2bace1c4574..3f47549c4ef 100644 --- a/frontend/src/lib/components/PropertyKeyInfo.stories.tsx +++ b/frontend/src/lib/components/PropertyKeyInfo.stories.tsx @@ -5,7 +5,6 @@ import { PropertyKeyInfo } from './PropertyKeyInfo' export default { title: 'Components/Property Key Info', component: PropertyKeyInfo, - chromatic: { disableSnapshot: true }, } as ComponentMeta const Template: ComponentStory = (args) => { diff --git a/frontend/src/lib/components/Sharing/SharingModal.stories.tsx b/frontend/src/lib/components/Sharing/SharingModal.stories.tsx index 3256a7e09fc..f2a03263bd0 100644 --- a/frontend/src/lib/components/Sharing/SharingModal.stories.tsx +++ b/frontend/src/lib/components/Sharing/SharingModal.stories.tsx @@ -19,7 +19,6 @@ export default { layout: 'fullscreen', options: { showPanel: false }, viewMode: 'story', - chromatic: { disableSnapshot: true }, }, } as ComponentMeta diff --git a/frontend/src/lib/components/Subscriptions/SubscriptionsModal.stories.tsx b/frontend/src/lib/components/Subscriptions/SubscriptionsModal.stories.tsx index b495bd1ae38..2302ce0db10 100644 --- a/frontend/src/lib/components/Subscriptions/SubscriptionsModal.stories.tsx +++ b/frontend/src/lib/components/Subscriptions/SubscriptionsModal.stories.tsx @@ -16,7 +16,7 @@ export default { layout: 'fullscreen', options: { showPanel: false }, viewMode: 'story', - chromatic: { disableSnapshot: true }, + mockDate: '2023-01-31 12:00:00', }, } as ComponentMeta diff --git a/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.stories.tsx b/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.stories.tsx index 27ed3e68c3a..d726f627fe6 100644 --- a/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.stories.tsx +++ b/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.stories.tsx @@ -9,7 +9,7 @@ export default { title: 'Filters', decorators: [taxonomicFilterMocksDecorator], parameters: { - chromatic: { disableSnapshot: true }, // FIXME: This is currently excluded due to flaky loading of data in it + testOptions: { skip: true }, // FIXME: This is currently excluded due to flaky loading of data in it }, } diff --git a/frontend/src/lib/components/hedgehogs.stories.tsx b/frontend/src/lib/components/hedgehogs.stories.tsx index a8764663e4f..8c3efeacafe 100644 --- a/frontend/src/lib/components/hedgehogs.stories.tsx +++ b/frontend/src/lib/components/hedgehogs.stories.tsx @@ -16,7 +16,7 @@ export default { title: 'Lemon UI/Hog illustrations', parameters: { options: { showPanel: false }, - chromatic: { disableSnapshot: true }, + testOptions: { skip: true }, // Not valuable to take snapshots of these hedgehogs docs: { description: { component: ` diff --git a/frontend/src/lib/lemon-ui/AlertMessage/AlertMessage.stories.tsx b/frontend/src/lib/lemon-ui/AlertMessage/AlertMessage.stories.tsx index 401833bb4ba..d8e4d1d994b 100644 --- a/frontend/src/lib/lemon-ui/AlertMessage/AlertMessage.stories.tsx +++ b/frontend/src/lib/lemon-ui/AlertMessage/AlertMessage.stories.tsx @@ -4,8 +4,12 @@ import { AlertMessage, AlertMessageProps } from './AlertMessage' export default { title: 'Lemon UI/Alert Message', component: AlertMessage, - // See https://github.com/storybookjs/addon-smart-knobs/issues/63#issuecomment-995798227 - parameters: { actions: { argTypesRegex: null }, chromatic: { disableSnapshot: false } }, + parameters: { + actions: { + // See https://github.com/storybookjs/addon-smart-knobs/issues/63#issuecomment-995798227 + argTypesRegex: null, + }, + }, } as ComponentMeta const Template: ComponentStory = (props: AlertMessageProps) => { diff --git a/frontend/src/lib/lemon-ui/LemonSelect/LemonSelect.stories.tsx b/frontend/src/lib/lemon-ui/LemonSelect/LemonSelect.stories.tsx index d647d8db65d..a17a7b7382c 100644 --- a/frontend/src/lib/lemon-ui/LemonSelect/LemonSelect.stories.tsx +++ b/frontend/src/lib/lemon-ui/LemonSelect/LemonSelect.stories.tsx @@ -6,7 +6,6 @@ import { SurprisedHog, BlushingHog } from 'lib/components/hedgehogs' export default { title: 'Lemon UI/Lemon Select', component: LemonSelect, - parameters: { chromatic: { disableSnapshot: false } }, argTypes: { options: { defaultValue: [ diff --git a/frontend/src/lib/lemon-ui/Popover/Popover.stories.tsx b/frontend/src/lib/lemon-ui/Popover/Popover.stories.tsx index 343cf1486d2..1f23f99683c 100644 --- a/frontend/src/lib/lemon-ui/Popover/Popover.stories.tsx +++ b/frontend/src/lib/lemon-ui/Popover/Popover.stories.tsx @@ -7,8 +7,8 @@ export default { title: 'Lemon UI/Popover', component: Popover, parameters: { - chromatic: { - disableSnapshot: true, // FIXME: This story needs a play test for the popover to show up in snapshots + testOptions: { + skip: true, // FIXME: This story needs a play test for the popup to show up in snapshots }, }, } as ComponentMeta diff --git a/frontend/src/lib/lemon-ui/icons/icons.stories.tsx b/frontend/src/lib/lemon-ui/icons/icons.stories.tsx index 08b9119bd34..4fc7d6e9a91 100644 --- a/frontend/src/lib/lemon-ui/icons/icons.stories.tsx +++ b/frontend/src/lib/lemon-ui/icons/icons.stories.tsx @@ -20,7 +20,7 @@ export default { title: 'Lemon UI/Icons', parameters: { options: { showPanel: false }, - chromatic: { disableSnapshot: true }, // There are too many icons, the snapshots get very big in table form + testOptions: { skip: true }, // There are too many icons, the snapshots are huge in table form docs: { description: { component: ` diff --git a/frontend/src/mocks/browser.tsx b/frontend/src/mocks/browser.tsx index 683eac98959..c74bc61ee85 100644 --- a/frontend/src/mocks/browser.tsx +++ b/frontend/src/mocks/browser.tsx @@ -16,7 +16,7 @@ export const mswDecorator = (mocks: Mocks): DecoratorFunction => { for (const restMethod of Object.keys(rest)) { mergedMocks[restMethod] = {} // Ensure trailing slashes to avoid default handlers accidentally overshadowing story mocks - for (const [path, handler] of Object.entries(parameters.msw.mocks?.[restMethod] || {})) { + for (const [path, handler] of Object.entries(parameters.msw?.mocks?.[restMethod] || {})) { const cleanedPath = path.replace(/\/?$/, '/') mergedMocks[restMethod][cleanedPath] = handler } diff --git a/frontend/src/mocks/fixtures/_preflight.json b/frontend/src/mocks/fixtures/_preflight.json index ace48e8ae45..cfd3dd27bf0 100644 --- a/frontend/src/mocks/fixtures/_preflight.json +++ b/frontend/src/mocks/fixtures/_preflight.json @@ -467,7 +467,7 @@ "is_debug": true, "is_event_property_usage_enabled": true, "licensed_users_available": 21311, - "site_url": "http://localhost:8000", + "site_url": "http://localhost:6006", "instance_preferences": { "debug_queries": false, "disable_paid_fs": false diff --git a/frontend/src/mocks/handlers.ts b/frontend/src/mocks/handlers.ts index 4a1c0383d55..abc54c487aa 100644 --- a/frontend/src/mocks/handlers.ts +++ b/frontend/src/mocks/handlers.ts @@ -11,33 +11,38 @@ import { } from 'lib/api.mock' import { getAvailableFeatures } from '~/mocks/features' -const API_NOOP = { count: 0, results: [] as any[], next: null, previous: null } -const apiResults = (results: any[]): typeof API_NOOP => ({ count: results.length, results, next: null, previous: null }) +export const EMPTY_PAGINATED_RESPONSE = { count: 0, results: [] as any[], next: null, previous: null } +export const toPaginatedResponse = (results: any[]): typeof EMPTY_PAGINATED_RESPONSE => ({ + count: results.length, + results, + next: null, + previous: null, +}) export const defaultMocks: Mocks = { get: { - '/api/projects/:team_id/actions/': API_NOOP, - '/api/projects/:team_id/annotations/': API_NOOP, - '/api/projects/:team_id/event_definitions/': API_NOOP, - '/api/projects/:team_id/cohorts/': apiResults([MOCK_DEFAULT_COHORT]), - '/api/projects/:team_id/dashboards/': API_NOOP, - '/api/projects/:team_id/groups/': API_NOOP, - '/api/projects/:team_id/insights/': API_NOOP, - '/api/projects/:team_id/property_definitions/': API_NOOP, - '/api/projects/:team_id/feature_flags/': API_NOOP, + '/api/projects/:team_id/actions/': EMPTY_PAGINATED_RESPONSE, + '/api/projects/:team_id/annotations/': EMPTY_PAGINATED_RESPONSE, + '/api/projects/:team_id/event_definitions/': EMPTY_PAGINATED_RESPONSE, + '/api/projects/:team_id/cohorts/': toPaginatedResponse([MOCK_DEFAULT_COHORT]), + '/api/projects/:team_id/dashboards/': EMPTY_PAGINATED_RESPONSE, + '/api/projects/:team_id/groups/': EMPTY_PAGINATED_RESPONSE, + '/api/projects/:team_id/insights/': EMPTY_PAGINATED_RESPONSE, + '/api/projects/:team_id/property_definitions/': EMPTY_PAGINATED_RESPONSE, + '/api/projects/:team_id/feature_flags/': EMPTY_PAGINATED_RESPONSE, '/api/projects/:team_id/explicit_members/': [], '/api/organizations/@current/': (): MockSignature => [ 200, { ...MOCK_DEFAULT_ORGANIZATION, available_features: getAvailableFeatures() }, ], - '/api/organizations/@current/members/': apiResults([MOCK_DEFAULT_ORGANIZATION_MEMBER]), - '/api/organizations/@current/invites/': apiResults([MOCK_DEFAULT_ORGANIZATION_INVITE]), - '/api/organizations/@current/plugins/': apiResults([]), - '/api/projects/@current/persons/properties/': apiResults(MOCK_PERSON_PROPERTIES), - '/api/projects/:team_id/persons': apiResults([]), - '/api/projects/:team_id/persons/properties/': apiResults(MOCK_PERSON_PROPERTIES), + '/api/organizations/@current/members/': toPaginatedResponse([MOCK_DEFAULT_ORGANIZATION_MEMBER]), + '/api/organizations/@current/invites/': toPaginatedResponse([MOCK_DEFAULT_ORGANIZATION_INVITE]), + '/api/organizations/@current/plugins/': toPaginatedResponse([]), + '/api/projects/@current/persons/properties/': toPaginatedResponse(MOCK_PERSON_PROPERTIES), + '/api/projects/:team_id/persons': toPaginatedResponse([]), + '/api/projects/:team_id/persons/properties/': toPaginatedResponse(MOCK_PERSON_PROPERTIES), '/api/personal_api_keys/': [], - '/api/license/': apiResults([MOCK_DEFAULT_LICENSE]), + '/api/license/': toPaginatedResponse([MOCK_DEFAULT_LICENSE]), '/api/users/@me/': (): MockSignature => [ 200, { @@ -50,7 +55,7 @@ export const defaultMocks: Mocks = { '/_preflight': require('./fixtures/_preflight.json'), '/_system_status': require('./fixtures/_system_status.json'), '/api/instance_status': require('./fixtures/_instance_status.json'), - '/api/plugin_config/': apiResults([]), + '/api/plugin_config/': toPaginatedResponse([]), 'https://update.posthog.com/': [{ version: '1.42.0', release_date: '2022-11-30' }], }, post: { diff --git a/frontend/src/queries/nodes/DataNode/DataNode.stories.tsx b/frontend/src/queries/nodes/DataNode/DataNode.stories.tsx index c8663b36aff..711451ca613 100644 --- a/frontend/src/queries/nodes/DataNode/DataNode.stories.tsx +++ b/frontend/src/queries/nodes/DataNode/DataNode.stories.tsx @@ -12,7 +12,7 @@ export default { layout: 'fullscreen', options: { showPanel: false }, viewMode: 'story', - chromatic: { disableSnapshot: true }, + testOptions: { skip: true }, }, argTypes: { query: { defaultValue: {} }, diff --git a/frontend/src/queries/nodes/DataTable/DataTable.stories.tsx b/frontend/src/queries/nodes/DataTable/DataTable.stories.tsx index 37a88d3d0af..37b6bc50ac2 100644 --- a/frontend/src/queries/nodes/DataTable/DataTable.stories.tsx +++ b/frontend/src/queries/nodes/DataTable/DataTable.stories.tsx @@ -13,7 +13,7 @@ export default { layout: 'fullscreen', options: { showPanel: false }, viewMode: 'story', - chromatic: { disableSnapshot: true }, + testOptions: { skip: true }, }, argTypes: { query: { defaultValue: {} }, diff --git a/frontend/src/scenes/PreflightCheck/PreflightCheck.stories.tsx b/frontend/src/scenes/PreflightCheck/PreflightCheck.stories.tsx index 0397651c276..e2143d37cba 100644 --- a/frontend/src/scenes/PreflightCheck/PreflightCheck.stories.tsx +++ b/frontend/src/scenes/PreflightCheck/PreflightCheck.stories.tsx @@ -8,7 +8,6 @@ export default { layout: 'fullscreen', options: { showPanel: false }, viewMode: 'story', - chromatic: { disableSnapshot: true }, }, } as Meta diff --git a/frontend/src/scenes/PreflightCheck/preflightLogic.tsx b/frontend/src/scenes/PreflightCheck/preflightLogic.tsx index ee879aedfc5..b39db1dc3b0 100644 --- a/frontend/src/scenes/PreflightCheck/preflightLogic.tsx +++ b/frontend/src/scenes/PreflightCheck/preflightLogic.tsx @@ -37,7 +37,7 @@ export const preflightLogic = kea([ null as PreflightStatus | null, { loadPreflight: async () => { - const response = await api.get('_preflight/') + const response = (await api.get('_preflight/')) as PreflightStatus return response }, }, @@ -214,7 +214,13 @@ export const preflightLogic = kea([ siteUrlMisconfigured: [ (s) => [s.preflight], (preflight): boolean => { - return Boolean(preflight && (!preflight.site_url || preflight.site_url != window.location.origin)) + if (process.env.STORYBOOK) { + // Disable the "site URL misconfigured" warning in Storybook. This is for consistent snapshots + // - when opening Storybook in the browser or when updating the snapshots in CI, the origin is + // http://localhost:6006, but in the local dockerized setup http://host.docker.internal:6006 + return false + } + return !!preflight && (!preflight.site_url || preflight.site_url != window.location.origin) }, ], configOptions: [ diff --git a/frontend/src/scenes/Unsubscribe/Unsubscribe.stories.tsx b/frontend/src/scenes/Unsubscribe/Unsubscribe.stories.tsx index 1fd36c93fbc..2bff4cad453 100644 --- a/frontend/src/scenes/Unsubscribe/Unsubscribe.stories.tsx +++ b/frontend/src/scenes/Unsubscribe/Unsubscribe.stories.tsx @@ -8,7 +8,6 @@ export default { layout: 'fullscreen', options: { showPanel: false }, viewMode: 'story', - chromatic: { disableSnapshot: true }, }, } as Meta diff --git a/frontend/src/scenes/annotations/Annotations.stories.tsx b/frontend/src/scenes/annotations/Annotations.stories.tsx index 2b05b1820f0..8c83c6c14d0 100644 --- a/frontend/src/scenes/annotations/Annotations.stories.tsx +++ b/frontend/src/scenes/annotations/Annotations.stories.tsx @@ -11,8 +11,10 @@ export default { parameters: { layout: 'fullscreen', options: { showPanel: false }, + testOptions: { + excludeNavigationFromSnapshot: true, + }, viewMode: 'story', - mockDate: '2023-01-28', // To stabilize relative dates }, decorators: [ diff --git a/frontend/src/scenes/authentication/InviteSignup.stories.tsx b/frontend/src/scenes/authentication/InviteSignup.stories.tsx index 80e5cc5ad22..6393bc81363 100644 --- a/frontend/src/scenes/authentication/InviteSignup.stories.tsx +++ b/frontend/src/scenes/authentication/InviteSignup.stories.tsx @@ -12,7 +12,6 @@ export default { layout: 'fullscreen', options: { showPanel: false }, viewMode: 'story', - chromatic: { disableSnapshot: true }, }, decorators: [ mswDecorator({ diff --git a/frontend/src/scenes/authentication/Login.stories.tsx b/frontend/src/scenes/authentication/Login.stories.tsx index efb9056bba8..a635ddf7926 100644 --- a/frontend/src/scenes/authentication/Login.stories.tsx +++ b/frontend/src/scenes/authentication/Login.stories.tsx @@ -13,7 +13,6 @@ export default { layout: 'fullscreen', options: { showPanel: false }, viewMode: 'story', - chromatic: { disableSnapshot: true }, }, } as Meta diff --git a/frontend/src/scenes/authentication/PasswordReset.stories.tsx b/frontend/src/scenes/authentication/PasswordReset.stories.tsx index ec5fe5ee575..2bad1645d7d 100644 --- a/frontend/src/scenes/authentication/PasswordReset.stories.tsx +++ b/frontend/src/scenes/authentication/PasswordReset.stories.tsx @@ -13,7 +13,6 @@ export default { layout: 'fullscreen', options: { showPanel: false }, viewMode: 'story', - chromatic: { disableSnapshot: true }, }, } as Meta diff --git a/frontend/src/scenes/authentication/PasswordResetComplete.stories.tsx b/frontend/src/scenes/authentication/PasswordResetComplete.stories.tsx index 669520fbe63..64c69033b28 100644 --- a/frontend/src/scenes/authentication/PasswordResetComplete.stories.tsx +++ b/frontend/src/scenes/authentication/PasswordResetComplete.stories.tsx @@ -13,7 +13,6 @@ export default { layout: 'fullscreen', options: { showPanel: false }, viewMode: 'story', - chromatic: { disableSnapshot: true }, }, } as Meta diff --git a/frontend/src/scenes/authentication/signup/Signup.stories.tsx b/frontend/src/scenes/authentication/signup/Signup.stories.tsx index 618dc96f157..246c431b156 100644 --- a/frontend/src/scenes/authentication/signup/Signup.stories.tsx +++ b/frontend/src/scenes/authentication/signup/Signup.stories.tsx @@ -12,7 +12,6 @@ export default { layout: 'fullscreen', options: { showPanel: false }, viewMode: 'story', - chromatic: { disableSnapshot: true }, }, decorators: [ mswDecorator({ diff --git a/frontend/src/scenes/billing/BillingSubscribed.stories.tsx b/frontend/src/scenes/billing/BillingSubscribed.stories.tsx index b7441fffa6e..7406617249b 100644 --- a/frontend/src/scenes/billing/BillingSubscribed.stories.tsx +++ b/frontend/src/scenes/billing/BillingSubscribed.stories.tsx @@ -13,7 +13,7 @@ export default { layout: 'fullscreen', options: { showPanel: false }, viewMode: 'story', - chromatic: { disableSnapshot: true }, + testOptions: { skip: true }, // FIXME: This fails for some reason }, decorators: [ mswDecorator({ diff --git a/frontend/src/scenes/billing/v2/Billing.stories.tsx b/frontend/src/scenes/billing/v2/Billing.stories.tsx index 1b0a684fb6c..5ed5e14e38b 100644 --- a/frontend/src/scenes/billing/v2/Billing.stories.tsx +++ b/frontend/src/scenes/billing/v2/Billing.stories.tsx @@ -10,7 +10,7 @@ export default { layout: 'fullscreen', options: { showPanel: false }, viewMode: 'story', - chromatic: { disableSnapshot: true }, + testOptions: { skip: true }, }, decorators: [ mswDecorator({ diff --git a/frontend/src/scenes/dashboard/Dashboards.stories.tsx b/frontend/src/scenes/dashboard/Dashboards.stories.tsx index f959cf7fcac..bc7711ffa89 100644 --- a/frontend/src/scenes/dashboard/Dashboards.stories.tsx +++ b/frontend/src/scenes/dashboard/Dashboards.stories.tsx @@ -21,7 +21,14 @@ export default { }, }), ], - parameters: { layout: 'fullscreen', options: { showPanel: false }, viewMode: 'story' }, + parameters: { + layout: 'fullscreen', + options: { showPanel: false }, + testOptions: { + excludeNavigationFromSnapshot: true, + }, + viewMode: 'story', + }, } as Meta export const List = (): JSX.Element => { diff --git a/frontend/src/scenes/events/Events.stories.tsx b/frontend/src/scenes/events/Events.stories.tsx index 2057b6c56f5..dd80940052c 100644 --- a/frontend/src/scenes/events/Events.stories.tsx +++ b/frontend/src/scenes/events/Events.stories.tsx @@ -19,8 +19,10 @@ export default { parameters: { layout: 'fullscreen', options: { showPanel: false }, + testOptions: { + excludeNavigationFromSnapshot: true, + }, viewMode: 'story', - mockDate: '2023-01-28', // To stabilize relative dates }, } as Meta diff --git a/frontend/src/scenes/feature-flags/FeatureFlags.stories.tsx b/frontend/src/scenes/feature-flags/FeatureFlags.stories.tsx index a34ed60b8fc..b359eb303fc 100644 --- a/frontend/src/scenes/feature-flags/FeatureFlags.stories.tsx +++ b/frontend/src/scenes/feature-flags/FeatureFlags.stories.tsx @@ -13,8 +13,10 @@ export default { parameters: { layout: 'fullscreen', options: { showPanel: false }, + testOptions: { + excludeNavigationFromSnapshot: true, + }, viewMode: 'story', - mockDate: '2023-01-28', // To stabilize relative dates }, decorators: [ diff --git a/frontend/src/scenes/ingestion/v1/IngestionV1.stories.tsx b/frontend/src/scenes/ingestion/v1/IngestionV1.stories.tsx index e0c03bedda9..06b5dd349b7 100644 --- a/frontend/src/scenes/ingestion/v1/IngestionV1.stories.tsx +++ b/frontend/src/scenes/ingestion/v1/IngestionV1.stories.tsx @@ -8,7 +8,7 @@ export default { layout: 'fullscreen', options: { showPanel: false }, viewMode: 'story', - chromatic: { disableSnapshot: true }, + testOptions: { skip: true }, }, } as Meta diff --git a/frontend/src/scenes/insights/EmptyStates/EmptyStates.stories.tsx b/frontend/src/scenes/insights/EmptyStates/EmptyStates.stories.tsx index 04d8d0004ce..8754c0ee2f2 100644 --- a/frontend/src/scenes/insights/EmptyStates/EmptyStates.stories.tsx +++ b/frontend/src/scenes/insights/EmptyStates/EmptyStates.stories.tsx @@ -16,7 +16,7 @@ export default { layout: 'fullscreen', options: { showPanel: false }, viewMode: 'story', - chromatic: { disableSnapshot: true }, + testOptions: { skip: true }, // FIXME }, } as Meta diff --git a/frontend/src/scenes/insights/InsightTooltip/InsightTooltip.stories.tsx b/frontend/src/scenes/insights/InsightTooltip/InsightTooltip.stories.tsx index 7aaf803e9cf..f85d214c36b 100644 --- a/frontend/src/scenes/insights/InsightTooltip/InsightTooltip.stories.tsx +++ b/frontend/src/scenes/insights/InsightTooltip/InsightTooltip.stories.tsx @@ -129,7 +129,7 @@ export default { groupTypeLabel: { defaultValue: 'people' }, }, parameters: { - chromatic: { disableSnapshot: true }, + testOptions: { skip: true }, // FIXME: The InWrapper story fails at locator.screenshot() for some reason }, } as ComponentMeta diff --git a/frontend/src/scenes/insights/Insights.stories.tsx b/frontend/src/scenes/insights/Insights.stories.tsx index 4293bac5e4b..affb640f32f 100644 --- a/frontend/src/scenes/insights/Insights.stories.tsx +++ b/frontend/src/scenes/insights/Insights.stories.tsx @@ -8,9 +8,11 @@ export default { parameters: { layout: 'fullscreen', options: { showPanel: false }, + testOptions: { + excludeNavigationFromSnapshot: true, + }, viewMode: 'story', mockDate: '2022-03-11', - chromatic: { disableSnapshot: true }, }, decorators: [ mswDecorator({ diff --git a/frontend/src/scenes/insights/__mocks__/trendsNumber.json b/frontend/src/scenes/insights/__mocks__/trendsNumber.json index 89fce62397b..cb2ef0bbb28 100644 --- a/frontend/src/scenes/insights/__mocks__/trendsNumber.json +++ b/frontend/src/scenes/insights/__mocks__/trendsNumber.json @@ -81,7 +81,7 @@ "uuid": "01827ddb-2c5a-0000-8b59-d02c5e3a4cdc", "distinct_id": "NbZZRONLD9Jn2FUgBbwKkGP0L6qemQZ0x3l7T5HBuCT", "first_name": "Employee 427", - "email": "charles@posthog.com" + "email": "427@posthog.com" }, "description": "", "updated_at": "2022-08-08T14:32:27.143626Z", @@ -93,7 +93,7 @@ "uuid": "01827ddb-2c5a-0000-8b59-d02c5e3a4cdc", "distinct_id": "NbZZRONLD9Jn2FUgBbwKkGP0L6qemQZ0x3l7T5HBuCT", "first_name": "Employee 427", - "email": "charles@posthog.com" + "email": "427@posthog.com" }, "is_sample": false, "effective_restriction_level": 21, diff --git a/frontend/src/scenes/insights/__mocks__/userPaths.json b/frontend/src/scenes/insights/__mocks__/userPaths.json index c385d3e4336..5899ddc4f23 100644 --- a/frontend/src/scenes/insights/__mocks__/userPaths.json +++ b/frontend/src/scenes/insights/__mocks__/userPaths.json @@ -73,12 +73,6 @@ "value": 296, "average_conversion_time": 1.0405405405405406 }, - { - "source": "2_http://amazingstore.com/cart", - "target": "3_http://amazingstore.com/checkout", - "value": 275, - "average_conversion_time": 0.6945454545454546 - }, { "source": "2_http://amazingstore.com/product", "target": "3_http://amazingstore.com/checkout", diff --git a/frontend/src/scenes/paths/Paths.tsx b/frontend/src/scenes/paths/Paths.tsx index f3a3babaea0..63fa3488b4f 100644 --- a/frontend/src/scenes/paths/Paths.tsx +++ b/frontend/src/scenes/paths/Paths.tsx @@ -43,7 +43,9 @@ export function PathsComponent({ nodeCard }: PathsComponentProps): JSX.Element { useEffect(() => { setNodeCards([]) - const elements = document?.getElementById(id)?.querySelectorAll(`.Paths svg`) + // Remove the existing SVG canvas(es). The .Paths__canvas selector is crucial, as we have to be sure + // we're only removing the Paths viz and not, for example, button icons. + const elements = document?.getElementById(id)?.querySelectorAll(`.Paths__canvas`) elements?.forEach((node) => node?.parentNode?.removeChild(node)) renderPaths(canvasRef, canvasWidth, canvasHeight, paths, filter, setNodeCards) diff --git a/frontend/src/scenes/paths/renderPaths.ts b/frontend/src/scenes/paths/renderPaths.ts index fd756f3b73f..92a0e506454 100644 --- a/frontend/src/scenes/paths/renderPaths.ts +++ b/frontend/src/scenes/paths/renderPaths.ts @@ -14,6 +14,7 @@ const createCanvas = (canvasRef: RefObject, width: number, heigh return d3 .select(canvasRef.current) .append('svg') + .classed('Paths__canvas', true) .style('background', 'var(--item-background)') .style('width', width) .style('height', height) diff --git a/frontend/src/scenes/performance/WebPerformance.stories.tsx b/frontend/src/scenes/performance/WebPerformance.stories.tsx index 16a6de3cb38..5519b979b80 100644 --- a/frontend/src/scenes/performance/WebPerformance.stories.tsx +++ b/frontend/src/scenes/performance/WebPerformance.stories.tsx @@ -14,7 +14,6 @@ export default { layout: 'fullscreen', options: { showPanel: false }, viewMode: 'story', - chromatic: { disableSnapshot: true }, }, decorators: [ mswDecorator({ diff --git a/frontend/src/scenes/project-homepage/ProjectHomepage.stories.tsx b/frontend/src/scenes/project-homepage/ProjectHomepage.stories.tsx index 6c1bb727ba0..9f3d4f501b0 100644 --- a/frontend/src/scenes/project-homepage/ProjectHomepage.stories.tsx +++ b/frontend/src/scenes/project-homepage/ProjectHomepage.stories.tsx @@ -16,7 +16,14 @@ export default { }, }), ], - parameters: { layout: 'fullscreen', options: { showPanel: false }, viewMode: 'story' }, + parameters: { + layout: 'fullscreen', + options: { showPanel: false }, + testOptions: { + excludeNavigationFromSnapshot: true, + }, + viewMode: 'story', + }, } as Meta export const ProjectHomepage = (): JSX.Element => { diff --git a/frontend/src/scenes/project/Settings/SlackIntegration.stories.tsx b/frontend/src/scenes/project/Settings/SlackIntegration.stories.tsx index caf74d97c6c..e2a4f7ae1e7 100644 --- a/frontend/src/scenes/project/Settings/SlackIntegration.stories.tsx +++ b/frontend/src/scenes/project/Settings/SlackIntegration.stories.tsx @@ -8,12 +8,7 @@ import { SlackIntegration } from './SlackIntegration' export default { title: 'Components/Integrations/Slack', component: SlackIntegration, - parameters: { - layout: 'fullscreen', - options: { showPanel: false }, - viewMode: 'story', - chromatic: { disableSnapshot: true }, - }, + parameters: {}, } as ComponentMeta const Template = (args: { instanceConfigured?: boolean; integrated?: boolean }): JSX.Element => { @@ -41,11 +36,7 @@ const Template = (args: { instanceConfigured?: boolean; integrated?: boolean }): }, }) - return ( -
- -
- ) + return } export const SlackIntegration_ = (): JSX.Element => { diff --git a/frontend/src/scenes/saved-insights/SavedInsights.stories.tsx b/frontend/src/scenes/saved-insights/SavedInsights.stories.tsx index b4957e932f8..d39716e40e2 100644 --- a/frontend/src/scenes/saved-insights/SavedInsights.stories.tsx +++ b/frontend/src/scenes/saved-insights/SavedInsights.stories.tsx @@ -5,11 +5,12 @@ import insightsJson from './__mocks__/insights.json' import { useEffect } from 'react' import { router } from 'kea-router' -import { mswDecorator } from '~/mocks/browser' +import { mswDecorator, useStorybookMocks } from '~/mocks/browser' import trendsBarBreakdown from '../insights/__mocks__/trendsBarBreakdown.json' import trendsPieBreakdown from '../insights/__mocks__/trendsPieBreakdown.json' import funnelTopToBottom from '../insights/__mocks__/funnelTopToBottom.json' +import { EMPTY_PAGINATED_RESPONSE, toPaginatedResponse } from '~/mocks/handlers' const insights = [trendsBarBreakdown, trendsPieBreakdown, funnelTopToBottom] @@ -18,20 +19,22 @@ export default { parameters: { layout: 'fullscreen', options: { showPanel: false }, + testOptions: { + excludeNavigationFromSnapshot: true, + }, viewMode: 'story', - chromatic: { disableSnapshot: true }, // FIXME: This is currently excluded due to unreliable rendering in tests }, decorators: [ mswDecorator({ get: { - '/api/projects/:team_id/insights': { - ...insightsJson, - results: insightsJson.results.map((result, i) => ({ + '/api/projects/:team_id/insights': toPaginatedResponse( + insightsJson.results.slice(0, 6).map((result, i) => ({ + // Keep size of response in check ...result, filters: insights[i % insights.length].filters, result: insights[i % insights.length].result, - })), - }, + })) + ), }, }), ], @@ -50,3 +53,15 @@ export const CardView = (): JSX.Element => { }) return } + +export const EmptyState = (): JSX.Element => { + useStorybookMocks({ + get: { + '/api/projects/:team_id/insights': EMPTY_PAGINATED_RESPONSE, + }, + }) + useEffect(() => { + router.actions.push('/insights') + }) + return +} diff --git a/frontend/src/scenes/session-recordings/SessionsRecordings.stories.tsx b/frontend/src/scenes/session-recordings/SessionsRecordings.stories.tsx index 88756dee957..c163a2dec2c 100644 --- a/frontend/src/scenes/session-recordings/SessionsRecordings.stories.tsx +++ b/frontend/src/scenes/session-recordings/SessionsRecordings.stories.tsx @@ -16,7 +16,7 @@ export default { layout: 'fullscreen', options: { showPanel: false }, viewMode: 'story', - chromatic: { disableSnapshot: true }, + testOptions: { skip: true }, // FIXME: Start taking snapshots once the stories no longer crash }, decorators: [ mswDecorator({ diff --git a/frontend/src/toolbar/Toolbar.stories.tsx b/frontend/src/toolbar/Toolbar.stories.tsx index d124c65f01f..df6fc9a7153 100644 --- a/frontend/src/toolbar/Toolbar.stories.tsx +++ b/frontend/src/toolbar/Toolbar.stories.tsx @@ -24,7 +24,7 @@ export default { layout: 'fullscreen', options: { showPanel: false }, viewMode: 'story', - chromatic: { disableSnapshot: true }, + testOptions: { skip: true }, // This story is not valuable to snapshot as is }, } as Meta