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(product-analytics): assert the setup screen in the trends spec (#93355)

Rafael Audibert1b004454237d
diff --git a/frontend/src/lib/components/ProductEmptyState/ProductEmptyState.tsx b/frontend/src/lib/components/ProductEmptyState/ProductEmptyState.tsx
index bddd1d908518..fb248c3e53b9 100644
--- a/frontend/src/lib/components/ProductEmptyState/ProductEmptyState.tsx
+++ b/frontend/src/lib/components/ProductEmptyState/ProductEmptyState.tsx
@@ -139,6 +139,9 @@ export function ProductEmptyState({ config, mode }: ProductEmptyStateProps): JSX
return (
<div
+ // Frozen selector. Playwright specs use it to detect the setup screen, because a
+ // scene behind this gate does not render until the product has data.
+ data-attr="product-empty-state"
// Fill the scene: viewport minus the app chrome and the product header above us.
className="grid w-full flex-1 grid-cols-1 items-stretch gap-10 md:grid-cols-[minmax(0,1fr)_40%] min-h-[calc(100vh-var(--breadcrumbs-height-full,0px)-var(--scene-padding,1rem)-4rem)]"
style={
diff --git a/playwright/e2e/product-analytics/insights/trends.spec.ts b/playwright/e2e/product-analytics/insights/trends.spec.ts
index 7974bf3f9f4b..65423398a42e 100644
--- a/playwright/e2e/product-analytics/insights/trends.spec.ts
+++ b/playwright/e2e/product-analytics/insights/trends.spec.ts
@@ -308,7 +308,9 @@ test.describe('Trends insights', () => {
await test.step('navigate away and verify no orphaned tooltip', async () => {
await insight.goToList()
- await expect(page.locator('table')).toBeVisible()
+ // This project saves no insight, so the list opens on the product analytics setup
+ // screen rather than the table.
+ await expect(page.getByTestId('product-empty-state')).toBeVisible()
await expect(insight.trends.tooltip).toHaveCount(0, { timeout: 3000 })
})
})