Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

fix(spaces): wait for the onboarding keycaps to load before checking their pixels (#6467)

injaneityc0fd580166e3
diff --git a/apps/cua-spaces-web/e2e/onboarding-keys.spec.ts b/apps/cua-spaces-web/e2e/onboarding-keys.spec.ts
index d9e5e67bc1..bcf91b2c51 100644
--- a/apps/cua-spaces-web/e2e/onboarding-keys.spec.ts
+++ b/apps/cua-spaces-web/e2e/onboarding-keys.spec.ts
@@ -20,7 +20,9 @@ for (const [width, height] of [[720, 560], [980, 660], [1200, 780]] as const) {
await expect(keys).toHaveCount(2);
for (const key of await keys.all()) {
await expect(key).toBeVisible();
- expect(await key.evaluate((i: HTMLImageElement) => i.complete && i.naturalWidth > 0)).toBe(true);
+ // Visible is not loaded: the image can still be fetching when it lays out, so wait for its
+ // pixels. A broken image fails the visible check above and never gets a width here.
+ await expect.poll(() => key.evaluate((i: HTMLImageElement) => i.complete && i.naturalWidth > 0)).toBe(true);
}
// The keys sit beside the words, never over them.
const words = await page.locator("[data-onboarding-heading]").boundingBox();