docs: deprecate timeout option in isVisible/isHidden methods (#8371)

This commit is contained in:
Dmitry Gozman 2021-08-23 12:32:06 -07:00 committed by GitHub
parent 60829f8909
commit 827a909d36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 53 additions and 46 deletions

View File

@ -919,7 +919,10 @@ Returns whether the element is hidden, the opposite of [visible](./actionability
### param: Frame.isHidden.selector = %%-input-selector-%%
### option: Frame.isHidden.strict = %%-input-strict-%%
### option: Frame.isHidden.timeout = %%-input-timeout-%%
### option: Frame.isHidden.timeout
- `timeout` <[float]>
**DEPRECATED** This option is ignored. [`method: Frame.isHidden`] does not wait for the element to become hidden and returns immediately.
## async method: Frame.isVisible
- returns: <[boolean]>
@ -929,7 +932,10 @@ Returns whether the element is [visible](./actionability.md#visible). [`option:
### param: Frame.isVisible.selector = %%-input-selector-%%
### option: Frame.isVisible.strict = %%-input-strict-%%
### option: Frame.isVisible.timeout = %%-input-timeout-%%
### option: Frame.isVisible.timeout
- `timeout` <[float]>
**DEPRECATED** This option is ignored. [`method: Frame.isVisible`] does not wait for the element to become visible and returns immediately.
## method: Frame.locator
- returns: <[Locator]>

View File

@ -602,14 +602,20 @@ Returns whether the element is [enabled](./actionability.md#enabled).
Returns whether the element is hidden, the opposite of [visible](./actionability.md#visible).
### option: Locator.isHidden.timeout = %%-input-timeout-%%
### option: Locator.isHidden.timeout
- `timeout` <[float]>
**DEPRECATED** This option is ignored. [`method: Locator.isHidden`] does not wait for the element to become hidden and returns immediately.
## async method: Locator.isVisible
- returns: <[boolean]>
Returns whether the element is [visible](./actionability.md#visible).
### option: Locator.isVisible.timeout = %%-input-timeout-%%
### option: Locator.isVisible.timeout
- `timeout` <[float]>
**DEPRECATED** This option is ignored. [`method: Locator.isVisible`] does not wait for the element to become visible and returns immediately.
## method: Locator.last
- returns: <[Locator]>

View File

@ -2026,7 +2026,10 @@ Returns whether the element is hidden, the opposite of [visible](./actionability
### param: Page.isHidden.selector = %%-input-selector-%%
### option: Page.isHidden.strict = %%-input-strict-%%
### option: Page.isHidden.timeout = %%-input-timeout-%%
### option: Page.isHidden.timeout
- `timeout` <[float]>
**DEPRECATED** This option is ignored. [`method: Page.isHidden`] does not wait for the element to become hidden and returns immediately.
## async method: Page.isVisible
- returns: <[boolean]>
@ -2036,7 +2039,10 @@ Returns whether the element is [visible](./actionability.md#visible). [`option:
### param: Page.isVisible.selector = %%-input-selector-%%
### option: Page.isVisible.strict = %%-input-strict-%%
### option: Page.isVisible.timeout = %%-input-timeout-%%
### option: Page.isVisible.timeout
- `timeout` <[float]>
**DEPRECATED** This option is ignored. [`method: Page.isVisible`] does not wait for the element to become visible and returns immediately.
## property: Page.keyboard
- type: <[Keyboard]>
@ -2648,7 +2654,7 @@ page.select_option("select#colors", value=["red", "green", "blue"])
await page.SelectOptionAsync("select#colors", new[] { "blue" });
// single selection matching both the value and the label
await page.SelectOptionAsync("select#colors", new[] { new SelectOptionValue() { Label = "blue" } });
// multiple
// multiple
await page.SelectOptionAsync("select#colors", new[] { "red", "green", "blue" });
```

View File

@ -1748,11 +1748,9 @@ export type FrameIsEnabledResult = {
export type FrameIsHiddenParams = {
selector: string,
strict?: boolean,
timeout?: number,
};
export type FrameIsHiddenOptions = {
strict?: boolean,
timeout?: number,
};
export type FrameIsHiddenResult = {
value: boolean,
@ -1760,11 +1758,9 @@ export type FrameIsHiddenResult = {
export type FrameIsVisibleParams = {
selector: string,
strict?: boolean,
timeout?: number,
};
export type FrameIsVisibleOptions = {
strict?: boolean,
timeout?: number,
};
export type FrameIsVisibleResult = {
value: boolean,
@ -3401,7 +3397,6 @@ export const commandsWithTracingSnapshots = new Set([
'Frame.isChecked',
'Frame.isDisabled',
'Frame.isEnabled',
'Frame.isHidden',
'Frame.isEditable',
'Frame.press',
'Frame.selectOption',

View File

@ -419,7 +419,7 @@ Playwright:
socksClosed:
parameters:
uid: string
Selectors:
type: interface
@ -1422,17 +1422,13 @@ Frame:
parameters:
selector: string
strict: boolean?
timeout: number?
returns:
value: boolean
tracing:
snapshot: true
isVisible:
parameters:
selector: string
strict: boolean?
timeout: number?
returns:
value: boolean

View File

@ -717,12 +717,10 @@ export function createScheme(tChannel: (name: string) => Validator): Scheme {
scheme.FrameIsHiddenParams = tObject({
selector: tString,
strict: tOptional(tBoolean),
timeout: tOptional(tNumber),
});
scheme.FrameIsVisibleParams = tObject({
selector: tString,
strict: tOptional(tBoolean),
timeout: tOptional(tNumber),
});
scheme.FrameIsEditableParams = tObject({
selector: tString,

View File

@ -1105,16 +1105,16 @@ export class Frame extends SdkObject {
return dom.throwFatalDOMError(dom.throwRetargetableDOMError(result));
}
async isVisible(metadata: CallMetadata, selector: string, options: types.QueryOnSelectorOptions = {}): Promise<boolean> {
async isVisible(metadata: CallMetadata, selector: string, options: types.StrictOptions = {}): Promise<boolean> {
const controller = new ProgressController(metadata, this);
return controller.run(async progress => {
progress.log(` checking visibility of "${selector}"`);
const element = await this.querySelector(selector, options);
return element ? await element.isVisible() : false;
}, this._page._timeoutSettings.timeout(options));
}, this._page._timeoutSettings.timeout({}));
}
async isHidden(metadata: CallMetadata, selector: string, options: types.QueryOnSelectorOptions = {}): Promise<boolean> {
async isHidden(metadata: CallMetadata, selector: string, options: types.StrictOptions = {}): Promise<boolean> {
return !(await this.isVisible(metadata, selector, options));
}

48
types/types.d.ts vendored
View File

@ -2033,10 +2033,10 @@ export interface Page {
strict?: boolean;
/**
* 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)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout)
* or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods.
* **DEPRECATED** This option is ignored.
* [page.isHidden(selector[, options])](https://playwright.dev/docs/api/class-page#page-is-hidden) does not wait for the
* element to become hidden and returns immediately.
* @deprecated
*/
timeout?: number;
}): Promise<boolean>;
@ -2055,10 +2055,10 @@ export interface Page {
strict?: boolean;
/**
* 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)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout)
* or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods.
* **DEPRECATED** This option is ignored.
* [page.isVisible(selector[, options])](https://playwright.dev/docs/api/class-page#page-is-visible) does not wait for the
* element to become visible and returns immediately.
* @deprecated
*/
timeout?: number;
}): Promise<boolean>;
@ -4302,10 +4302,10 @@ export interface Frame {
strict?: boolean;
/**
* 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)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout)
* or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods.
* **DEPRECATED** This option is ignored.
* [frame.isHidden(selector[, options])](https://playwright.dev/docs/api/class-frame#frame-is-hidden) does not wait for the
* element to become hidden and returns immediately.
* @deprecated
*/
timeout?: number;
}): Promise<boolean>;
@ -4324,10 +4324,10 @@ export interface Frame {
strict?: boolean;
/**
* 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)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout)
* or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods.
* **DEPRECATED** This option is ignored.
* [frame.isVisible(selector[, options])](https://playwright.dev/docs/api/class-frame#frame-is-visible) does not wait for
* the element to become visible and returns immediately.
* @deprecated
*/
timeout?: number;
}): Promise<boolean>;
@ -7668,10 +7668,10 @@ export interface Locator {
*/
isHidden(options?: {
/**
* 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)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout)
* or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods.
* **DEPRECATED** This option is ignored.
* [locator.isHidden([options])](https://playwright.dev/docs/api/class-locator#locator-is-hidden) does not wait for the
* element to become hidden and returns immediately.
* @deprecated
*/
timeout?: number;
}): Promise<boolean>;
@ -7682,10 +7682,10 @@ export interface Locator {
*/
isVisible(options?: {
/**
* 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)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout)
* or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods.
* **DEPRECATED** This option is ignored.
* [locator.isVisible([options])](https://playwright.dev/docs/api/class-locator#locator-is-visible) does not wait for the
* element to become visible and returns immediately.
* @deprecated
*/
timeout?: number;
}): Promise<boolean>;