Skip to content

Commit e24e768

Browse files
committed
Tests: Flaky [autofocus] assertions
Playwright will retry the [toBeFocused][] assertions for 5,000ms by [default][]. [toBeFocused]: https://playwright.dev/docs/test-assertions#auto-retrying-assertions [default]: https://playwright.dev/docs/test-timeouts
1 parent cf0c68f commit e24e768

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/tests/functional/autofocus_tests.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ test("receiving a Turbo Stream message with an [autofocus] element when the acti
4848
</turbo-stream>
4949
`)
5050
})
51-
await expect(page.locator("#autofocus-from-stream")).toBeFocused({ timeout: 200 })
51+
await expect(page.locator("#autofocus-from-stream")).toBeFocused()
5252
})
5353

5454
test("autofocus from a Turbo Stream message does not leak a placeholder [id]", async ({ page }) => {
@@ -61,7 +61,7 @@ test("autofocus from a Turbo Stream message does not leak a placeholder [id]", a
6161
`)
6262
})
6363

64-
await expect(page.locator("#container-from-stream input")).toBeFocused({ timeout: 200 })
64+
await expect(page.locator("#container-from-stream input")).toBeFocused()
6565

6666
})
6767

@@ -87,9 +87,7 @@ test("don't focus on [autofocus] elements on page refreshes with morphing", asyn
8787
await expect(button).toBeFocused()
8888
await expect(input).not.toBeFocused()
8989

90-
await page.evaluate(() => {
91-
document.querySelector("#form").requestSubmit()
92-
})
90+
await page.locator("#form").evaluate((form) => form.requestSubmit())
9391

9492
await nextEventNamed(page, "turbo:render", { renderMethod: "morph" })
9593
await nextPageRefresh(page)

0 commit comments

Comments
 (0)