From 8cace0d9b5a9fb00b3bb9f67defccbbca12962ef Mon Sep 17 00:00:00 2001 From: Philipp Spiess Date: Mon, 12 Aug 2024 12:44:26 +0200 Subject: [PATCH] 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. --- packages/tailwindcss/tests/ui.spec.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/tailwindcss/tests/ui.spec.ts b/packages/tailwindcss/tests/ui.spec.ts index 84630ae6b..c43bf3d07 100644 --- a/packages/tailwindcss/tests/ui.spec.ts +++ b/packages/tailwindcss/tests/ui.spec.ts @@ -305,6 +305,14 @@ async function render(page: Page, content: string) { } `) + // 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. + content = `
${content}` + await page.setContent(content) await page.addStyleTag({ content: optimizeCss( @@ -312,6 +320,8 @@ async function render(page: Page, content: string) { ), }) + await page.locator('#mouse-park').hover() + return { getPropertyValue(selector: string | [string, string], property: string) { return getPropertyValue(