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(e2e): wait for save button to be enabled before clicking in InsightPage.save() (#62188)

mendral-app[bot]8f3e0f5ccae2
diff --git a/playwright/page-models/insightPage.ts b/playwright/page-models/insightPage.ts
index f83ebcbababb..68e8e49f5bf5 100644
--- a/playwright/page-models/insightPage.ts
+++ b/playwright/page-models/insightPage.ts
@@ -92,11 +92,15 @@ export class InsightPage {
async save(): Promise<void> {
const originalUrl = this.page.url()
const originalPathname = new URL(originalUrl).pathname
+
+ // Wait for any in-progress query to finish — the save button uses aria-disabled while queries run
+ await expect(this.saveButton).not.toHaveAttribute('aria-disabled', 'true', { timeout: 60000 })
+
const saveRequestPromise = this.page.waitForResponse(
(response) =>
/\/api\/(?:projects|environments)\/\d+\/insights(?:\/\d+)?\/?(?:\?.*)?$/.test(response.url()) &&
['POST', 'PATCH'].includes(response.request().method()),
- { timeout: 60000 }
+ { timeout: 30000 }
)
await this.saveButton.click()