From 3c35d7b058a53704a3b0a3f60f416f886ccd6e4a Mon Sep 17 00:00:00 2001 From: Pavel Feldman Date: Fri, 6 Mar 2020 16:24:21 -0800 Subject: [PATCH] api(waitFor): click(waitFor) -> click(force) (#1275) --- docs/api.md | 118 ++++++++++++++++++------ src/dom.ts | 32 +++---- src/frames.ts | 91 ++++++++---------- src/page.ts | 22 ++--- src/types.ts | 8 +- test/click.spec.js | 16 +--- test/elementhandle.spec.js | 6 +- test/page.spec.js | 4 +- utils/doclint/check_public_api/index.js | 2 + 9 files changed, 166 insertions(+), 133 deletions(-) diff --git a/docs/api.md b/docs/api.md index f95eeaf846..82c25aaec1 100644 --- a/docs/api.md +++ b/docs/api.md @@ -913,7 +913,11 @@ Shortcut for [page.mainFrame().addStyleTag(options)](#frameaddstyletagoptions). #### page.check(selector, [options]) - `selector` <[string]> A selector to search for checkbox or radio button to check. If there are multiple elements satisfying the selector, the first will be checked. - `options` <[Object]> - - `waitFor` <[boolean]> Whether to wait for the element to be present in the dom and displayed (for example, no `display:none`), stop moving (for example, wait until css transition finishes) and potentially receive pointer events at the click point (for example, wait until element becomes non-obscured by other elements). Defaults to `true`. + - `force` <[boolean]> Whether to bypass the actionability checks. By default actions wait until the element is: + - displayed (for example, no `display:none`), + - is not moving (for example, waits until css transition finishes), + - receives pointer events at the action point (for example, waits until element becomes non-obscured by other elements). + Even if the action is forced, it will wait for the element matching selector to be in DOM. Defaults to `false`. - `waitUntil` <"commit"|"load"|"domcontentloaded"|"networkidle0"|"networkidle2"|"nowait"> Actions that cause navigations are waiting for those navigations to `commit` by default. This behavior can be changed to either wait for another load phase or to omit the waiting altogether using `nowait`: - `'commit'` - navigation is committed, new url is displayed in the browser address bar. - `'load'` - consider navigation to be finished when the `load` event is fired. @@ -939,7 +943,11 @@ Shortcut for [page.mainFrame().check(selector[, options])](#framecheckselector-o - x <[number]> - y <[number]> - `modifiers` <[Array]<"Alt"|"Control"|"Meta"|"Shift">> Modifier keys to press. Ensures that only these modifiers are pressed during the click, and then restores current modifiers back. If not specified, currently pressed modifiers are used. - - `waitFor` <[boolean]> Whether to wait for the element to be present in the dom and displayed (for example, no `display:none`), stop moving (for example, wait until css transition finishes) and potentially receive pointer events at the click point (for example, wait until element becomes non-obscured by other elements). Defaults to `true`. + - `force` <[boolean]> Whether to bypass the actionability checks. By default actions wait until the element is: + - displayed (for example, no `display:none`), + - is not moving (for example, waits until css transition finishes), + - receives pointer events at the action point (for example, waits until element becomes non-obscured by other elements). + Even if the action is forced, it will wait for the element matching selector to be in DOM. Defaults to `false`. - `waitUntil` <"commit"|"load"|"domcontentloaded"|"networkidle0"|"networkidle2"|"nowait"> Actions that cause navigations are waiting for those navigations to `commit` by default. This behavior can be changed to either wait for another load phase or to omit the waiting altogether using `nowait`: - `'commit'` - navigation is committed, new url is displayed in the browser address bar. - `'load'` - consider navigation to be finished when the `load` event is fired. @@ -994,7 +1002,11 @@ Browser-specific Coverage implementation, only available for Chromium atm. See [ - x <[number]> - y <[number]> - `modifiers` <[Array]<"Alt"|"Control"|"Meta"|"Shift">> Modifier keys to press. Ensures that only these modifiers are pressed during the double click, and then restores current modifiers back. If not specified, currently pressed modifiers are used. - - `waitFor` <[boolean]> Whether to wait for the element to be present in the dom and displayed (for example, no `display:none`), stop moving (for example, wait until css transition finishes) and potentially receive pointer events at the click point (for example, wait until element becomes non-obscured by other elements). Defaults to `true`. + - `force` <[boolean]> Whether to bypass the actionability checks. By default actions wait until the element is: + - displayed (for example, no `display:none`), + - is not moving (for example, waits until css transition finishes), + - receives pointer events at the action point (for example, waits until element becomes non-obscured by other elements). + Even if the action is forced, it will wait for the element matching selector to be in DOM. Defaults to `false`. - `waitUntil` <"commit"|"load"|"domcontentloaded"|"networkidle0"|"networkidle2"|"nowait"> Actions that cause navigations are waiting for those navigations to `commit` by default. This behavior can be changed to either wait for another load phase or to omit the waiting altogether using `nowait`: - `'commit'` - navigation is committed, new url is displayed in the browser address bar. - `'load'` - consider navigation to be finished when the `load` event is fired. @@ -1173,7 +1185,6 @@ const fs = require('fs'); - `selector` <[string]> A selector to query page for. - `value` <[string]> Value to fill for the ``, `