Menu

Post image 1
Post image 2
1 / 2
0

Testing a LiveView App with Playwright: Fixing Navigation Timeouts

DEV Community: elixir·Jeff Thoensen·3 days ago
#lS2h7Wx3
Reading 0:00
15s threshold

I was building a Playwright suite against a Phoenix LiveView app for the first time. Tests ran fine in isolation. Overnight, the full suite timed out across the board. Every failure was in a navigation. What Playwright Waits For by Default When you call page.goto() or trigger a navigation through a click, Playwright waits for the load event before moving on. That assumes a traditional request/response cycle: the browser makes a request, the server returns a full HTML document, the browser fires load when everything is done. LiveView doesn't do that. Navigation happens over a persistent WebSocket connection. The URL changes, the page updates, but there's no new document and no load event in the way Playwright expects. So Playwright waits, hits the timeout, and the test fails. The Fix: waitUntil commit The waitUntil option controls what signal Playwright waits for before continuing.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More