Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(metrics): make dashboard import progress stories deterministic (#117582)

Thomas Obermüllered0426a29838
diff --git a/products/metrics/frontend/dashboardImport/MetricsDashboardImportModal.stories.tsx b/products/metrics/frontend/dashboardImport/MetricsDashboardImportModal.stories.tsx
index 5a6325d3bc34..9531312152ea 100644
--- a/products/metrics/frontend/dashboardImport/MetricsDashboardImportModal.stories.tsx
+++ b/products/metrics/frontend/dashboardImport/MetricsDashboardImportModal.stories.tsx
@@ -77,7 +77,17 @@ const RUNNING_IMPORT: DashboardImportApi = {
],
}
+// The progress step shows a spinner on the current phase for as long as the import runs, and the runner waits
+// for every loader to disappear before it snapshots. These stories wait for the progress footer instead. The
+// modal opens after a delay, so this wait also stops the snapshot from catching the page before the modal opens.
+// The runner freezes animations, so the spinner snapshots deterministically.
+const progressTestOptions = {
+ waitForLoadersToDisappear: false,
+ waitForSelector: '[data-attr="metrics-dashboard-import-hide"]',
+}
+
export const ImportProgress: Story = {
+ parameters: { testOptions: progressTestOptions },
render: () => {
useDelayedOnMountEffect(() => {
metricsDashboardImportLogic.actions.openImport(RUNNING_IMPORT)
@@ -88,6 +98,7 @@ export const ImportProgress: Story = {
}
export const ImportCheckingLayout: Story = {
+ parameters: { testOptions: progressTestOptions },
render: () => {
useDelayedOnMountEffect(() => {
metricsDashboardImportLogic.actions.openImport({