: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(tests): bump chart test waitFor timeouts to 2s and wrap sync assertions (#61058)
mendral-app[bot]dbe0a854abe4
diff --git a/products/product_analytics/frontend/insights/funnels/FunnelLineChart/FunnelLineChart.test.tsx b/products/product_analytics/frontend/insights/funnels/FunnelLineChart/FunnelLineChart.test.tsxindex c2ac4dd6c404..f48c3502e9f1 100644--- a/products/product_analytics/frontend/insights/funnels/FunnelLineChart/FunnelLineChart.test.tsx+++ b/products/product_analytics/frontend/insights/funnels/FunnelLineChart/FunnelLineChart.test.tsx@@ -1,6 +1,6 @@import '@testing-library/jest-dom'-import { cleanup, screen, waitFor } from '@testing-library/react'+import { cleanup, configure, screen, waitFor } from '@testing-library/react'import { FEATURE_FLAGS } from 'lib/constants'import { ensureJsdom, waitForHogChartTooltip } from 'lib/hog-charts/testing'@@ -11,6 +11,8 @@ import { AnnotationScope } from '~/types'import { FUNNEL_CONVERSION_SERIES_LABEL } from '../shared/funnelSeriesMeta'+configure({ asyncUtilTimeout: 2000 })+ensureJsdom()afterEach(() => {diff --git a/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/StickinessLineChart.test.tsx b/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/StickinessLineChart.test.tsxindex f70197e088a3..0a6092acb5c9 100644--- a/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/StickinessLineChart.test.tsx+++ b/products/product_analytics/frontend/insights/stickiness/StickinessLineChart/StickinessLineChart.test.tsx@@ -1,6 +1,6 @@import '@testing-library/jest-dom'-import { cleanup, screen, waitFor } from '@testing-library/react'+import { cleanup, configure, screen, waitFor } from '@testing-library/react'import { FEATURE_FLAGS } from 'lib/constants'import { setupJsdom, setupSyncRaf } from 'lib/hog-charts/testing'@@ -8,6 +8,8 @@ import { setupJsdom, setupSyncRaf } from 'lib/hog-charts/testing'import { NodeKind } from '~/queries/schema/schema-general'import { buildStickinessQuery, chart, getHogChart, personsModal, renderInsight } from '~/test/insight-testing'+configure({ asyncUtilTimeout: 3000 })+let cleanupJsdom: () => voidlet cleanupRaf: () => void@@ -30,7 +32,7 @@ describe('StickinessLineChart', () => {it('renders the chart from a StickinessQuery with one series', async () => {renderInsight({ query: buildStickinessQuery(), featureFlags: HOG_CHARTS_FLAG })- await screen.findByRole('img', { name: /chart with 1 data series/i }, { timeout: 3000 })+ await screen.findByRole('img', { name: /chart with 1 data series/i })})})@@ -39,11 +41,13 @@ describe('StickinessLineChart', () => {renderInsight({ query: buildStickinessQuery(), featureFlags: HOG_CHARTS_FLAG })await screen.findByRole('img', { name: /chart with/i })- const ticks = getHogChart().yTicks()- expect(ticks.length).toBeGreaterThan(0)- for (const t of ticks) {- expect(t).toMatch(/%/)- }+ await waitFor(() => {+ const ticks = getHogChart().yTicks()+ expect(ticks.length).toBeGreaterThan(0)+ for (const t of ticks) {+ expect(t).toMatch(/%/)+ }+ })})})diff --git a/products/product_analytics/frontend/insights/trends/TrendsLineChart/TrendsLineChart.test.tsx b/products/product_analytics/frontend/insights/trends/TrendsLineChart/TrendsLineChart.test.tsxindex 3153c7896c0c..fc1a14a46bbc 100644--- a/products/product_analytics/frontend/insights/trends/TrendsLineChart/TrendsLineChart.test.tsx+++ b/products/product_analytics/frontend/insights/trends/TrendsLineChart/TrendsLineChart.test.tsx@@ -341,11 +341,13 @@ describe('TrendsLineChart', () => {})await screen.findByRole('img', { name: /chart with/i })- const ticks = getHogChart().yTicks()- expect(ticks.length).toBeGreaterThan(0)- for (const t of ticks) {- expect(t).toMatch(/%/)- }+ await waitFor(() => {+ const ticks = getHogChart().yTicks()+ expect(ticks.length).toBeGreaterThan(0)+ for (const t of ticks) {+ expect(t).toMatch(/%/)+ }+ })})})