Repository navigation
Conversation
withKeyDown() holds a key down, runs its callback (which performs its own actions), then releases the key. Routed through Execution::waitForExpectation(), an attempt that overruns the fixed 1000 ms budget is retried, so the key is held and the callback's actions replay a second time. This is the one mutating action still missing from $nonAwaitableMethods after pestphp#269 took out click/press/drag/keys/append and the navigation methods. A single direct call gets Playwright's actionability wait on the whole configured timeout. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
withKeyDown()is the one mutating action still routed throughExecution::waitForExpectation(). It holds a key down, runs its callback (which performs its own actions), then releases the key. When an attempt overruns the fixed 1000 ms per-attempt budget, the loop retries it — so the key is held and the callback's actions replay a second time.#269 took the other state-changing actions out of
$nonAwaitableMethods(click,rightClick,press,pressAndWaitFor,keys,drag,append), and the navigation methods (navigate,refresh,back,forward) followed.withKeyDownis the one left. This adds it, so a single direct call gets Playwright's actionability wait on the whole configured timeout instead of a retried one-second attempt. It closes the remaining gap from #249 (the rest of that PR is already covered by #269).The fixed-1000 ms-per-attempt root cause for whatever legitimately stays in the loop (e.g.
submit) is a separate concern, tracked in #276.Test
tests/Browser/Webpage/WithKeyDownRetryTest.phpmakes the first attempt overrun 1000 ms on a busy main thread, then asserts the callback ran once. On5.xit fails (window.pressesis 2); with this change it passes (repeat(3), 3/3).