A Playwright test waits for the network to be idle, which is slow and unreliable
What it finds
networkidle waits until no request has been made for half a second. Pages that poll, stream or load analytics never get there, and others get there at varying times, so tests become slow and flaky. Waiting for the element or response the test needs is reliable.
Reported are waitForLoadState("networkidle") and options with waitUntil: "networkidle".
From the rule's source, quiet_network_wait.rs.
declare const page: any;it("loads", async () => { await page.goto("/", { waitUntil: "networkidle" });tx0 reports: waiting for an idle network await page.goto("/");}); Turn it on, off or suppress it
The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/ts:quiet-network-wait" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/ts:quiet-network-wait] reason="..."tx0 explain tx0/ts:quiet-network-wait shows the same in the terminal. Found a false positive? Report it.