chore: follow up to deprecation changes (#19025)

This commit is contained in:
Pavel Feldman 2022-11-23 12:32:14 -08:00 коммит произвёл GitHub
Родитель f8355b940e
Коммит f9a32e0927
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
8 изменённых файлов: 597 добавлений и 398 удалений

Просмотреть файл

@ -188,7 +188,7 @@ Raw CSS content to be injected into frame.
## async method: Frame.check
* since: v1.8
* discouraged: Use locator-based [`method: Locator.check`] instead.
* discouraged: Use locator-based [`method: Locator.check`] instead. Read more about [locators](../locators.md).
This method checks an element matching [`param: selector`] by performing the following steps:
1. Find an element matching [`param: selector`]. If there is none, wait until a matching element is attached to
@ -232,7 +232,7 @@ When all steps combined have not finished during the specified [`option: timeout
## async method: Frame.click
* since: v1.8
* discouraged: Use locator-based [`method: Locator.click`] instead.
* discouraged: Use locator-based [`method: Locator.click`] instead. Read more about [locators](../locators.md).
This method clicks an element matching [`param: selector`] by performing the following steps:
1. Find an element matching [`param: selector`]. If there is none, wait until a matching element is attached to
@ -287,7 +287,7 @@ Gets the full HTML contents of the frame, including the doctype.
## async method: Frame.dblclick
* since: v1.8
* discouraged: Use locator-based [`method: Locator.dblclick`] instead.
* discouraged: Use locator-based [`method: Locator.dblclick`] instead. Read more about [locators](../locators.md).
* langs:
- alias-csharp: DblClickAsync
@ -340,7 +340,7 @@ When all steps combined have not finished during the specified [`option: timeout
## async method: Frame.dispatchEvent
* since: v1.8
* discouraged: Use locator-based [`method: Locator.dispatchEvent`] instead.
* discouraged: Use locator-based [`method: Locator.dispatchEvent`] instead. Read more about [locators](../locators.md).
The snippet below dispatches the `click` event on the element. Regardless of the visibility state of the element, `click`
is dispatched. This is equivalent to calling
@ -469,7 +469,8 @@ Optional event-specific initialization properties.
## async method: Frame.evalOnSelector
* since: v1.9
* discouraged: Use locator-based [`method: Locator.evaluate`] instead.
* discouraged: This method does not wait for the element to pass the actionability
checks and therefore can lead to the flaky tests. Use [`method: Locator.evaluate`], other [Locator] helper methods or web-first assertions instead.
* langs:
- alias-python: eval_on_selector
- alias-js: $eval
@ -477,11 +478,6 @@ Optional event-specific initialization properties.
Returns the return value of [`param: expression`].
:::caution
This method does not wait for the element to pass actionability checks and therefore can lead to
the flaky tests. Use [`method: Locator.evaluate`], other [Locator] helper methods or web-first assertions instead.
:::
The method finds an element matching the specified selector within the frame and passes it as a first argument to
[`param: expression`]. See [Working with selectors](../selectors.md) for more details. If no
elements match the selector, the method throws an error.
@ -538,7 +534,8 @@ Optional argument to pass to [`param: expression`].
## async method: Frame.evalOnSelectorAll
* since: v1.9
* discouraged: Use locator-based [`method: Locator.evaluateAll`] instead.
* discouraged: In most cases, [`method: Locator.evaluateAll`],
other [Locator] helper methods and web-first assertions do a better job.
* langs:
- alias-python: eval_on_selector_all
- alias-js: $$eval
@ -546,10 +543,6 @@ Optional argument to pass to [`param: expression`].
Returns the return value of [`param: expression`].
:::note
In most cases, [`method: Locator.evaluateAll`], other [Locator] helper methods and web-first assertions do a better job.
:::
The method finds all elements matching the specified selector within the frame and passes an array of matched elements
as a first argument to [`param: expression`]. See [Working with selectors](../selectors.md) for
more details.
@ -811,7 +804,7 @@ Optional argument to pass to [`param: expression`].
## async method: Frame.fill
* since: v1.8
* discouraged: Use locator-based [`method: Locator.fill`] instead.
* discouraged: Use locator-based [`method: Locator.fill`] instead. Read more about [locators](../locators.md).
This method waits for an element matching [`param: selector`], waits for [actionability](../actionability.md) checks, focuses the element, fills it and triggers an `input` event after filling. Note that you can pass an empty string to clear the input field.
@ -842,7 +835,7 @@ Value to fill for the `<input>`, `<textarea>` or `[contenteditable]` element.
## async method: Frame.focus
* since: v1.8
* discouraged: Use locator-based [`method: Locator.focus`] instead.
* discouraged: Use locator-based [`method: Locator.focus`] instead. Read more about [locators](../locators.md).
This method fetches an element with [`param: selector`] and focuses it. If there's no element matching
[`param: selector`], the method waits until a matching element appears in the DOM.
@ -940,7 +933,7 @@ await locator.ClickAsync();
## async method: Frame.getAttribute
* since: v1.8
* discouraged: Use locator-based [`method: Locator.getAttribute`] instead.
* discouraged: Use locator-based [`method: Locator.getAttribute`] instead. Read more about [locators](../locators.md).
- returns: <[null]|[string]>
Returns element attribute value.
@ -1083,7 +1076,7 @@ Referer header value. If provided it will take preference over the referer heade
## async method: Frame.hover
* since: v1.8
* discouraged: Use locator-based [`method: Locator.hover`] instead.
* discouraged: Use locator-based [`method: Locator.hover`] instead. Read more about [locators](../locators.md).
This method hovers over an element matching [`param: selector`] by performing the following steps:
1. Find an element matching [`param: selector`]. If there is none, wait until a matching element is attached to
@ -1123,7 +1116,7 @@ When all steps combined have not finished during the specified [`option: timeout
## async method: Frame.innerHTML
* since: v1.8
* discouraged: Use locator-based [`method: Locator.innerHTML`] instead.
* discouraged: Use locator-based [`method: Locator.innerHTML`] instead. Read more about [locators](../locators.md).
- returns: <[string]>
Returns `element.innerHTML`.
@ -1139,7 +1132,7 @@ Returns `element.innerHTML`.
## async method: Frame.innerText
* since: v1.8
* discouraged: Use locator-based [`method: Locator.innerText`] instead.
* discouraged: Use locator-based [`method: Locator.innerText`] instead. Read more about [locators](../locators.md).
- returns: <[string]>
Returns `element.innerText`.
@ -1155,7 +1148,7 @@ Returns `element.innerText`.
## async method: Frame.inputValue
* since: v1.13
* discouraged: Use locator-based [`method: Locator.inputValue`] instead.
* discouraged: Use locator-based [`method: Locator.inputValue`] instead. Read more about [locators](../locators.md).
- returns: <[string]>
Returns `input.value` for the selected `<input>` or `<textarea>` or `<select>` element.
@ -1173,7 +1166,7 @@ Throws for non-input elements. However, if the element is inside the `<label>` e
## async method: Frame.isChecked
* since: v1.8
* discouraged: Use locator-based [`method: Locator.isChecked`] instead.
* discouraged: Use locator-based [`method: Locator.isChecked`] instead. Read more about [locators](../locators.md).
- returns: <[boolean]>
Returns whether the element is checked. Throws if the element is not a checkbox or radio input.
@ -1195,7 +1188,7 @@ Returns `true` if the frame has been detached, or `false` otherwise.
## async method: Frame.isDisabled
* since: v1.8
* discouraged: Use locator-based [`method: Locator.isDisabled`] instead.
* discouraged: Use locator-based [`method: Locator.isDisabled`] instead. Read more about [locators](../locators.md).
- returns: <[boolean]>
Returns whether the element is disabled, the opposite of [enabled](../actionability.md#enabled).
@ -1211,7 +1204,7 @@ Returns whether the element is disabled, the opposite of [enabled](../actionabil
## async method: Frame.isEditable
* since: v1.8
* discouraged: Use locator-based [`method: Locator.isEditable`] instead.
* discouraged: Use locator-based [`method: Locator.isEditable`] instead. Read more about [locators](../locators.md).
- returns: <[boolean]>
Returns whether the element is [editable](../actionability.md#editable).
@ -1242,7 +1235,7 @@ Returns whether the element is [enabled](../actionability.md#enabled).
## async method: Frame.isHidden
* since: v1.8
* discouraged: Use locator-based [`method: Locator.isHidden`] instead.
* discouraged: Use locator-based [`method: Locator.isHidden`] instead. Read more about [locators](../locators.md).
- returns: <[boolean]>
Returns whether the element is hidden, the opposite of [visible](../actionability.md#visible). [`option: selector`] that does not match any elements is considered hidden.
@ -1260,7 +1253,7 @@ Returns whether the element is hidden, the opposite of [visible](../actionabilit
## async method: Frame.isVisible
* since: v1.8
* discouraged: Use locator-based [`method: Locator.isVisible`] instead.
* discouraged: Use locator-based [`method: Locator.isVisible`] instead. Read more about [locators](../locators.md).
- returns: <[boolean]>
Returns whether the element is [visible](../actionability.md#visible). [`option: selector`] that does not match any elements is considered not visible.
@ -1316,7 +1309,7 @@ Parent frame, if any. Detached frames and main frames return `null`.
## async method: Frame.press
* since: v1.8
* discouraged: Use locator-based [`method: Locator.press`] instead.
* discouraged: Use locator-based [`method: Locator.press`] instead. Read more about [locators](../locators.md).
[`param: key`] can specify the intended
[keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key) value or a single character to
@ -1362,7 +1355,7 @@ Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0.
## async method: Frame.querySelector
* since: v1.9
* discouraged: Use locator-based [`method: Frame.locator`] instead.
* discouraged: Use locator-based [`method: Frame.locator`] instead. Read more about [locators](../locators.md).
* langs:
- alias-python: query_selector
- alias-js: $
@ -1386,7 +1379,7 @@ returns `null`.
## async method: Frame.querySelectorAll
* since: v1.9
* discouraged: Use locator-based [`method: Frame.locator`] instead.
* discouraged: Use locator-based [`method: Frame.locator`] instead. Read more about [locators](../locators.md).
* langs:
- alias-python: query_selector_all
- alias-js: $$
@ -1407,7 +1400,7 @@ returns empty array.
## async method: Frame.selectOption
* since: v1.8
* discouraged: Use locator-based [`method: Locator.selectOption`] instead.
* discouraged: Use locator-based [`method: Locator.selectOption`] instead. Read more about [locators](../locators.md).
- returns: <[Array]<[string]>>
This method waits for an element matching [`param: selector`], waits for [actionability](../actionability.md) checks, waits until all specified options are present in the `<select>` element and selects these options.
@ -1487,7 +1480,7 @@ await frame.SelectOptionAsync("select#colors", new[] { "red", "green", "blue" })
## async method: Frame.setChecked
* since: v1.15
* discouraged: Use locator-based [`method: Locator.setChecked`] instead.
* discouraged: Use locator-based [`method: Locator.setChecked`] instead. Read more about [locators](../locators.md).
This method checks or unchecks an element matching [`param: selector`] by performing the following steps:
1. Find an element matching [`param: selector`]. If there is none, wait until a matching element is attached to
@ -1545,7 +1538,7 @@ HTML markup to assign to the page.
## async method: Frame.setInputFiles
* since: v1.8
* discouraged: Use locator-based [`method: Locator.setInputFiles`] instead.
* discouraged: Use locator-based [`method: Locator.setInputFiles`] instead. Read more about [locators](../locators.md).
Sets the value of the file input to these file paths or files. If some of the `filePaths` are relative paths, then they
are resolved relative to the current working directory. For empty array, clears the selected files.
@ -1570,7 +1563,7 @@ This method expects [`param: selector`] to point to an
## async method: Frame.tap
* since: v1.8
* discouraged: Use locator-based [`method: Locator.tap`] instead.
* discouraged: Use locator-based [`method: Locator.tap`] instead. Read more about [locators](../locators.md).
This method taps an element matching [`param: selector`] by performing the following steps:
1. Find an element matching [`param: selector`]. If there is none, wait until a matching element is attached to
@ -1614,7 +1607,7 @@ When all steps combined have not finished during the specified [`option: timeout
## async method: Frame.textContent
* since: v1.8
* discouraged: Use locator-based [`method: Locator.textContent`] instead.
* discouraged: Use locator-based [`method: Locator.textContent`] instead. Read more about [locators](../locators.md).
- returns: <[null]|[string]>
Returns `element.textContent`.
@ -1636,7 +1629,7 @@ Returns the page title.
## async method: Frame.type
* since: v1.8
* discouraged: Use locator-based [`method: Locator.type`] instead.
* discouraged: Use locator-based [`method: Locator.type`] instead. Read more about [locators](../locators.md).
Sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text. `frame.type` can be used to
send fine-grained keyboard events. To fill values in form fields, use [`method: Frame.fill`].
@ -1698,7 +1691,7 @@ Time to wait between key presses in milliseconds. Defaults to 0.
## async method: Frame.uncheck
* since: v1.8
* discouraged: Use locator-based [`method: Locator.uncheck`] instead.
* discouraged: Use locator-based [`method: Locator.uncheck`] instead. Read more about [locators](../locators.md).
This method checks an element matching [`param: selector`] by performing the following steps:
1. Find an element matching [`param: selector`]. If there is none, wait until a matching element is attached to

Просмотреть файл

@ -701,7 +701,7 @@ Brings page to front (activates tab).
## async method: Page.check
* since: v1.8
* discouraged: Use locator-based [`method: Locator.check`] instead.
* discouraged: Use locator-based [`method: Locator.check`] instead. Read more about [locators](../locators.md).
This method checks an element matching [`param: selector`] by performing the following steps:
1. Find an element matching [`param: selector`]. If there is none, wait until a matching element is attached to
@ -741,7 +741,7 @@ When all steps combined have not finished during the specified [`option: timeout
## async method: Page.click
* since: v1.8
* discouraged: Use locator-based [`method: Locator.click`] instead.
* discouraged: Use locator-based [`method: Locator.click`] instead. Read more about [locators](../locators.md).
This method clicks an element matching [`param: selector`] by performing the following steps:
1. Find an element matching [`param: selector`]. If there is none, wait until a matching element is attached to
@ -833,7 +833,7 @@ Browser-specific Coverage implementation. See [Coverage](#class-coverage) for mo
## async method: Page.dblclick
* since: v1.8
* discouraged: Use locator-based [`method: Locator.dblclick`] instead.
* discouraged: Use locator-based [`method: Locator.dblclick`] instead. Read more about [locators](../locators.md).
* langs:
- alias-csharp: DblClickAsync
@ -886,7 +886,7 @@ When all steps combined have not finished during the specified [`option: timeout
## async method: Page.dispatchEvent
* since: v1.8
* discouraged: Use locator-based [`method: Locator.dispatchEvent`] instead.
* discouraged: Use locator-based [`method: Locator.dispatchEvent`] instead. Read more about [locators](../locators.md).
The snippet below dispatches the `click` event on the element. Regardless of the visibility state of the element, `click`
is dispatched. This is equivalent to calling
@ -1277,17 +1277,14 @@ Emulates `'forced-colors'` media feature, supported values are `'active'` and `'
## async method: Page.evalOnSelector
* since: v1.9
* discouraged: Use locator-based [`method: Locator.evaluate`] instead.
* discouraged: This method does not wait for the element to pass actionability
checks and therefore can lead to the flaky tests. Use [`method: Locator.evaluate`],
other [Locator] helper methods or web-first assertions instead.
* langs:
- alias-python: eval_on_selector
- alias-js: $eval
- returns: <[Serializable]>
:::caution
This method does not wait for the element to pass actionability checks and therefore can lead to
the flaky tests. Use [`method: Locator.evaluate`], other [Locator] helper methods or web-first assertions instead.
:::
The method finds an element matching the specified selector within the page and passes it as a first argument to
[`param: expression`]. If no elements match the selector, the method throws an error. Returns the value of
[`param: expression`].
@ -1346,16 +1343,13 @@ Optional argument to pass to [`param: expression`].
## async method: Page.evalOnSelectorAll
* since: v1.9
* discouraged: Use locator-based [`method: Locator.evaluateAll`] instead.
* discouraged: In most cases, [`method: Locator.evaluateAll`],
other [Locator] helper methods and web-first assertions do a better job.
* langs:
- alias-python: eval_on_selector_all
- alias-js: $$eval
- returns: <[Serializable]>
:::note
In most cases, [`method: Locator.evaluateAll`], other [Locator] helper methods and web-first assertions do a better job.
:::
The method finds all elements matching the specified selector within the page and passes an array of matched elements as
a first argument to [`param: expression`]. Returns the result of [`param: expression`] invocation.
@ -2046,7 +2040,7 @@ Callback function which will be called in Playwright's context.
## async method: Page.fill
* since: v1.8
* discouraged: Use locator-based [`method: Locator.fill`] instead.
* discouraged: Use locator-based [`method: Locator.fill`] instead. Read more about [locators](../locators.md).
This method waits for an element matching [`param: selector`], waits for [actionability](../actionability.md) checks, focuses the element, fills it and triggers an `input` event after filling. Note that you can pass an empty string to clear the input field.
@ -2077,7 +2071,7 @@ Value to fill for the `<input>`, `<textarea>` or `[contenteditable]` element.
## async method: Page.focus
* since: v1.8
* discouraged: Use locator-based [`method: Locator.focus`] instead.
* discouraged: Use locator-based [`method: Locator.focus`] instead. Read more about [locators](../locators.md).
This method fetches an element with [`param: selector`] and focuses it. If there's no element matching
[`param: selector`], the method waits until a matching element appears in the DOM.
@ -2210,7 +2204,7 @@ An array of all frames attached to the page.
## async method: Page.getAttribute
* since: v1.8
* discouraged: Use locator-based [`method: Locator.getAttribute`] instead.
* discouraged: Use locator-based [`method: Locator.getAttribute`] instead. Read more about [locators](../locators.md).
- returns: <[null]|[string]>
Returns element attribute value.
@ -2385,7 +2379,7 @@ Referer header value. If provided it will take preference over the referer heade
## async method: Page.hover
* since: v1.8
* discouraged: Use locator-based [`method: Locator.hover`] instead.
* discouraged: Use locator-based [`method: Locator.hover`] instead. Read more about [locators](../locators.md).
This method hovers over an element matching [`param: selector`] by performing the following steps:
1. Find an element matching [`param: selector`]. If there is none, wait until a matching element is attached to
@ -2425,7 +2419,7 @@ When all steps combined have not finished during the specified [`option: timeout
## async method: Page.innerHTML
* since: v1.8
* discouraged: Use locator-based [`method: Locator.innerHTML`] instead.
* discouraged: Use locator-based [`method: Locator.innerHTML`] instead. Read more about [locators](../locators.md).
- returns: <[string]>
Returns `element.innerHTML`.
@ -2441,7 +2435,7 @@ Returns `element.innerHTML`.
## async method: Page.innerText
* since: v1.8
* discouraged: Use locator-based [`method: Locator.innerText`] instead.
* discouraged: Use locator-based [`method: Locator.innerText`] instead. Read more about [locators](../locators.md).
- returns: <[string]>
Returns `element.innerText`.
@ -2457,7 +2451,7 @@ Returns `element.innerText`.
## async method: Page.inputValue
* since: v1.13
* discouraged: Use locator-based [`method: Locator.inputValue`] instead.
* discouraged: Use locator-based [`method: Locator.inputValue`] instead. Read more about [locators](../locators.md).
- returns: <[string]>
Returns `input.value` for the selected `<input>` or `<textarea>` or `<select>` element.
@ -2475,7 +2469,7 @@ Throws for non-input elements. However, if the element is inside the `<label>` e
## async method: Page.isChecked
* since: v1.8
* discouraged: Use locator-based [`method: Locator.isChecked`] instead.
* discouraged: Use locator-based [`method: Locator.isChecked`] instead. Read more about [locators](../locators.md).
- returns: <[boolean]>
Returns whether the element is checked. Throws if the element is not a checkbox or radio input.
@ -2497,7 +2491,7 @@ Indicates that the page has been closed.
## async method: Page.isDisabled
* since: v1.8
* discouraged: Use locator-based [`method: Locator.isDisabled`] instead.
* discouraged: Use locator-based [`method: Locator.isDisabled`] instead. Read more about [locators](../locators.md).
- returns: <[boolean]>
Returns whether the element is disabled, the opposite of [enabled](../actionability.md#enabled).
@ -2513,7 +2507,7 @@ Returns whether the element is disabled, the opposite of [enabled](../actionabil
## async method: Page.isEditable
* since: v1.8
* discouraged: Use locator-based [`method: Locator.isEditable`] instead.
* discouraged: Use locator-based [`method: Locator.isEditable`] instead. Read more about [locators](../locators.md).
- returns: <[boolean]>
Returns whether the element is [editable](../actionability.md#editable).
@ -2529,7 +2523,7 @@ Returns whether the element is [editable](../actionability.md#editable).
## async method: Page.isEnabled
* since: v1.8
* discouraged: Use locator-based [`method: Locator.isEnabled`] instead.
* discouraged: Use locator-based [`method: Locator.isEnabled`] instead. Read more about [locators](../locators.md).
- returns: <[boolean]>
Returns whether the element is [enabled](../actionability.md#enabled).
@ -2545,7 +2539,7 @@ Returns whether the element is [enabled](../actionability.md#enabled).
## async method: Page.isHidden
* since: v1.8
* discouraged: Use locator-based [`method: Locator.isHidden`] instead.
* discouraged: Use locator-based [`method: Locator.isHidden`] instead. Read more about [locators](../locators.md).
- returns: <[boolean]>
Returns whether the element is hidden, the opposite of [visible](../actionability.md#visible). [`option: selector`] that does not match any elements is considered hidden.
@ -2564,7 +2558,7 @@ Returns whether the element is hidden, the opposite of [visible](../actionabilit
## async method: Page.isVisible
* since: v1.8
* discouraged: Use locator-based [`method: Locator.isVisible`] instead.
* discouraged: Use locator-based [`method: Locator.isVisible`] instead. Read more about [locators](../locators.md).
- returns: <[boolean]>
Returns whether the element is [visible](../actionability.md#visible). [`option: selector`] that does not match any elements is considered not visible.
@ -2831,7 +2825,7 @@ size.
## async method: Page.press
* since: v1.8
* discouraged: Use locator-based [`method: Locator.press`] instead.
* discouraged: Use locator-based [`method: Locator.press`] instead. Read more about [locators](../locators.md).
Focuses the element, and then uses [`method: Keyboard.down`] and [`method: Keyboard.up`].
@ -2939,7 +2933,7 @@ Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0.
## async method: Page.querySelector
* since: v1.9
* discouraged: Use locator-based [`method: Page.locator`] instead.
* discouraged: Use locator-based [`method: Page.locator`] instead. Read more about [locators](../locators.md).
* langs:
- alias-python: query_selector
- alias-js: $
@ -2956,7 +2950,7 @@ return value resolves to `null`. To wait for an element on the page, use [`metho
## async method: Page.querySelectorAll
* since: v1.9
* discouraged: Use locator-based [`method: Page.locator`] instead.
* discouraged: Use locator-based [`method: Page.locator`] instead. Read more about [locators](../locators.md).
* langs:
- alias-python: query_selector_all
- alias-js: $$
@ -3215,7 +3209,7 @@ Returns the buffer with the captured screenshot.
## async method: Page.selectOption
* since: v1.8
* discouraged: Use locator-based [`method: Locator.selectOption`] instead.
* discouraged: Use locator-based [`method: Locator.selectOption`] instead. Read more about [locators](../locators.md).
- returns: <[Array]<[string]>>
This method waits for an element matching [`param: selector`], waits for [actionability](../actionability.md) checks, waits until all specified options are present in the `<select>` element and selects these options.
@ -3296,7 +3290,7 @@ await page.SelectOptionAsync("select#colors", new[] { "red", "green", "blue" });
## async method: Page.setChecked
* since: v1.15
* discouraged: Use locator-based [`method: Locator.setChecked`] instead.
* discouraged: Use locator-based [`method: Locator.setChecked`] instead. Read more about [locators](../locators.md).
This method checks or unchecks an element matching [`param: selector`] by performing the following steps:
1. Find an element matching [`param: selector`]. If there is none, wait until a matching element is attached to
@ -3407,7 +3401,7 @@ An object containing additional HTTP headers to be sent with every request. All
## async method: Page.setInputFiles
* since: v1.8
* discouraged: Use locator-based [`method: Locator.setInputFiles`] instead.
* discouraged: Use locator-based [`method: Locator.setInputFiles`] instead. Read more about [locators](../locators.md).
Sets the value of the file input to these file paths or files. If some of the `filePaths` are relative paths, then they
are resolved relative to the current working directory. For empty array, clears the selected files.
@ -3493,7 +3487,7 @@ await page.GotoAsync("https://www.microsoft.com");
## async method: Page.tap
* since: v1.8
* discouraged: Use locator-based [`method: Locator.tap`] instead.
* discouraged: Use locator-based [`method: Locator.tap`] instead. Read more about [locators](../locators.md).
This method taps an element matching [`param: selector`] by performing the following steps:
1. Find an element matching [`param: selector`]. If there is none, wait until a matching element is attached to
@ -3537,7 +3531,7 @@ When all steps combined have not finished during the specified [`option: timeout
## async method: Page.textContent
* since: v1.8
* discouraged: Use locator-based [`method: Locator.textContent`] instead.
* discouraged: Use locator-based [`method: Locator.textContent`] instead. Read more about [locators](../locators.md).
- returns: <[null]|[string]>
Returns `element.textContent`.
@ -3563,7 +3557,7 @@ Returns the page's title.
## async method: Page.type
* since: v1.8
* discouraged: Use locator-based [`method: Locator.type`] instead.
* discouraged: Use locator-based [`method: Locator.type`] instead. Read more about [locators](../locators.md).
Sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text. `page.type` can be used to send
fine-grained keyboard events. To fill values in form fields, use [`method: Page.fill`].
@ -3625,7 +3619,7 @@ Time to wait between key presses in milliseconds. Defaults to 0.
## async method: Page.uncheck
* since: v1.8
* discouraged: Use locator-based [`method: Locator.uncheck`] instead.
* discouraged: Use locator-based [`method: Locator.uncheck`] instead. Read more about [locators](../locators.md).
This method unchecks an element matching [`param: selector`] by performing the following steps:
1. Find an element matching [`param: selector`]. If there is none, wait until a matching element is attached to

769
packages/playwright-core/types/types.d.ts поставляемый

Разница между файлами не показана из-за своего большого размера Загрузить разницу

66
packages/playwright-test/types/test.d.ts поставляемый
Просмотреть файл

@ -436,7 +436,7 @@ interface TestConfig {
* `8080` produces `baseURL` equal `http://localhost:8080`. If `webServer` is specified as an array, you must
* explicitly configure the `baseURL` (even if it only has one entry).
*
* > NOTE: It is also recommended to specify
* **NOTE** It is also recommended to specify
* [testOptions.baseURL](https://playwright.dev/docs/api/class-testoptions#test-options-base-url) in the config, so
* that tests could use relative urls.
*
@ -764,7 +764,7 @@ interface TestConfig {
outputDir?: string;
/**
* > NOTE: Use of [testConfig.snapshotDir](https://playwright.dev/docs/api/class-testconfig#test-config-snapshot-dir)
* **NOTE** Use of [testConfig.snapshotDir](https://playwright.dev/docs/api/class-testconfig#test-config-snapshot-dir)
* is discouraged. Please use
* [testConfig.snapshotPathTemplate](https://playwright.dev/docs/api/class-testconfig#test-config-snapshot-path-template)
* to configure snapshot paths.
@ -1358,7 +1358,7 @@ export interface FullConfig<TestArgs = {}, WorkerArgs = {}> {
* `8080` produces `baseURL` equal `http://localhost:8080`. If `webServer` is specified as an array, you must
* explicitly configure the `baseURL` (even if it only has one entry).
*
* > NOTE: It is also recommended to specify
* **NOTE** It is also recommended to specify
* [testOptions.baseURL](https://playwright.dev/docs/api/class-testoptions#test-options-base-url) in the config, so
* that tests could use relative urls.
*
@ -1571,7 +1571,7 @@ export interface TestInfo {
* });
* ```
*
* > NOTE: [testInfo.attach(name[, options])](https://playwright.dev/docs/api/class-testinfo#test-info-attach)
* **NOTE** [testInfo.attach(name[, options])](https://playwright.dev/docs/api/class-testinfo#test-info-attach)
* automatically takes care of copying attached files to a location that is accessible to reporters. You can safely
* remove the attachment after awaiting the attach call.
* @param name Attachment name. The name will also be sanitized and used as the prefix of file name when saving to disk.
@ -1822,12 +1822,13 @@ export interface TestInfo {
* 'path', 'to', 'snapshot.png')`.
* > However, this path must stay within the snapshots directory for each test file (i.e. `a.spec.js-snapshots`),
* otherwise it will throw.
* @param pathSegments The name of the snapshot or the path segments to define the snapshot file path. Snapshots with the same name in the same test file are expected to be the same.
* @param pathSegments The name of the snapshot or the path segments to define the snapshot file path. Snapshots with the same name in the
* same test file are expected to be the same.
*/
snapshotPath(...pathSegments: Array<string>): string;
/**
* > NOTE: Use of [testInfo.snapshotSuffix](https://playwright.dev/docs/api/class-testinfo#test-info-snapshot-suffix)
* **NOTE** Use of [testInfo.snapshotSuffix](https://playwright.dev/docs/api/class-testinfo#test-info-snapshot-suffix)
* is discouraged. Please use
* [testConfig.snapshotPathTemplate](https://playwright.dev/docs/api/class-testconfig#test-config-snapshot-path-template)
* to configure snapshot paths.
@ -1927,7 +1928,8 @@ interface SuiteFunction {
* ```
*
* @param title Group title.
* @param callback A callback that is run immediately when calling [test.describe(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-1). Any tests added in
* @param callback A callback that is run immediately when calling
* [test.describe(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-1). Any tests added in
* this callback will belong to the group.
*/
(title: string, callback: () => void): void;
@ -1949,7 +1951,8 @@ interface SuiteFunction {
* });
* ```
*
* @param callback A callback that is run immediately when calling [test.describe(callback)](https://playwright.dev/docs/api/class-test#test-describe-2). Any tests added in this
* @param callback A callback that is run immediately when calling
* [test.describe(callback)](https://playwright.dev/docs/api/class-test#test-describe-2). Any tests added in this
* callback will belong to the group.
*/
(callback: () => void): void;
@ -2004,7 +2007,8 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
* ```
*
* @param title Group title.
* @param callback A callback that is run immediately when calling [test.describe(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-1). Any tests added in
* @param callback A callback that is run immediately when calling
* [test.describe(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-1). Any tests added in
* this callback will belong to the group.
*/
describe: SuiteFunction & {
@ -2024,7 +2028,8 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
* ```
*
* @param title Group title.
* @param callback A callback that is run immediately when calling [test.describe.only(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-only). Any tests
* @param callback A callback that is run immediately when calling
* [test.describe.only(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-only). Any tests
* added in this callback will belong to the group.
*/
only: SuiteFunction;
@ -2042,7 +2047,8 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
* ```
*
* @param title Group title.
* @param callback A callback that is run immediately when calling [test.describe.skip(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-skip). Any tests
* @param callback A callback that is run immediately when calling
* [test.describe.skip(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-skip). Any tests
* added in this callback will belong to the group, and will not be run.
*/
skip: SuiteFunction;
@ -2060,7 +2066,8 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
* ```
*
* @param title Group title.
* @param callback A callback that is run immediately when calling [test.describe.fixme(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-fixme). Any tests
* @param callback A callback that is run immediately when calling
* [test.describe.fixme(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-fixme). Any tests
* added in this callback will belong to the group, and will not be run.
*/
fixme: SuiteFunction;
@ -2068,10 +2075,11 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
* Declares a group of tests that should always be run serially. If one of the tests fails, all subsequent tests are
* skipped. All tests in a group are retried together.
*
* > NOTE: See
* **NOTE** See
* [test.describe.configure([options])](https://playwright.dev/docs/api/class-test#test-describe-configure) for the
* preferred way of configuring the execution mode.
* > NOTE: Using serial is not recommended. It is usually better to make your tests isolated, so they can be run
*
* **NOTE** Using serial is not recommended. It is usually better to make your tests isolated, so they can be run
* independently.
*
* ```js
@ -2082,7 +2090,8 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
* ```
*
* @param title Group title.
* @param callback A callback that is run immediately when calling [test.describe.serial(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-serial). Any tests
* @param callback A callback that is run immediately when calling
* [test.describe.serial(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-serial). Any tests
* added in this callback will belong to the group.
*/
serial: SuiteFunction & {
@ -2091,7 +2100,7 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
* tests are skipped. All tests in a group are retried together. If there are some focused tests or suites, all of
* them will be run but nothing else.
*
* > NOTE: Using serial is not recommended. It is usually better to make your tests isolated, so they can be run
* **NOTE** Using serial is not recommended. It is usually better to make your tests isolated, so they can be run
* independently.
*
* ```js
@ -2104,7 +2113,8 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
* ```
*
* @param title Group title.
* @param callback A callback that is run immediately when calling [test.describe.serial.only(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-serial-only).
* @param callback A callback that is run immediately when calling
* [test.describe.serial.only(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-serial-only).
* Any tests added in this callback will belong to the group.
*/
only: SuiteFunction;
@ -2115,7 +2125,7 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
* [test.describe.parallel(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-parallel) allows
* them to run in parallel.
*
* > NOTE: See
* **NOTE** See
* [test.describe.configure([options])](https://playwright.dev/docs/api/class-test#test-describe-configure) for the
* preferred way of configuring the execution mode.
*
@ -2129,7 +2139,8 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
* Note that parallel tests are executed in separate processes and cannot share any state or global variables. Each of
* the parallel tests executes all relevant hooks.
* @param title Group title.
* @param callback A callback that is run immediately when calling [test.describe.parallel(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-parallel). Any
* @param callback A callback that is run immediately when calling
* [test.describe.parallel(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-parallel). Any
* tests added in this callback will belong to the group.
*/
parallel: SuiteFunction & {
@ -2138,7 +2149,8 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
* [test.describe.parallel(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-parallel), but
* focuses the group. If there are some focused tests or suites, all of them will be run but nothing else.
* @param title Group title.
* @param callback A callback that is run immediately when calling [test.describe.parallel.only(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-parallel-only).
* @param callback A callback that is run immediately when calling
* [test.describe.parallel.only(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-parallel-only).
* Any tests added in this callback will belong to the group.
*/
only: SuiteFunction;
@ -2272,7 +2284,8 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
* });
* ```
*
* @param callback A function that returns whether to skip, based on test fixtures. Test or tests are skipped when the return value is `true`.
* @param callback A function that returns whether to skip, based on test fixtures. Test or tests are skipped when the return value is
* `true`.
* @param description Optional description that will be reflected in a test report.
*/
skip(callback: (args: TestArgs & WorkerArgs) => boolean, description?: string): void;
@ -2357,7 +2370,8 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
* });
* ```
*
* @param callback A function that returns whether to mark as "fixme", based on test fixtures. Test or tests are marked as "fixme" when the return value is `true`.
* @param callback A function that returns whether to mark as "fixme", based on test fixtures. Test or tests are marked as "fixme"
* when the return value is `true`.
* @param description Optional description that will be reflected in a test report.
*/
fixme(callback: (args: TestArgs & WorkerArgs) => boolean, description?: string): void;
@ -2411,7 +2425,8 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
* });
* ```
*
* @param callback A function that returns whether to mark as "should fail", based on test fixtures. Test or tests are marked as "should fail" when the return value is `true`.
* @param callback A function that returns whether to mark as "should fail", based on test fixtures. Test or tests are marked as
* "should fail" when the return value is `true`.
* @param description Optional description that will be reflected in a test report.
*/
fail(callback: (args: TestArgs & WorkerArgs) => boolean, description?: string): void;
@ -2427,7 +2442,7 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
* });
* ```
*
* > NOTE: [test.slow()](https://playwright.dev/docs/api/class-test#test-slow-1) cannot be used in a `beforeAll` or
* **NOTE** [test.slow()](https://playwright.dev/docs/api/class-test#test-slow-1) cannot be used in a `beforeAll` or
* `afterAll` hook. Use [test.setTimeout(timeout)](https://playwright.dev/docs/api/class-test#test-set-timeout)
* instead.
*/
@ -2467,7 +2482,8 @@ export interface TestType<TestArgs extends KeyValue, WorkerArgs extends KeyValue
* });
* ```
*
* @param callback A function that returns whether to mark as "slow", based on test fixtures. Test or tests are marked as "slow" when the return value is `true`.
* @param callback A function that returns whether to mark as "slow", based on test fixtures. Test or tests are marked as "slow" when
* the return value is `true`.
* @param description Optional description that will be reflected in a test report.
*/
slow(callback: (args: TestArgs & WorkerArgs) => boolean, description?: string): void;

Просмотреть файл

@ -378,11 +378,12 @@ export interface Reporter {
/**
* Called after all tests has been run, or testing has been interrupted. Note that this method may return a [Promise]
* and Playwright Test will await it.
* @param result Result of the full test run. - `'passed'` - Everything went as expected.
* @param result Result of the full test run.
* - `'passed'` - Everything went as expected.
* - `'failed'` - Any test has failed.
* - `'timedout'` - The
* [testConfig.globalTimeout](https://playwright.dev/docs/api/class-testconfig#test-config-global-timeout) has
* been reached.
* [testConfig.globalTimeout](https://playwright.dev/docs/api/class-testconfig#test-config-global-timeout) has
* been reached.
* - `'interrupted'` - Interrupted by the user.
*/
onEnd?(result: FullResult): void | Promise<void>;

Просмотреть файл

@ -867,7 +867,7 @@ function generateSourceCodeComment(spec) {
if (node.type === 'note') {
// @ts-ignore
node.type = 'text';
node.text = '> NOTE: ' + node.text;
node.text = '**NOTE** ' + node.text;
}
});
// 5 is a typical member doc offset.

Просмотреть файл

@ -18,6 +18,7 @@
const path = require('path');
const toKebabCase = require('lodash/kebabCase')
const devices = require('../../packages/playwright-core/lib/server/deviceDescriptors');
const md = require('../markdown');
const docs = require('../doclint/documentation');
const PROJECT_DIR = path.join(__dirname, '..', '..');
const fs = require('fs');
@ -471,11 +472,18 @@ class TypesGenerator {
*/
memberJSDOC(member, indent) {
const lines = [];
if (member.discouraged) {
lines.push('**NOTE** ' + md.wrapText(member.discouraged, { flattenText: true, maxColumns: 120 - 5 }, ''));
lines.push('');
}
if (member.comment)
lines.push(...member.comment.split('\n'));
if (member.deprecated)
lines.push('@deprecated ' + member.deprecated);
lines.push(...member.argsArray.map(arg => `@param ${arg.alias.replace(/\./g, '')} ${arg.comment.replace('\n', ' ')}`));
lines.push('@deprecated ' + md.wrapText(member.deprecated, { flattenText: true, maxColumns: 120 - 5 }, ''));
lines.push(...member.argsArray.map(arg => {
const paramPrefix = `@param ${arg.alias.replace(/\./g, '')} `;
return paramPrefix + md.wrapText(arg.comment, { flattenText: true, maxColumns: 120 - 5 }, '');
}));
if (!lines.length)
return indent;
return this.writeComment(lines.join('\n'), indent) + '\n' + indent;

Просмотреть файл

@ -491,4 +491,4 @@ function filterNodesForLanguage(nodes, language) {
return result;
}
module.exports = { parse, render, clone, visitAll, visit, generateToc, filterNodesForLanguage };
module.exports = { parse, render, clone, visitAll, visit, generateToc, filterNodesForLanguage, wrapText };