Skip to content

Commit 3ff4ec2

Browse files
chore: make less test less flaky (#3417)
1 parent ae3db58 commit 3ff4ec2

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

packages/fresh/tests/partials_test.tsx

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2347,19 +2347,25 @@ Deno.test({
23472347
assertMetaContent(doc, "og:foo", "og value foo");
23482348
assertMetaContent(doc, "og:bar", "og value bar");
23492349

2350-
const color = await page
2351-
.locator<HTMLHeadingElement>("h1")
2352-
.evaluate((el) => {
2353-
return globalThis.getComputedStyle(el).color;
2354-
});
2355-
expect(color).toEqual("rgb(255, 0, 0)");
2350+
await waitFor(async () => {
2351+
const color = await page
2352+
.locator<HTMLHeadingElement>("h1")
2353+
.evaluate((el) => {
2354+
return globalThis.getComputedStyle(el).color;
2355+
});
2356+
expect(color).toEqual("rgb(255, 0, 0)");
2357+
return true;
2358+
});
23562359

2357-
const textColor = await page
2358-
.locator<HTMLParagraphElement>("p")
2359-
.evaluate((el) => {
2360-
return globalThis.getComputedStyle(el).color;
2361-
});
2362-
expect(textColor).toEqual("rgb(0, 128, 0)");
2360+
await waitFor(async () => {
2361+
const textColor = await page
2362+
.locator<HTMLParagraphElement>("p")
2363+
.evaluate((el) => {
2364+
return globalThis.getComputedStyle(el).color;
2365+
});
2366+
expect(textColor).toEqual("rgb(0, 128, 0)");
2367+
return true;
2368+
});
23632369
});
23642370
},
23652371
});

0 commit comments

Comments
 (0)