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.

fix(insights): stabilize drag-to-zoom tests (#96142)

Paul D'Ambra7ab9c04f8938
diff --git a/products/product_analytics/frontend/insights/trends/TrendsLineChart/TrendsLineChart.test.tsx b/products/product_analytics/frontend/insights/trends/TrendsLineChart/TrendsLineChart.test.tsx
index d60db6521853..a3a417445668 100644
--- a/products/product_analytics/frontend/insights/trends/TrendsLineChart/TrendsLineChart.test.tsx
+++ b/products/product_analytics/frontend/insights/trends/TrendsLineChart/TrendsLineChart.test.tsx
@@ -900,9 +900,8 @@ describe('TrendsLineChart', () => {
renderInsight({ query: buildTrendsQuery(), context: { onDateRangeZoom }, featureFlags: zoomFlag })
const wrapper = await getChartWrapper()
- dragSelection(wrapper, 1, 3, totalLabels)
-
await waitFor(() => {
+ dragSelection(wrapper, 1, 3, totalLabels)
// Days, not the formatted axis labels ('Tue'/'Thu') the chart renders with.
expect(onDateRangeZoom).toHaveBeenCalledWith('2024-06-11', '2024-06-13')
})
@@ -918,9 +917,8 @@ describe('TrendsLineChart', () => {
const step = dimensions.plotWidth / (totalLabels - 1)
const x = dimensions.plotLeft + step
const y = dimensions.plotTop + dimensions.plotHeight / 2
- rawDrag(wrapper, { from: { x: x - 40, y }, to: { x: x + 40, y } })
-
await waitFor(() => {
+ rawDrag(wrapper, { from: { x: x - 40, y }, to: { x: x + 40, y } })
expect(onDateRangeZoom).toHaveBeenCalledWith('2024-06-11', '2024-06-11')
})
})