From 6491e5b415a7abc72706450f463286277db7fd1f Mon Sep 17 00:00:00 2001 From: Dmitry Gozman Date: Thu, 18 Jul 2024 00:19:08 -0700 Subject: [PATCH] chore: deprecate/remove noWaitAfter from some actions (#31739) The following actions keep `noWaitAfter` option: `click`, `selectOption` and `press`. All other actions that used to have `noWaitAfter` now behave like it was set to true, not waiting for follow-up navigations. In the docs, this option is marked as completely ignored. A small logic change was made to compensate for this behavior: when waiting for the `hitTargetInterceptor`, we now race it against navigations to avoid stalling when navigation stalls. Previously, waiting for the interceptor was disabled when `noWaitAfter` was passed, and since it's impossible to pass this option now, we mitigate by never stalling instead. Fixes #31469. --- docs/src/api/class-elementhandle.md | 25 +- docs/src/api/class-filechooser.md | 2 +- docs/src/api/class-frame.md | 26 +- docs/src/api/class-locator.md | 31 +-- docs/src/api/class-page.md | 27 +- docs/src/api/params.md | 7 + .../playwright-core/src/protocol/validator.ts | 17 -- packages/playwright-core/src/server/dom.ts | 163 +++++------ packages/playwright-core/src/server/frames.ts | 35 +-- packages/playwright-core/src/server/types.ts | 8 +- packages/playwright-core/types/types.d.ts | 253 +++++++----------- packages/protocol/src/channels.ts | 34 --- packages/protocol/src/protocol.yml | 17 -- tests/library/tap.spec.ts | 27 +- tests/page/locator-misc-1.spec.ts | 10 - tests/page/page-autowaiting-basic.spec.ts | 4 +- tests/page/page-mouse.spec.ts | 10 - 17 files changed, 258 insertions(+), 438 deletions(-) diff --git a/docs/src/api/class-elementhandle.md b/docs/src/api/class-elementhandle.md index 24b8bb2b6f..1793798c8c 100644 --- a/docs/src/api/class-elementhandle.md +++ b/docs/src/api/class-elementhandle.md @@ -164,7 +164,6 @@ This method checks the element by performing the following steps: 1. Wait for [actionability](../actionability.md) checks on the element, unless [`option: force`] option is set. 1. Scroll the element into view if needed. 1. Use [`property: Page.mouse`] to click in the center of the element. -1. Wait for initiated navigations to either succeed or fail, unless [`option: noWaitAfter`] option is set. 1. Ensure that the element is now checked. If not, this method throws. If the element is detached from the DOM at any moment during the action, this method throws. @@ -178,7 +177,7 @@ When all steps combined have not finished during the specified [`option: timeout ### option: ElementHandle.check.force = %%-input-force-%% * since: v1.8 -### option: ElementHandle.check.noWaitAfter = %%-input-no-wait-after-%% +### option: ElementHandle.check.noWaitAfter = %%-input-no-wait-after-removed-%% * since: v1.8 ### option: ElementHandle.check.timeout = %%-input-timeout-%% @@ -251,8 +250,6 @@ This method double clicks the element by performing the following steps: 1. Wait for [actionability](../actionability.md) checks on the element, unless [`option: force`] option is set. 1. Scroll the element into view if needed. 1. Use [`property: Page.mouse`] to double click in the center of the element, or the specified [`option: position`]. -1. Wait for initiated navigations to either succeed or fail, unless [`option: noWaitAfter`] option is set. Note that - if the first click of the `dblclick()` triggers a navigation event, this method will throw. If the element is detached from the DOM at any moment during the action, this method throws. @@ -278,7 +275,7 @@ When all steps combined have not finished during the specified [`option: timeout ### option: ElementHandle.dblclick.force = %%-input-force-%% * since: v1.8 -### option: ElementHandle.dblclick.noWaitAfter = %%-input-no-wait-after-%% +### option: ElementHandle.dblclick.noWaitAfter = %%-input-no-wait-after-removed-%% * since: v1.8 ### option: ElementHandle.dblclick.timeout = %%-input-timeout-%% @@ -537,7 +534,7 @@ Value to set for the ``, `