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(playwright): make selectDateRange verify the range applied (#62904)

Sam Penningtonf536d09ecb17
diff --git a/playwright/page-models/insights/stickinessInsight.ts b/playwright/page-models/insights/stickinessInsight.ts
index 348149d08df2..cc90ed695545 100644
--- a/playwright/page-models/insights/stickinessInsight.ts
+++ b/playwright/page-models/insights/stickinessInsight.ts
@@ -70,6 +70,9 @@ export class StickinessInsight extends ChartInsightBase {
await expect(async () => {
await this.dateRangeButton.click({ timeout: 500 })
await this.page.getByTestId(dataAttr).click({ timeout: 500 })
+ // Verify the selection actually applied — an edit-mode remount can
+ // swallow the click, leaving the old range. Retry the whole open+click.
+ await expect(this.dateRangeButton).toContainText(text, { timeout: 1000 })
}).toPass({ timeout: 15000 })
await this.waitForChart()
}
diff --git a/playwright/page-models/insights/trendsInsight.ts b/playwright/page-models/insights/trendsInsight.ts
index 41d8a60e87c1..045cad748094 100644
--- a/playwright/page-models/insights/trendsInsight.ts
+++ b/playwright/page-models/insights/trendsInsight.ts
@@ -149,6 +149,9 @@ export class TrendsInsight extends ChartInsightBase {
await expect(async () => {
await this.dateRangeButton.click({ timeout: 500 })
await this.page.getByTestId(dataAttr).click({ timeout: 500 })
+ // Verify the selection actually applied — an edit-mode remount can
+ // swallow the click, leaving the old range. Retry the whole open+click.
+ await expect(this.dateRangeButton).toContainText(text, { timeout: 1000 })
}).toPass({ timeout: 15000 })
await this.waitForChart()
}