Repository navigation
Conversation
|
I'm also running into this same issue. I hope this PR gets reviewed soon |
|
I am also running into this issue. |
|
Same. Feels like this plugin is a bit forgotten. But hope someone will be allowed to help nuno with through PRs to keep the momentum of this awesome plugin going. |
|
Independent confirmation of the symptom, on a suite unrelated to this repository. The One observation that may help whoever reviews this: the failing-test-name drift makes the bug easy to misfile. On that suite it had been sitting in a quarantine group, understood as "flaky application code", because nothing about the symptom points at the transport — the test fails before it asserts anything, so there is no assertion to blame, and re-running moves the failure elsewhere. A second, unrelated thing that makes this class of bug slower to diagnose than it should be: the original exception does not survive a browser failure. Nothing to add on the fix itself — skipping frames whose (Edited: an earlier version of this comment claimed the reported line need not be the throwing call. That was wrong — I had measured it inside a checkout of the plugin itself, where its frames are not filtered as vendor code. In a normal project the line is correct; the loss is the original exception, not the location.) |
|
Follow-up, on how this sits next to #266 — both change the same loop, so I applied them together on top of They apply cleanly in either order and do not conflict. Combined, the loop skips frames whose Measured on PHP 8.4.24 / Playwright 1.62.1 / Chromium, Linux:
I also spent a while trying to reproduce the stranded-frame symptom at the browser level — a test that deliberately leaves a navigation unsettled when it ends, followed by a clean test — and could not get it to fail on demand. The unit stub here is the reliable formulation. |
|
Independent confirmation from a project running ~1,500 browser tests in parallel (6 processes):
Correction to an earlier version of this comment: we applied exactly this change locally (skip frames whose |
75121c8 to
171e3ab
Compare
|
@theseekeroftrue Your diagnosis matches what I measured earlier: skipping stale frames (this PR) and awaiting the matching navigation response (#266) are two halves of one rule, not competing fixes. The regressions you saw with this PR applied — #266 merged into (The lost-original-exception aside from my earlier comment is resolved separately — #268, merged 24 Sep.) |
Summary
Client::execute()processes every frame it reads, including response frames whoseidbelongs to another request. A response stays in the websocket buffer when a caller stops reading the generator before the response arrives. The nextexecute()call then reads it.#266 removed the main source of these frames: the
waitUntilearly break that leftgoto()responses unread (pestphp/pest#1759). Two callers still return early, on the__create__event that arrives before the response:InteractsWithPlaywright::processElementCreationResponse()Page::evaluateHandle(), when the result is aJSHandleThe error check and the callers' result checks do not compare the frame's
idwith the current request. So a stranded frame can give its error or its result to an unrelated command.This PR skips frames whose
idbelongs to another request, before the error check. Event frames have noid, so they are not affected. Error frames for the current request still throw.Refs pestphp/pest#1759. #266 removed its root cause. This PR adds the
idcheck that the issue also asks for.Verification
These runs used v5.0.0, before #266. On the current base,
goto()no longer leaves its response unread, so the table shows the original failure, not the current one.I logged every
sendText/receivewith request ids on a real Laravel browser suite (12 tests). Every staleTargetClosedErrorframe came from an abandonedgoto.Tests
Four unit tests for
Client::execute(), using a stubbedWebsocketConnection:The first two fail on the current 5.x without the
src/change. The last two make sure existing behavior stays the same.AI assistance
Root-cause tracing, fix, and tests: Claude Code (claude-fable-5 + claude-opus-5-5, xhigh).