playwright icon indicating copy to clipboard operation
playwright copied to clipboard

chore: make input actions "strict" in terms of timeout/abort

Open dgozman opened this issue 7 months ago • 1 comments

This introduces a "strict" mode to Progress, where it waits until the action completes instead of racing against a timeout.

The action is responsible to terminate upon progress being aborted. The "rule of thumb" is - whenever a method accepts a progress, it must either succeed before the progress aborts or throw an error.

To support this new scheme, some new APIs have been added to the progress:

  • race() to race any promise against the abort. Useful for things like evaluate() that do not change the state of the page, or single protocol commands. Many places now use this method to ensure they terminate when the progress is aborted.
  • raceWithCleanup() that combines race() and cleanupWhenAborted().
  • wait() that waits for a timeout, but is aware of progress abort.

References #35987.

dgozman avatar Jun 12 '25 15:06 dgozman

Test results for "tests 1"

4 flaky :warning: [chromium-library] › library/chromium/oopif.spec.ts:284:3 › should click @chromium-ubuntu-22.04-node20
:warning: [firefox-library] › library/inspector/cli-codegen-1.spec.ts:986:7 › cli codegen › should not throw csp directive violation errors @firefox-ubuntu-22.04-node18
:warning: [webkit-library] › library/video.spec.ts:441:5 › screencast › should work for popups @webkit-ubuntu-22.04-node18
:warning: [playwright-test] › ui-mode-test-watch.spec.ts:145:5 › should watch all @windows-latest-node18-1

39367 passed, 820 skipped :heavy_check_mark::heavy_check_mark::heavy_check_mark:

Merge workflow run.

github-actions[bot] avatar Jun 12 '25 16:06 github-actions[bot]