docs: default timeout in library is 30 seconds

Fixes https://github.com/microsoft/playwright/issues/31306
This commit is contained in:
Yury Semikhatsky 2024-06-13 14:54:59 -07:00
parent f1475fa644
commit 5700b8930a
7 changed files with 238 additions and 236 deletions

View file

@ -1648,7 +1648,7 @@ Event name, same one would pass into `browserContext.on(event)`.
* langs: js
- `optionsOrPredicate` ?<[function]|[Object]>
- `predicate` <[function]> Receives the event data and resolves to truthy value when the waiting should resolve.
- `timeout` ?<[float]> Maximum time to wait for in milliseconds. Defaults to `0` - no timeout. The default value can be changed via `actionTimeout` option in the config, or by using the [`method: BrowserContext.setDefaultTimeout`] method.
- `timeout` ?<[float]> Maximum time to wait for in milliseconds. Defaults to `30000` - 30 seconds (`0` - no timeout in Playwright Test). The default value can be changed via `actionTimeout` option in the config, or by using the [`method: BrowserContext.setDefaultTimeout`] method.
Either a predicate that receives an event or an options object. Optional.

View file

@ -4335,7 +4335,7 @@ frame = event_info.value
* langs: js
- `optionsOrPredicate` ?<[function]|[Object]>
- `predicate` <[function]> Receives the event data and resolves to truthy value when the waiting should resolve.
- `timeout` ?<[float]> Maximum time to wait for in milliseconds. Defaults to `0` - no timeout. The default value can be changed via `actionTimeout` option in the config, or by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.
- `timeout` ?<[float]> Maximum time to wait for in milliseconds. Defaults to `30000` - 30 seconds (`0` - no timeout in Playwright Test). The default value can be changed via `actionTimeout` option in the config, or by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.
Either a predicate that receives an event or an options object. Optional.

View file

@ -86,7 +86,7 @@ Event name, same one would pass into `webSocket.on(event)`.
* langs: js
- `optionsOrPredicate` ?<[function]|[Object]>
- `predicate` <[function]> Receives the event data and resolves to truthy value when the waiting should resolve.
- `timeout` ?<[float]> Maximum time to wait for in milliseconds. Defaults to `0` - no timeout. The default value can be changed via `actionTimeout` option in the config, or by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.
- `timeout` ?<[float]> Maximum time to wait for in milliseconds. Defaults to `30000` - 30 seconds (`0` - no timeout in Playwright Test). The default value can be changed via `actionTimeout` option in the config, or by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.
Either a predicate that receives an event or an options object. Optional.

View file

@ -22,7 +22,7 @@ The default value can be changed by using the
* langs: js
- `timeout` <[float]>
Maximum operation time in milliseconds. Defaults to `0` - no timeout. The default value can be changed via `navigationTimeout` option in the config, or by using the [`method: BrowserContext.setDefaultNavigationTimeout`],
Maximum operation time in milliseconds. Defaults to `30000` - 30 seconds (`0` - no timeout in Playwright Test). The default value can be changed via `navigationTimeout` option in the config, or by using the [`method: BrowserContext.setDefaultNavigationTimeout`],
[`method: BrowserContext.setDefaultTimeout`],
[`method: Page.setDefaultNavigationTimeout`] or
[`method: Page.setDefaultTimeout`] methods.
@ -38,7 +38,7 @@ value can be changed by using the [`method: BrowserContext.setDefaultTimeout`] o
* langs: js
- `timeout` <[float]>
Maximum time to wait for in milliseconds. Defaults to `0` - no timeout. The default value can be changed via `actionTimeout` option in the config, or by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.
Maximum time to wait for in milliseconds. Defaults to `30000` - 30 seconds (`0` - no timeout in Playwright Test). The default value can be changed via `actionTimeout` option in the config, or by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: Page.setDefaultTimeout`] methods.
## input-strict
- `strict` <[boolean]>
@ -58,7 +58,7 @@ using the [`method: BrowserContext.setDefaultTimeout`] or
* langs: js
- `timeout` <[float]>
Maximum time in milliseconds. Defaults to `0` - no timeout. The default value can be changed via `actionTimeout` option in the config, or by using the [`method: BrowserContext.setDefaultTimeout`] or
Maximum time in milliseconds. Defaults to `30000` - 30 seconds (`0` - no timeout in Playwright Test). The default value can be changed via `actionTimeout` option in the config, or by using the [`method: BrowserContext.setDefaultTimeout`] or
[`method: Page.setDefaultTimeout`] methods.
## input-no-wait-after

View file

@ -446,6 +446,7 @@ export class Page extends ChannelOwner<channels.PageChannel> implements api.Page
private async _waitForEvent(event: string, optionsOrPredicate: WaitForEventOptions, logLine?: string): Promise<any> {
return await this._wrapApiCall(async () => {
const timeout = this._timeoutSettings.timeout(typeof optionsOrPredicate === 'function' ? {} : optionsOrPredicate);
console.log('timeout', timeout, '\n\n\n\n');
const predicate = typeof optionsOrPredicate === 'function' ? optionsOrPredicate : optionsOrPredicate.predicate;
const waiter = Waiter.createForEvent(this, event);
if (logLine)

View file

@ -31,6 +31,7 @@ export class TimeoutSettings {
setDefaultTimeout(timeout: number | undefined) {
this._defaultTimeout = timeout;
console.log('timeoutSettings.ts: setDefaultTimeout: this._defaultTimeout: ', this._defaultTimeout, new Error().stack);
}
setDefaultNavigationTimeout(timeout: number | undefined) {

File diff suppressed because it is too large Load diff