Skip to content

Commit 8cace0d

Browse files
Retry UI test assertions (#14165)
We noticed that some of the tests depending on the `hover:` variant were flaky. After some investigation, we found that injected elements had the `:hover` state without us explicitly hovering over the element. To avoid this, we now set up an explicit placeholder element to move the mouse to before running the tests.
1 parent fbf877a commit 8cace0d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

packages/tailwindcss/tests/ui.spec.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,13 +305,23 @@ async function render(page: Page, content: string) {
305305
}
306306
`)
307307

308+
// We noticed that some of the tests depending on the `hover:` variant were
309+
// flaky. After some investigation, we found that injected elements had the
310+
// `:hover` state without us explicitly hovering over the element.
311+
//
312+
// To avoid this, we now set up an explicit placeholder element to move the
313+
// mouse to before running the tests.
314+
content = `<div id="mouse-park" class="size-12"></div>${content}`
315+
308316
await page.setContent(content)
309317
await page.addStyleTag({
310318
content: optimizeCss(
311319
build(scanFiles([{ content, extension: 'html' }], IO.Sequential | Parsing.Sequential)),
312320
),
313321
})
314322

323+
await page.locator('#mouse-park').hover()
324+
315325
return {
316326
getPropertyValue(selector: string | [string, string], property: string) {
317327
return getPropertyValue(

0 commit comments

Comments
 (0)