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(test): resolve flaky GroupKeySelect hover tooltip test (#65192)

mendral-app[bot]ec6fee89a363
diff --git a/frontend/src/lib/components/PropertyFilters/components/GroupKeySelect.test.tsx b/frontend/src/lib/components/PropertyFilters/components/GroupKeySelect.test.tsx
index f58f1fdaf1c1..8ab779aa44c2 100644
--- a/frontend/src/lib/components/PropertyFilters/components/GroupKeySelect.test.tsx
+++ b/frontend/src/lib/components/PropertyFilters/components/GroupKeySelect.test.tsx
@@ -226,8 +226,16 @@ describe('GroupKeySelect', () => {
const snack = await screen.findByText(snackLabel)
await userEvent.hover(snack)
- expect(await screen.findByText(expectedKeyInCard)).toBeInTheDocument()
- expect(await screen.findByText(/First seen:/)).toBeInTheDocument()
+ // Wrap in a single waitFor so both assertions pass atomically — the
+ // tooltip can briefly remount when the groups list finishes loading
+ // (300ms debounce) and swaps GroupKeyFilterTooltip for GroupInfoCard.
+ await waitFor(
+ () => {
+ expect(screen.getByText(expectedKeyInCard)).toBeInTheDocument()
+ expect(screen.getByText(/First seen:/)).toBeInTheDocument()
+ },
+ { timeout: 3000 }
+ )
}
)
@@ -249,7 +257,12 @@ describe('GroupKeySelect', () => {
const option = await screen.findByText('Bitfusion PR LLC')
await userEvent.hover(option)
- expect(await screen.findByText('uuid-002')).toBeInTheDocument()
- expect(await screen.findByText(/First seen:/)).toBeInTheDocument()
+ await waitFor(
+ () => {
+ expect(screen.getByText('uuid-002')).toBeInTheDocument()
+ expect(screen.getByText(/First seen:/)).toBeInTheDocument()
+ },
+ { timeout: 3000 }
+ )
})
})