Skip to content

πŸ™Œ OpenHands: AI-Driven Development

test: deflake mock-LLM Docker CSS-scope regression test (#1643)

Hiep Le133d8d94940f
diff --git a/tests/e2e/mock-llm/regressions/mock-llm-ui-regressions.spec.ts b/tests/e2e/mock-llm/regressions/mock-llm-ui-regressions.spec.ts
index 997b9c7021..6ee6378e77 100644
--- a/tests/e2e/mock-llm/regressions/mock-llm-ui-regressions.spec.ts
+++ b/tests/e2e/mock-llm/regressions/mock-llm-ui-regressions.spec.ts
@@ -375,6 +375,20 @@ test.describe("UI regressions", () => {
const layout = page.getByTestId("root-layout");
await expect(layout).toBeVisible();
+ // The scoped background comes from the built stylesheet. In this SPA
+ // build (`ssr: false`) `root-layout` can be visible β€” it only needs
+ // geometry β€” a frame before the global CSS <link> lands in the CSSOM,
+ // so a single read can catch the unstyled first paint as a transient
+ // "rgba(0, 0, 0, 0)". The window is widest under the resource-starved
+ // Docker E2E runner, where this test flaked. Poll until the scoped
+ // styles resolve before asserting.
+ await expect
+ .poll(
+ () => shell.evaluate((el) => getComputedStyle(el).backgroundColor),
+ { timeout: 15_000 },
+ )
+ .not.toBe("rgba(0, 0, 0, 0)");
+
const insideBackground = await shell.evaluate(
(el) => getComputedStyle(el).backgroundColor,
);