: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(product-analytics): wait for warehouse detection in the home tab test (#124123)
Julian Bez48add3fbc43d
diff --git a/products/product_analytics/frontend/insights/home/HomeTabDefault.test.tsx b/products/product_analytics/frontend/insights/home/HomeTabDefault.test.tsxindex 46ed25140088..d055c4b4f3c9 100644--- a/products/product_analytics/frontend/insights/home/HomeTabDefault.test.tsx+++ b/products/product_analytics/frontend/insights/home/HomeTabDefault.test.tsx@@ -5,10 +5,12 @@ import { MOCK_DEFAULT_TEAM } from 'lib/api.mock'import '@testing-library/jest-dom'import { act, cleanup, render, screen, waitFor, within } from '@testing-library/react'+import { expectLogic } from 'kea-test-utils'import { ensureJsdom } from '@posthog/quill-charts/testing'import { promiseResolveReject } from 'lib/utils/async'+import { sampleDataStateLogic } from 'scenes/insights/EmptyStates/sampleDataStateLogic'import { savedInsightsLogic } from 'scenes/saved-insights/savedInsightsLogic'import { teamLogic } from 'scenes/teamLogic'@@ -20,6 +22,8 @@ import { isInsightQueryNode, isRetentionQuery, isTrendsQuery } from '~/queries/uimport { initKeaTests } from '~/test/init'import { ChartDisplayType } from '~/types'+import { dataWarehouseSetupLogic } from 'products/data_warehouse/frontend/emptyState/dataWarehouseSetupLogic'+import { HomeTabDefault } from './HomeTabDefault'import { homeTabDefaultLogic } from './homeTabDefaultLogic'import { getHomeTabStatQueries } from './homeTabDefaultTiles'@@ -166,6 +170,9 @@ describe('HomeTabDefault query reuse', () => {it('replaces sample metrics and charts with live queries when the project starts receiving events', async () => {ensureJsdom()teamLogic.actions.loadCurrentTeamSuccess({ ...MOCK_DEFAULT_TEAM, ingested_event: false, is_demo: false })+ // Sample data waits for warehouse detection, and live queries run until it settles.+ sampleDataStateLogic.mount()+ await expectLogic(dataWarehouseSetupLogic).toDispatchActions(['detectStatusSuccess'])const { container } = render(<HomeTabDefault />)await waitFor(() =>