From 31460b18b8ac067465c1ef40548101e3dcf2242a Mon Sep 17 00:00:00 2001 From: Andrey Lushnikov Date: Thu, 16 Apr 2020 18:46:10 -0700 Subject: [PATCH] Revert "api(waitUntil): remove waitUntil options from the actions (#1834)" (#1840) This reverts commit d0b8710670cd6dddb03fbd8444fa90d7e838876a. Reason: multiple test failures on all Linux bots - https://app.circleci.com/pipelines/github/microsoft/playwright/613/workflows/50dc6e2d-23b0-41d2-9765-42983b0ed91d/jobs/610 - https://travis-ci.com/github/microsoft/playwright/builds/160648417 - https://github.com/microsoft/playwright/pull/1839/checks?check_run_id=594015893 --- docs/api.md | 196 +++++++++++++++++++++++++++++++++------ src/dom.ts | 2 +- src/frames.ts | 16 ++-- src/types.ts | 7 +- test/autowaiting.spec.js | 43 +++++---- 5 files changed, 200 insertions(+), 64 deletions(-) diff --git a/docs/api.md b/docs/api.md index c238b01d87..7074290214 100644 --- a/docs/api.md +++ b/docs/api.md @@ -948,7 +948,12 @@ Shortcut for [page.mainFrame().addStyleTag(options)](#frameaddstyletagoptions). - 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`. - - `noWaitAfter` <[boolean]> Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`. + - `waitUntil` <"load"|"domcontentloaded"|"networkidle0"|"networkidle2"|"nowait"> Actions that cause navigations are waiting for those navigations to fire `domcontentloaded` by default. This behavior can be changed to either wait for another load phase or to omit the waiting altogether using `nowait`: + - `'domcontentloaded'` - consider navigation to be finished when the `DOMContentLoaded` event is fired. + - `'load'` - consider navigation to be finished when the `load` event is fired. + - `'networkidle0'` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms. + - `'networkidle2'` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms. + - `'nowait'` - do not wait. - `timeout` <[number]> Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods. - returns: <[Promise]> Promise which resolves when the element matching `selector` is successfully checked. The Promise will be rejected if there is no element matching `selector`. @@ -972,7 +977,12 @@ Shortcut for [page.mainFrame().check(selector[, options])](#framecheckselector-o - 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`. - - `noWaitAfter` <[boolean]> Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`. + - `waitUntil` <"load"|"domcontentloaded"|"networkidle0"|"networkidle2"|"nowait"> Actions that cause navigations are waiting for those navigations to fire `domcontentloaded` by default. This behavior can be changed to either wait for another load phase or to omit the waiting altogether using `nowait`: + - `'domcontentloaded'` - consider navigation to be finished when the `DOMContentLoaded` event is fired. + - `'load'` - consider navigation to be finished when the `load` event is fired. + - `'networkidle0'` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms. + - `'networkidle2'` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms. + - `'nowait'` - do not wait. - `timeout` <[number]> Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods. - returns: <[Promise]> Promise which resolves when the element matching `selector` is successfully clicked. The Promise will be rejected if there is no element matching `selector`. @@ -1025,7 +1035,12 @@ Browser-specific Coverage implementation, only available for Chromium atm. See [ - 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`. - - `noWaitAfter` <[boolean]> Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`. + - `waitUntil` <"load"|"domcontentloaded"|"networkidle0"|"networkidle2"|"nowait"> Actions that cause navigations are waiting for those navigations to fire `domcontentloaded` by default. This behavior can be changed to either wait for another load phase or to omit the waiting altogether using `nowait`: + - `'domcontentloaded'` - consider navigation to be finished when the `DOMContentLoaded` event is fired. + - `'load'` - consider navigation to be finished when the `load` event is fired. + - `'networkidle0'` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms. + - `'networkidle2'` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms. + - `'nowait'` - do not wait. - `timeout` <[number]> Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods. - returns: <[Promise]> Promise which resolves when the element matching `selector` is successfully double clicked. The Promise will be rejected if there is no element matching `selector`. @@ -1197,7 +1212,12 @@ const fs = require('fs'); - `selector` <[string]> A selector to query page for. - `value` <[string]> Value to fill for the ``, `