From d10fdbfa79f26272d4e5fa71ac752de015d10de1 Mon Sep 17 00:00:00 2001 From: "Molecule AI Dev Engineer A (Kimi)" Date: Sat, 13 Jun 2026 03:54:17 +0000 Subject: [PATCH] test(e2e): wait for visible chat-panel instead of fixed 10s sleep (core#2699) The mobile chat E2E used a fixed 10s waitForSelector for the chat-panel, which raced app hydration / mobile shell render and flaked. Replace it with a proper wait-for-condition on the actual readiness signal: the chat-panel must be :visible inside the mobile shell (mirrors the desktop chat suite's #panel-chat [data-testid='chat-panel']:visible pattern). Also raise the timeout to 15s to cover slower cold-start hydration. Fixes #2699 --- canvas/e2e/chat-mobile.spec.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/canvas/e2e/chat-mobile.spec.ts b/canvas/e2e/chat-mobile.spec.ts index d51a6fc9..e4eb86ac 100644 --- a/canvas/e2e/chat-mobile.spec.ts +++ b/canvas/e2e/chat-mobile.spec.ts @@ -28,7 +28,10 @@ test.describe("MobileChat", () => { await page.setViewportSize({ width: 375, height: 812 }); // Navigate directly to the mobile chat view. await page.goto(`/?m=chat&a=${workspaceId}`); - await page.waitForSelector("[data-testid='chat-panel']", { timeout: 10_000 }); + // Wait for the actual readiness signal: the chat-panel must be visible + // inside the mobile shell (not just in the DOM). This replaces the + // previous fixed 10s wait that raced app hydration. + await page.waitForSelector("[data-testid='chat-panel']:visible", { timeout: 15_000 }); // Wait for the workspace status to flip to online and the textarea to be enabled. await expect(page.locator("textarea").first()).toBeEnabled({ timeout: 15_000 }); // Dismiss onboarding guide if present. @@ -75,7 +78,7 @@ test.describe("MobileChat", () => { { timeout: 15_000 }, ); await page.reload(); - await page.waitForSelector("[data-testid='chat-panel']", { timeout: 10_000 }); + await page.waitForSelector("[data-testid='chat-panel']:visible", { timeout: 15_000 }); await historyResponse; await expect(page.getByText("Mobile persistence", { exact: true })).toBeVisible(); -- 2.52.0