Skip to content

Commit f1772f9

Browse files
committed
test(ui): stabilize control UI e2e timing
1 parent 889d8ba commit f1772f9

2 files changed

Lines changed: 14 additions & 10 deletions

File tree

‎ui/src/e2e/board-fixture.e2e.test.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,13 +279,14 @@ describeStandaloneMockServer("standalone Control UI mock server", () => {
279279
try {
280280
await page.goto(new URL("/chat", fixtureServer.url).toString(), { waitUntil: "networkidle" });
281281
await page.getByText("OpenClaw work checkout", { exact: true }).click();
282+
await page.getByRole("button", { name: "Write a message to send." }).waitFor();
282283

283284
const prompt = "generic mock send probe";
284285
const composer = page.locator(
285286
".chat-pane-cache__pane--active .agent-chat__composer-combobox textarea",
286287
);
287288
await composer.fill(prompt);
288-
await composer.press("Enter");
289+
await page.getByRole("button", { name: "Send message" }).click();
289290

290291
await page
291292
.locator(".chat-thread-inner")

‎ui/src/e2e/chat-image-lightbox.e2e.test.ts‎

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { mkdir, readFile } from "node:fs/promises";
22
import path from "node:path";
3-
import { chromium, type Browser, type BrowserContext } from "playwright";
3+
import { chromium, type Browser, type BrowserContext, type Page } from "playwright";
44
import { afterAll, afterEach, beforeAll, describe, expect, it } from "vitest";
55
import {
66
canRunPlaywrightChromium,
@@ -33,6 +33,15 @@ async function closeContext(context: BrowserContext) {
3333
await context.close().catch(() => {});
3434
}
3535

36+
async function waitForLightboxAnimations(page: Page): Promise<void> {
37+
await page.locator("openclaw-image-lightbox wa-dialog").evaluate(async (dialogAdapter) => {
38+
const nativeDialog = dialogAdapter.shadowRoot?.querySelector("dialog");
39+
await Promise.all(
40+
(nativeDialog?.getAnimations({ subtree: true }) ?? []).map((animation) => animation.finished),
41+
);
42+
});
43+
}
44+
3645
describeControlUiE2e("Control UI image lightbox", () => {
3746
beforeAll(async () => {
3847
if (!chromiumAvailable) {
@@ -156,6 +165,7 @@ describeControlUiE2e("Control UI image lightbox", () => {
156165
),
157166
)
158167
.toBeGreaterThan(0);
168+
await waitForLightboxAnimations(page);
159169
const desktopBox = await page.locator("openclaw-image-lightbox .lightbox").boundingBox();
160170
expect(desktopBox?.width ?? 0).toBeGreaterThan(1000);
161171
expect(desktopBox?.height ?? 0).toBeGreaterThan(700);
@@ -213,14 +223,7 @@ describeControlUiE2e("Control UI image lightbox", () => {
213223
await page.setViewportSize({ height: 844, width: 390 });
214224
await sidebarTrigger.click();
215225
await sidebarDialog.waitFor({ state: "visible" });
216-
await page.locator("openclaw-image-lightbox wa-dialog").evaluate(async (dialogAdapter) => {
217-
const nativeDialog = dialogAdapter.shadowRoot?.querySelector("dialog");
218-
await Promise.all(
219-
(nativeDialog?.getAnimations({ subtree: true }) ?? []).map(
220-
(animation) => animation.finished,
221-
),
222-
);
223-
});
226+
await waitForLightboxAnimations(page);
224227
const mobileBox = await page.locator("openclaw-image-lightbox .lightbox").boundingBox();
225228
const mobileImageLayout = await page
226229
.locator("openclaw-image-lightbox .stage")

0 commit comments

Comments
 (0)