chore: add link validation for docs (#13047)

This commit is contained in:
Max Schmitt 2022-03-25 19:30:45 +01:00 committed by GitHub
parent 3f1cb7b8e6
commit c8cc62a2e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 237 additions and 181 deletions

View File

@ -155,7 +155,7 @@ await page.Mouse.ClickAsync(box.X + box.Width / 2, box.Y + box.Height / 2);
This method checks the element by performing the following steps:
1. Ensure that element is a checkbox or a radio input. If not, this method throws. If the element is already
checked, this method returns immediately.
1. Wait for [actionability](./actionability.md) checks on the element, unless [`option: force`] option is set.
1. Wait for [actionability](../actionability.md) checks on the element, unless [`option: force`] option is set.
1. Scroll the element into view if needed.
1. Use [`property: Page.mouse`] to click in the center of the element.
1. Wait for initiated navigations to either succeed or fail, unless [`option: noWaitAfter`] option is set.
@ -179,7 +179,7 @@ When all steps combined have not finished during the specified [`option: timeout
## async method: ElementHandle.click
This method clicks the element by performing the following steps:
1. Wait for [actionability](./actionability.md) checks on the element, unless [`option: force`] option is set.
1. Wait for [actionability](../actionability.md) checks on the element, unless [`option: force`] option is set.
1. Scroll the element into view if needed.
1. Use [`property: Page.mouse`] to click in the center of the element, or the specified [`option: position`].
1. Wait for initiated navigations to either succeed or fail, unless [`option: noWaitAfter`] option is set.
@ -217,7 +217,7 @@ Returns the content frame for element handles referencing iframe nodes, or `null
- alias-csharp: DblClickAsync
This method double clicks the element by performing the following steps:
1. Wait for [actionability](./actionability.md) checks on the element, unless [`option: force`] option is set.
1. Wait for [actionability](../actionability.md) checks on the element, unless [`option: force`] option is set.
1. Scroll the element into view if needed.
1. Use [`property: Page.mouse`] to double click in the center of the element, or the specified [`option: position`].
1. Wait for initiated navigations to either succeed or fail, unless [`option: noWaitAfter`] option is set. Note that
@ -343,7 +343,7 @@ Optional event-specific initialization properties.
Returns the return value of [`param: expression`].
The method finds an element matching the specified selector in the `ElementHandle`s subtree and passes it as a first
argument to [`param: expression`]. See [Working with selectors](./selectors.md) for more
argument to [`param: expression`]. See [Working with selectors](../selectors.md) for more
details. If no elements match the selector, the method throws an error.
If [`param: expression`] returns a [Promise], then [`method: ElementHandle.evalOnSelector`] would wait for the promise to resolve and return its
@ -400,7 +400,7 @@ Returns the return value of [`param: expression`].
The method finds all elements matching the specified selector in the `ElementHandle`'s subtree and passes an array of
matched elements as a first argument to [`param: expression`]. See
[Working with selectors](./selectors.md) for more details.
[Working with selectors](../selectors.md) for more details.
If [`param: expression`] returns a [Promise], then [`method: ElementHandle.evalOnSelectorAll`] would wait for the promise to resolve and return its
value.
@ -450,7 +450,7 @@ Optional argument to pass to [`param: expression`].
## async method: ElementHandle.fill
This method 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.
This method 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.
If the target element is not an `<input>`, `<textarea>` or `[contenteditable]` element, this method throws an error. However, if the element is inside the `<label>` element that has an associated [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be filled instead.
@ -482,7 +482,7 @@ Attribute name to get the value for.
## async method: ElementHandle.hover
This method hovers over the element by performing the following steps:
1. Wait for [actionability](./actionability.md) checks on the element, unless [`option: force`] option is set.
1. Wait for [actionability](../actionability.md) checks on the element, unless [`option: force`] option is set.
1. Scroll the element into view if needed.
1. Use [`property: Page.mouse`] to hover over the center of the element, or the specified [`option: position`].
1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
@ -527,27 +527,27 @@ Returns whether the element is checked. Throws if the element is not a checkbox
## async method: ElementHandle.isDisabled
- returns: <[boolean]>
Returns whether the element is disabled, the opposite of [enabled](./actionability.md#enabled).
Returns whether the element is disabled, the opposite of [enabled](../actionability.md#enabled).
## async method: ElementHandle.isEditable
- returns: <[boolean]>
Returns whether the element is [editable](./actionability.md#editable).
Returns whether the element is [editable](../actionability.md#editable).
## async method: ElementHandle.isEnabled
- returns: <[boolean]>
Returns whether the element is [enabled](./actionability.md#enabled).
Returns whether the element is [enabled](../actionability.md#enabled).
## async method: ElementHandle.isHidden
- returns: <[boolean]>
Returns whether the element is hidden, the opposite of [visible](./actionability.md#visible).
Returns whether the element is hidden, the opposite of [visible](../actionability.md#visible).
## async method: ElementHandle.isVisible
- returns: <[boolean]>
Returns whether the element is [visible](./actionability.md#visible).
Returns whether the element is [visible](../actionability.md#visible).
## async method: ElementHandle.ownerFrame
- returns: <[null]|[Frame]>
@ -597,7 +597,7 @@ Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0.
- returns: <[null]|[ElementHandle]>
The method finds an element matching the specified selector in the `ElementHandle`'s subtree. See
[Working with selectors](./selectors.md) for more details. If no elements match the selector,
[Working with selectors](../selectors.md) for more details. If no elements match the selector,
returns `null`.
### param: ElementHandle.querySelector.selector = %%-query-selector-%%
@ -609,7 +609,7 @@ returns `null`.
- returns: <[Array]<[ElementHandle]>>
The method finds all elements matching the specified selector in the `ElementHandle`s subtree. See
[Working with selectors](./selectors.md) for more details. If no elements match the selector,
[Working with selectors](../selectors.md) for more details. If no elements match the selector,
returns empty array.
### param: ElementHandle.querySelectorAll.selector = %%-query-selector-%%
@ -619,14 +619,14 @@ returns empty array.
Returns the buffer with the captured screenshot.
This method waits for the [actionability](./actionability.md) checks, then scrolls element into view before taking a
This method waits for the [actionability](../actionability.md) checks, then scrolls element into view before taking a
screenshot. If the element is detached from DOM, the method throws an error.
### option: ElementHandle.screenshot.-inline- = %%-screenshot-options-common-list-%%
## async method: ElementHandle.scrollIntoViewIfNeeded
This method waits for [actionability](./actionability.md) checks, then tries to scroll element into view, unless it is
This method waits for [actionability](../actionability.md) checks, then tries to scroll element into view, unless it is
completely visible as defined by
[IntersectionObserver](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API)'s `ratio`.
@ -638,7 +638,7 @@ Throws when `elementHandle` does not point to an element
## async method: ElementHandle.selectOption
- returns: <[Array]<[string]>>
This method waits for [actionability](./actionability.md) checks, waits until all specified options are present in the `<select>` element and selects these options.
This method waits for [actionability](../actionability.md) checks, waits until all specified options are present in the `<select>` element and selects these options.
If the target element is not a `<select>` element, this method throws an error. However, if the element is inside the `<label>` element that has an associated [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be used instead.
@ -716,7 +716,7 @@ await handle.SelectOptionAsync(new[] {
## async method: ElementHandle.selectText
This method waits for [actionability](./actionability.md) checks, then focuses the element and selects all its text
This method waits for [actionability](../actionability.md) checks, then focuses the element and selects all its text
content.
### option: ElementHandle.selectText.force = %%-input-force-%%
@ -727,7 +727,7 @@ content.
This method checks or unchecks an element by performing the following steps:
1. Ensure that element is a checkbox or a radio input. If not, this method throws.
1. If the element already has the right checked state, this method returns immediately.
1. Wait for [actionability](./actionability.md) checks on the matched element, unless [`option: force`] option is
1. Wait for [actionability](../actionability.md) checks on the matched element, unless [`option: force`] option is
set. If the element is detached during the checks, the whole action is retried.
1. Scroll the element into view if needed.
1. Use [`property: Page.mouse`] to click in the center of the element.
@ -761,7 +761,7 @@ are resolved relative to the the current working directory. For empty array, cle
## async method: ElementHandle.tap
This method taps the element by performing the following steps:
1. Wait for [actionability](./actionability.md) checks on the element, unless [`option: force`] option is set.
1. Wait for [actionability](../actionability.md) checks on the element, unless [`option: force`] option is set.
1. Scroll the element into view if needed.
1. Use [`property: Page.touchscreen`] to tap the center of the element, or the specified [`option: position`].
1. Wait for initiated navigations to either succeed or fail, unless [`option: noWaitAfter`] option is set.
@ -874,7 +874,7 @@ Time to wait between key presses in milliseconds. Defaults to 0.
This method checks the element by performing the following steps:
1. Ensure that element is a checkbox or a radio input. If not, this method throws. If the element is already
unchecked, this method returns immediately.
1. Wait for [actionability](./actionability.md) checks on the element, unless [`option: force`] option is set.
1. Wait for [actionability](../actionability.md) checks on the element, unless [`option: force`] option is set.
1. Scroll the element into view if needed.
1. Use [`property: Page.mouse`] to click in the center of the element.
1. Wait for initiated navigations to either succeed or fail, unless [`option: noWaitAfter`] option is set.
@ -899,16 +899,16 @@ When all steps combined have not finished during the specified [`option: timeout
Returns when the element satisfies the [`param: state`].
Depending on the [`param: state`] parameter, this method waits for one of the [actionability](./actionability.md) checks
Depending on the [`param: state`] parameter, this method waits for one of the [actionability](../actionability.md) checks
to pass. This method throws when the element is detached while waiting, unless waiting for the `"hidden"` state.
* `"visible"` Wait until the element is [visible](./actionability.md#visible).
* `"hidden"` Wait until the element is [not visible](./actionability.md#visible) or
[not attached](./actionability.md#attached). Note that waiting for hidden does not throw when the element detaches.
* `"stable"` Wait until the element is both [visible](./actionability.md#visible) and
[stable](./actionability.md#stable).
* `"enabled"` Wait until the element is [enabled](./actionability.md#enabled).
* `"disabled"` Wait until the element is [not enabled](./actionability.md#enabled).
* `"editable"` Wait until the element is [editable](./actionability.md#editable).
* `"visible"` Wait until the element is [visible](../actionability.md#visible).
* `"hidden"` Wait until the element is [not visible](../actionability.md#visible) or
[not attached](../actionability.md#attached). Note that waiting for hidden does not throw when the element detaches.
* `"stable"` Wait until the element is both [visible](../actionability.md#visible) and
[stable](../actionability.md#stable).
* `"enabled"` Wait until the element is [enabled](../actionability.md#enabled).
* `"disabled"` Wait until the element is [not enabled](../actionability.md#enabled).
* `"editable"` Wait until the element is [editable](../actionability.md#editable).
If the element does not satisfy the condition for the [`option: timeout`] milliseconds, this method will throw.

View File

@ -6,9 +6,9 @@ Error is raised whenever certain operations are terminated abnormally, e.g.
browser closes while [`method: Page.evaluate`] is running. All Playwright exceptions
inherit from this class.
- [error.message](./api/class-error.mdx#errormessage)
- [error.name](./api/class-error.mdx#errorname)
- [error.stack](./api/class-error.mdx#errorstack)
- [error.message](./class-error.md#errormessage)
- [error.name](./class-error.md#errorname)
- [error.stack](./class-error.md#errorstack)
## property: Error.message
- returns: <[str]>

View File

@ -183,7 +183,7 @@ This method checks an element matching [`param: selector`] by performing the fol
the DOM.
1. Ensure that matched element is a checkbox or a radio input. If not, this method throws. If the element is already
checked, this method returns immediately.
1. Wait for [actionability](./actionability.md) checks on the matched element, unless [`option: force`] option is
1. Wait for [actionability](../actionability.md) checks on the matched element, unless [`option: force`] option is
set. If the element is detached during the checks, the whole action is retried.
1. Scroll the element into view if needed.
1. Use [`property: Page.mouse`] to click in the center of the element.
@ -210,7 +210,7 @@ When all steps combined have not finished during the specified [`option: timeout
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
the DOM.
1. Wait for [actionability](./actionability.md) checks on the matched element, unless [`option: force`] option is
1. Wait for [actionability](../actionability.md) checks on the matched element, unless [`option: force`] option is
set. If the element is detached during the checks, the whole action is retried.
1. Scroll the element into view if needed.
1. Use [`property: Page.mouse`] to click in the center of the element, or the specified [`option: position`].
@ -244,7 +244,7 @@ Gets the full HTML contents of the frame, including the doctype.
This method double 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
the DOM.
1. Wait for [actionability](./actionability.md) checks on the matched element, unless [`option: force`] option is
1. Wait for [actionability](../actionability.md) checks on the matched element, unless [`option: force`] option is
set. If the element is detached during the checks, the whole action is retried.
1. Scroll the element into view if needed.
1. Use [`property: Page.mouse`] to double click in the center of the element, or the specified [`option: position`].
@ -389,7 +389,7 @@ the flaky tests. Use [`method: Locator.evaluate`], other [Locator] helper method
:::
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
[`param: expression`]. See [Working with selectors](../selectors.md) for more details. If no
elements match the selector, the method throws an error.
If [`param: expression`] returns a [Promise], then [`method: Frame.evalOnSelector`] would wait for the promise to resolve and return its
@ -449,7 +449,7 @@ In most cases, [`method: Locator.evaluateAll`], other [Locator] helper methods a
:::
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
as a first argument to [`param: expression`]. See [Working with selectors](../selectors.md) for
more details.
If [`param: expression`] returns a [Promise], then [`method: Frame.evalOnSelectorAll`] would wait for the promise to resolve and return its
@ -695,7 +695,7 @@ Optional argument to pass to [`param: expression`].
## async method: Frame.fill
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.
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.
If the target element is not an `<input>`, `<textarea>` or `[contenteditable]` element, this method throws an error. However, if the element is inside the `<label>` element that has an associated [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be filled instead.
@ -863,7 +863,7 @@ Referer header value. If provided it will take preference over the referer heade
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
the DOM.
1. Wait for [actionability](./actionability.md) checks on the matched element, unless [`option: force`] option is
1. Wait for [actionability](../actionability.md) checks on the matched element, unless [`option: force`] option is
set. If the element is detached during the checks, the whole action is retried.
1. Scroll the element into view if needed.
1. Use [`property: Page.mouse`] to hover over the center of the element, or the specified [`option: position`].
@ -929,7 +929,7 @@ Returns `true` if the frame has been detached, or `false` otherwise.
## async method: Frame.isDisabled
- returns: <[boolean]>
Returns whether the element is disabled, the opposite of [enabled](./actionability.md#enabled).
Returns whether the element is disabled, the opposite of [enabled](../actionability.md#enabled).
### param: Frame.isDisabled.selector = %%-input-selector-%%
@ -939,7 +939,7 @@ Returns whether the element is disabled, the opposite of [enabled](./actionabili
## async method: Frame.isEditable
- returns: <[boolean]>
Returns whether the element is [editable](./actionability.md#editable).
Returns whether the element is [editable](../actionability.md#editable).
### param: Frame.isEditable.selector = %%-input-selector-%%
@ -949,7 +949,7 @@ Returns whether the element is [editable](./actionability.md#editable).
## async method: Frame.isEnabled
- returns: <[boolean]>
Returns whether the element is [enabled](./actionability.md#enabled).
Returns whether the element is [enabled](../actionability.md#enabled).
### param: Frame.isEnabled.selector = %%-input-selector-%%
@ -959,7 +959,7 @@ Returns whether the element is [enabled](./actionability.md#enabled).
## async method: Frame.isHidden
- 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.
Returns whether the element is hidden, the opposite of [visible](../actionability.md#visible). [`option: selector`] that does not match any elements is considered hidden.
### param: Frame.isHidden.selector = %%-input-selector-%%
@ -972,7 +972,7 @@ Returns whether the element is hidden, the opposite of [visible](./actionability
## async method: Frame.isVisible
- returns: <[boolean]>
Returns whether the element is [visible](./actionability.md#visible). [`option: selector`] that does not match any elements is considered not visible.
Returns whether the element is [visible](../actionability.md#visible). [`option: selector`] that does not match any elements is considered not visible.
### param: Frame.isVisible.selector = %%-input-selector-%%
@ -1061,7 +1061,7 @@ The use of [ElementHandle] is discouraged, use [Locator] objects and web-first a
:::
The method finds an element matching the specified selector within the frame. See
[Working with selectors](./selectors.md) for more details. If no elements match the selector,
[Working with selectors](../selectors.md) for more details. If no elements match the selector,
returns `null`.
### param: Frame.querySelector.selector = %%-query-selector-%%
@ -1081,7 +1081,7 @@ The use of [ElementHandle] is discouraged, use [Locator] objects instead.
:::
The method finds all elements matching the specified selector within the frame. See
[Working with selectors](./selectors.md) for more details. If no elements match the selector,
[Working with selectors](../selectors.md) for more details. If no elements match the selector,
returns empty array.
### param: Frame.querySelectorAll.selector = %%-query-selector-%%
@ -1089,7 +1089,7 @@ returns empty array.
## async method: Frame.selectOption
- 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.
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.
If the target element is not a `<select>` element, this method throws an error. However, if the element is inside the `<label>` element that has an associated [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be used instead.
@ -1159,7 +1159,7 @@ This method checks or unchecks an element matching [`param: selector`] by perfor
the DOM.
1. Ensure that matched element is a checkbox or a radio input. If not, this method throws.
1. If the element already has the right checked state, this method returns immediately.
1. Wait for [actionability](./actionability.md) checks on the matched element, unless [`option: force`] option is
1. Wait for [actionability](../actionability.md) checks on the matched element, unless [`option: force`] option is
set. If the element is detached during the checks, the whole action is retried.
1. Scroll the element into view if needed.
1. Use [`property: Page.mouse`] to click in the center of the element.
@ -1209,7 +1209,7 @@ are resolved relative to the the current working directory. For empty array, cle
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
the DOM.
1. Wait for [actionability](./actionability.md) checks on the matched element, unless [`option: force`] option is
1. Wait for [actionability](../actionability.md) checks on the matched element, unless [`option: force`] option is
set. If the element is detached during the checks, the whole action is retried.
1. Scroll the element into view if needed.
1. Use [`property: Page.touchscreen`] to tap the center of the element, or the specified [`option: position`].
@ -1304,7 +1304,7 @@ This method checks an element matching [`param: selector`] by performing the fol
the DOM.
1. Ensure that matched element is a checkbox or a radio input. If not, this method throws. If the element is already
unchecked, this method returns immediately.
1. Wait for [actionability](./actionability.md) checks on the matched element, unless [`option: force`] option is
1. Wait for [actionability](../actionability.md) checks on the matched element, unless [`option: force`] option is
set. If the element is detached during the checks, the whole action is retried.
1. Scroll the element into view if needed.
1. Use [`property: Page.mouse`] to click in the center of the element.

View File

@ -3,7 +3,7 @@
Locators are the central piece of Playwright's auto-waiting and retry-ability. In a nutshell, locators represent
a way to find element(s) on the page at any moment. Locator can be created with the [`method: Page.locator`] method.
[Learn more about locators](./locators.md).
[Learn more about locators](../locators.md).
## async method: Locator.allInnerTexts
- returns: <[Array]<[string]>>
@ -67,7 +67,7 @@ await page.Mouse.ClickAsync(box.X + box.Width / 2, box.Y + box.Height / 2);
This method checks the element by performing the following steps:
1. Ensure that element is a checkbox or a radio input. If not, this method throws. If the element is already
checked, this method returns immediately.
1. Wait for [actionability](./actionability.md) checks on the element, unless [`option: force`] option is set.
1. Wait for [actionability](../actionability.md) checks on the element, unless [`option: force`] option is set.
1. Scroll the element into view if needed.
1. Use [`property: Page.mouse`] to click in the center of the element.
1. Wait for initiated navigations to either succeed or fail, unless [`option: noWaitAfter`] option is set.
@ -87,7 +87,7 @@ When all steps combined have not finished during the specified [`option: timeout
## async method: Locator.click
This method clicks the element by performing the following steps:
1. Wait for [actionability](./actionability.md) checks on the element, unless [`option: force`] option is set.
1. Wait for [actionability](../actionability.md) checks on the element, unless [`option: force`] option is set.
1. Scroll the element into view if needed.
1. Use [`property: Page.mouse`] to click in the center of the element, or the specified [`option: position`].
1. Wait for initiated navigations to either succeed or fail, unless [`option: noWaitAfter`] option is set.
@ -117,7 +117,7 @@ Returns the number of elements matching given selector.
- alias-csharp: DblClickAsync
This method double clicks the element by performing the following steps:
1. Wait for [actionability](./actionability.md) checks on the element, unless [`option: force`] option is set.
1. Wait for [actionability](../actionability.md) checks on the element, unless [`option: force`] option is set.
1. Scroll the element into view if needed.
1. Use [`property: Page.mouse`] to double click in the center of the element, or the specified [`option: position`].
1. Wait for initiated navigations to either succeed or fail, unless [`option: noWaitAfter`] option is set. Note that
@ -369,7 +369,7 @@ Optional argument to pass to [`param: expression`].
## async method: Locator.fill
This method 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.
This method 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.
If the target element is not an `<input>`, `<textarea>` or `[contenteditable]` element, this method throws an error. However, if the element is inside the `<label>` element that has an associated [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be filled instead.
@ -449,7 +449,7 @@ Highlight the corresponding element(s) on the screen. Useful for debugging, don'
## async method: Locator.hover
This method hovers over the element by performing the following steps:
1. Wait for [actionability](./actionability.md) checks on the element, unless [`option: force`] option is set.
1. Wait for [actionability](../actionability.md) checks on the element, unless [`option: force`] option is set.
1. Scroll the element into view if needed.
1. Use [`property: Page.mouse`] to hover over the center of the element, or the specified [`option: position`].
1. Wait for initiated navigations to either succeed or fail, unless `noWaitAfter` option is set.
@ -496,28 +496,28 @@ Returns whether the element is checked. Throws if the element is not a checkbox
## async method: Locator.isDisabled
- returns: <[boolean]>
Returns whether the element is disabled, the opposite of [enabled](./actionability.md#enabled).
Returns whether the element is disabled, the opposite of [enabled](../actionability.md#enabled).
### option: Locator.isDisabled.timeout = %%-input-timeout-%%
## async method: Locator.isEditable
- returns: <[boolean]>
Returns whether the element is [editable](./actionability.md#editable).
Returns whether the element is [editable](../actionability.md#editable).
### option: Locator.isEditable.timeout = %%-input-timeout-%%
## async method: Locator.isEnabled
- returns: <[boolean]>
Returns whether the element is [enabled](./actionability.md#enabled).
Returns whether the element is [enabled](../actionability.md#enabled).
### option: Locator.isEnabled.timeout = %%-input-timeout-%%
## async method: Locator.isHidden
- returns: <[boolean]>
Returns whether the element is hidden, the opposite of [visible](./actionability.md#visible).
Returns whether the element is hidden, the opposite of [visible](../actionability.md#visible).
### option: Locator.isHidden.timeout
- `timeout` <[float]>
@ -527,7 +527,7 @@ Returns whether the element is hidden, the opposite of [visible](./actionability
## async method: Locator.isVisible
- returns: <[boolean]>
Returns whether the element is [visible](./actionability.md#visible).
Returns whether the element is [visible](../actionability.md#visible).
### option: Locator.isVisible.timeout
- `timeout` <[float]>
@ -601,14 +601,14 @@ Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0.
Returns the buffer with the captured screenshot.
This method waits for the [actionability](./actionability.md) checks, then scrolls element into view before taking a
This method waits for the [actionability](../actionability.md) checks, then scrolls element into view before taking a
screenshot. If the element is detached from DOM, the method throws an error.
### option: Locator.screenshot.-inline- = %%-screenshot-options-common-list-%%
## async method: Locator.scrollIntoViewIfNeeded
This method waits for [actionability](./actionability.md) checks, then tries to scroll element into view, unless it is
This method waits for [actionability](../actionability.md) checks, then tries to scroll element into view, unless it is
completely visible as defined by
[IntersectionObserver](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API)'s `ratio`.
@ -617,7 +617,7 @@ completely visible as defined by
## async method: Locator.selectOption
- returns: <[Array]<[string]>>
This method waits for [actionability](./actionability.md) checks, waits until all specified options are present in the `<select>` element and selects these options.
This method waits for [actionability](../actionability.md) checks, waits until all specified options are present in the `<select>` element and selects these options.
If the target element is not a `<select>` element, this method throws an error. However, if the element is inside the `<label>` element that has an associated [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be used instead.
@ -695,7 +695,7 @@ await element.SelectOptionAsync(new[] {
## async method: Locator.selectText
This method waits for [actionability](./actionability.md) checks, then focuses the element and selects all its text
This method waits for [actionability](../actionability.md) checks, then focuses the element and selects all its text
content.
### option: Locator.selectText.force = %%-input-force-%%
@ -706,7 +706,7 @@ content.
This method checks or unchecks an element by performing the following steps:
1. Ensure that matched element is a checkbox or a radio input. If not, this method throws.
1. If the element already has the right checked state, this method returns immediately.
1. Wait for [actionability](./actionability.md) checks on the matched element, unless [`option: force`] option is
1. Wait for [actionability](../actionability.md) checks on the matched element, unless [`option: force`] option is
set. If the element is detached during the checks, the whole action is retried.
1. Scroll the element into view if needed.
1. Use [`property: Page.mouse`] to click in the center of the element.
@ -738,7 +738,7 @@ are resolved relative to the the current working directory. For empty array, cle
## async method: Locator.tap
This method taps the element by performing the following steps:
1. Wait for [actionability](./actionability.md) checks on the element, unless [`option: force`] option is set.
1. Wait for [actionability](../actionability.md) checks on the element, unless [`option: force`] option is set.
1. Scroll the element into view if needed.
1. Use [`property: Page.touchscreen`] to tap the center of the element, or the specified [`option: position`].
1. Wait for initiated navigations to either succeed or fail, unless [`option: noWaitAfter`] option is set.
@ -847,7 +847,7 @@ Time to wait between key presses in milliseconds. Defaults to 0.
This method checks the element by performing the following steps:
1. Ensure that element is a checkbox or a radio input. If not, this method throws. If the element is already
unchecked, this method returns immediately.
1. Wait for [actionability](./actionability.md) checks on the element, unless [`option: force`] option is set.
1. Wait for [actionability](../actionability.md) checks on the element, unless [`option: force`] option is set.
1. Scroll the element into view if needed.
1. Use [`property: Page.mouse`] to click in the center of the element.
1. Wait for initiated navigations to either succeed or fail, unless [`option: noWaitAfter`] option is set.

View File

@ -670,7 +670,7 @@ This method checks an element matching [`param: selector`] by performing the fol
the DOM.
1. Ensure that matched element is a checkbox or a radio input. If not, this method throws. If the element is already
checked, this method returns immediately.
1. Wait for [actionability](./actionability.md) checks on the matched element, unless [`option: force`] option is
1. Wait for [actionability](../actionability.md) checks on the matched element, unless [`option: force`] option is
set. If the element is detached during the checks, the whole action is retried.
1. Scroll the element into view if needed.
1. Use [`property: Page.mouse`] to click in the center of the element.
@ -696,7 +696,7 @@ Shortcut for main frame's [`method: Frame.check`].
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
the DOM.
1. Wait for [actionability](./actionability.md) checks on the matched element, unless [`option: force`] option is
1. Wait for [actionability](../actionability.md) checks on the matched element, unless [`option: force`] option is
set. If the element is detached during the checks, the whole action is retried.
1. Scroll the element into view if needed.
1. Use [`property: Page.mouse`] to click in the center of the element, or the specified [`option: position`].
@ -765,7 +765,7 @@ Browser-specific Coverage implementation. See [Coverage](#class-coverage) for mo
This method double 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
the DOM.
1. Wait for [actionability](./actionability.md) checks on the matched element, unless [`option: force`] option is
1. Wait for [actionability](../actionability.md) checks on the matched element, unless [`option: force`] option is
set. If the element is detached during the checks, the whole action is retried.
1. Scroll the element into view if needed.
1. Use [`property: Page.mouse`] to double click in the center of the element, or the specified [`option: position`].
@ -1837,7 +1837,7 @@ Callback function which will be called in Playwright's context.
## async method: Page.fill
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.
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.
If the target element is not an `<input>`, `<textarea>` or `[contenteditable]` element, this method throws an error. However, if the element is inside the `<label>` element that has an associated [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be filled instead.
@ -2066,7 +2066,7 @@ Referer header value. If provided it will take preference over the referer heade
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
the DOM.
1. Wait for [actionability](./actionability.md) checks on the matched element, unless [`option: force`] option is
1. Wait for [actionability](../actionability.md) checks on the matched element, unless [`option: force`] option is
set. If the element is detached during the checks, the whole action is retried.
1. Scroll the element into view if needed.
1. Use [`property: Page.mouse`] to hover over the center of the element, or the specified [`option: position`].
@ -2135,7 +2135,7 @@ Indicates that the page has been closed.
## async method: Page.isDisabled
- returns: <[boolean]>
Returns whether the element is disabled, the opposite of [enabled](./actionability.md#enabled).
Returns whether the element is disabled, the opposite of [enabled](../actionability.md#enabled).
### param: Page.isDisabled.selector = %%-input-selector-%%
@ -2145,7 +2145,7 @@ Returns whether the element is disabled, the opposite of [enabled](./actionabili
## async method: Page.isEditable
- returns: <[boolean]>
Returns whether the element is [editable](./actionability.md#editable).
Returns whether the element is [editable](../actionability.md#editable).
### param: Page.isEditable.selector = %%-input-selector-%%
@ -2155,7 +2155,7 @@ Returns whether the element is [editable](./actionability.md#editable).
## async method: Page.isEnabled
- returns: <[boolean]>
Returns whether the element is [enabled](./actionability.md#enabled).
Returns whether the element is [enabled](../actionability.md#enabled).
### param: Page.isEnabled.selector = %%-input-selector-%%
@ -2165,7 +2165,7 @@ Returns whether the element is [enabled](./actionability.md#enabled).
## async method: Page.isHidden
- 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.
Returns whether the element is hidden, the opposite of [visible](../actionability.md#visible). [`option: selector`] that does not match any elements is considered hidden.
### param: Page.isHidden.selector = %%-input-selector-%%
@ -2178,7 +2178,7 @@ Returns whether the element is hidden, the opposite of [visible](./actionability
## async method: Page.isVisible
- returns: <[boolean]>
Returns whether the element is [visible](./actionability.md#visible). [`option: selector`] that does not match any elements is considered not visible.
Returns whether the element is [visible](../actionability.md#visible). [`option: selector`] that does not match any elements is considered not visible.
### param: Page.isVisible.selector = %%-input-selector-%%
@ -2741,7 +2741,7 @@ Returns the buffer with the captured screenshot.
## async method: Page.selectOption
- 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.
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.
If the target element is not a `<select>` element, this method throws an error. However, if the element is inside the `<label>` element that has an associated [control](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control), the control will be used instead.
@ -2813,7 +2813,7 @@ This method checks or unchecks an element matching [`param: selector`] by perfor
the DOM.
1. Ensure that matched element is a checkbox or a radio input. If not, this method throws.
1. If the element already has the right checked state, this method returns immediately.
1. Wait for [actionability](./actionability.md) checks on the matched element, unless [`option: force`] option is
1. Wait for [actionability](../actionability.md) checks on the matched element, unless [`option: force`] option is
set. If the element is detached during the checks, the whole action is retried.
1. Scroll the element into view if needed.
1. Use [`property: Page.mouse`] to click in the center of the element.
@ -2968,7 +2968,7 @@ await page.GotoAsync("https://www.microsoft.com");
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
the DOM.
1. Wait for [actionability](./actionability.md) checks on the matched element, unless [`option: force`] option is
1. Wait for [actionability](../actionability.md) checks on the matched element, unless [`option: force`] option is
set. If the element is detached during the checks, the whole action is retried.
1. Scroll the element into view if needed.
1. Use [`property: Page.touchscreen`] to tap the center of the element, or the specified [`option: position`].
@ -3070,7 +3070,7 @@ This method unchecks an element matching [`param: selector`] by performing the f
the DOM.
1. Ensure that matched element is a checkbox or a radio input. If not, this method throws. If the element is already
unchecked, this method returns immediately.
1. Wait for [actionability](./actionability.md) checks on the matched element, unless [`option: force`] option is
1. Wait for [actionability](../actionability.md) checks on the matched element, unless [`option: force`] option is
set. If the element is detached during the checks, the whole action is retried.
1. Scroll the element into view if needed.
1. Use [`property: Page.mouse`] to click in the center of the element.
@ -3532,7 +3532,7 @@ Receives the [Page] object and resolves to truthy value when the waiting should
* alias-csharp: RunAndWaitForRequest
- returns: <[Request]>
Waits for the matching request and returns it. See [waiting for event](./events.md#waiting-for-event) for more details about events.
Waits for the matching request and returns it. See [waiting for event](../events.md#waiting-for-event) for more details about events.
```js
// Note that Promise.all prevents a race condition
@ -3649,7 +3649,7 @@ Receives the [Request] object and resolves to truthy value when the waiting shou
* alias-csharp: RunAndWaitForResponse
- returns: <[Response]>
Returns the matched response. See [waiting for event](./events.md#waiting-for-event) for more details about events.
Returns the matched response. See [waiting for event](../events.md#waiting-for-event) for more details about events.
```js
// Note that Promise.all prevents a race condition

View File

@ -224,7 +224,7 @@ Exposes API that can be used for the Web API testing.
- type: <[Selectors]>
Selectors can be used to install custom selector engines. See
[Working with selectors](./selectors.md) for more information.
[Working with selectors](../selectors.md) for more information.
## property: Playwright.webkit
- type: <[BrowserType]>

View File

@ -1,6 +1,6 @@
# class: Selectors
Selectors can be used to install custom selector engines. See [Working with selectors](./selectors.md) for more
Selectors can be used to install custom selector engines. See [Working with selectors](../selectors.md) for more
information.
## async method: Selectors.register

View File

@ -1,6 +1,6 @@
# class: Tracing
API for collecting and saving Playwright traces. Playwright traces can be opened in [Trace Viewer](./trace-viewer.md) after Playwright script runs.
API for collecting and saving Playwright traces. Playwright traces can be opened in [Trace Viewer](../trace-viewer.md) after Playwright script runs.
Start recording a trace before performing actions. At the end, stop tracing and save it to a file.

View File

@ -46,23 +46,23 @@ to inaccessible pages. Defaults to `false`.
## input-force
- `force` <[boolean]>
Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
Whether to bypass the [actionability](../actionability.md) checks. Defaults to `false`.
## input-selector
- `selector` <[string]>
A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. See
[working with selectors](./selectors.md) for more details.
[working with selectors](../selectors.md) for more details.
## input-source
- `source` <[string]>
A selector to search for an element to drag. If there are multiple elements satisfying the selector, the first will be used. See
[working with selectors](./selectors.md) for more details.
[working with selectors](../selectors.md) for more details.
## input-target
- `target` <[string]>
A selector to search for an element to drop onto. If there are multiple elements satisfying the selector, the first will be used. See
[working with selectors](./selectors.md) for more details.
[working with selectors](../selectors.md) for more details.
## input-position
- `position` <[Object]>
@ -102,7 +102,7 @@ defaults to 1. See [UIEvent.detail].
## input-trial
- `trial` <[boolean]>
When set, this method only performs the [actionability](./actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it.
When set, this method only performs the [actionability](../actionability.md) checks and skips the action. Defaults to `false`. Useful to wait until the element is ready for the action without performing it.
## input-source-position
- `sourcePosition` <[Object]>
@ -128,12 +128,12 @@ Whether to check or uncheck the checkbox.
## query-selector
- `selector` <[string]>
A selector to query for. See [working with selectors](./selectors.md) for more details.
A selector to query for. See [working with selectors](../selectors.md) for more details.
## find-selector
- `selector` <[string]>
A selector to use when resolving DOM element. See [working with selectors](./selectors.md) for more details.
A selector to use when resolving DOM element. See [working with selectors](../selectors.md) for more details.
## wait-for-selector-state
- `state` <[WaitForSelectorState]<"attached"|"detached"|"visible"|"hidden">>
@ -778,7 +778,7 @@ Additional arguments to pass to the browser instance. The list of Chromium flags
## browser-option-channel
- `channel` <[string]>
Browser distribution channel. Supported values are "chrome", "chrome-beta", "chrome-dev", "chrome-canary", "msedge", "msedge-beta", "msedge-dev", "msedge-canary". Read more about using [Google Chrome and Microsoft Edge](./browsers.md#google-chrome--microsoft-edge).
Browser distribution channel. Supported values are "chrome", "chrome-beta", "chrome-dev", "chrome-canary", "msedge", "msedge-beta", "msedge-dev", "msedge-canary". Read more about using [Google Chrome and Microsoft Edge](../browsers.md#google-chrome--microsoft-edge).
## browser-option-chromiumsandbox
- `chromiumSandbox` <[boolean]>

View File

@ -221,7 +221,7 @@ Previously it was not possible to get multiple header values of a response. This
- [Response.AllHeadersAsync()](https://playwright.dev/dotnet/docs/next/api/class-response#response-all-headers)
- [Response.HeadersArrayAsync()](https://playwright.dev/dotnet/docs/next/api/class-response#response-headers-array)
- [Response.HeaderValueAsync(name: string)](https://playwright.dev/dotnet/docs/next/api/class-response#response-header-value)
- [Response.HeaderValuesAsync(name: string)](https://playwright.dev/dotnet/docs/next/api/class-response/#response-header-values)
- [Response.HeaderValuesAsync(name: string)](https://playwright.dev/dotnet/docs/next/api/class-response#response-header-values)
### 🌈 Forced-Colors emulation

View File

@ -243,7 +243,7 @@ Previously it was not possible to get multiple header values of a response. This
- [Response.allHeaders()](https://playwright.dev/java/docs/api/class-response#response-all-headers)
- [Response.headersArray()](https://playwright.dev/java/docs/api/class-response#response-headers-array)
- [Response.headerValue(name: string)](https://playwright.dev/java/docs/api/class-response#response-header-value)
- [Response.headerValues(name: string)](https://playwright.dev/java/docs/api/class-response/#response-header-values)
- [Response.headerValues(name: string)](https://playwright.dev/java/docs/api/class-response#response-header-values)
### 🌈 Forced-Colors emulation

View File

@ -395,7 +395,7 @@ trace and image artifacts.
![html reporter](https://user-images.githubusercontent.com/746130/138324311-94e68b39-b51a-4776-a446-f60037a77f32.png)
Read more about [our reporters](./test-reporters/#html-reporter).
Read more about [our reporters](./test-reporters#html-reporter).
### 🎭 Playwright Library
@ -463,7 +463,7 @@ Previously it was not possible to get multiple header values of a response. This
- [Response.allHeaders()](https://playwright.dev/docs/api/class-response#response-all-headers)
- [Response.headersArray()](https://playwright.dev/docs/api/class-response#response-headers-array)
- [Response.headerValue(name: string)](https://playwright.dev/docs/api/class-response#response-header-value)
- [Response.headerValues(name: string)](https://playwright.dev/docs/api/class-response/#response-header-values)
- [Response.headerValues(name: string)](https://playwright.dev/docs/api/class-response#response-header-values)
#### 🌈 Forced-Colors emulation
@ -571,7 +571,7 @@ Consider the following example:
await expect(page.locator('.status')).toHaveText('Submitted');
```
Playwright Test will be re-testing the node with the selector `.status` until fetched Node has the `"Submitted"` text. It will be re-fetching the node and checking it over and over, until the condition is met or until the timeout is reached. You can either pass this timeout or configure it once via the [`testProject.expect`](./api/class-testproject/#test-project-expect) value in test config.
Playwright Test will be re-testing the node with the selector `.status` until fetched Node has the `"Submitted"` text. It will be re-fetching the node and checking it over and over, until the condition is met or until the timeout is reached. You can either pass this timeout or configure it once via the [`testProject.expect`](./api/class-testproject#test-project-expect) value in test config.
By default, the timeout for assertions is not set, so it'll wait forever, until the whole test times out.
@ -631,7 +631,7 @@ Step information is exposed in reporters API.
#### 🌎 Launch web server before running tests
To launch a server during the tests, use the [`webServer`](./test-advanced/#launching-a-development-web-server-during-the-tests) option in the configuration file. The server will wait for a given port to be available before running the tests, and the port will be passed over to Playwright as a [`baseURL`](./api/class-fixtures#fixtures-base-url) when creating a context.
To launch a server during the tests, use the [`webServer`](./test-advanced#launching-a-development-web-server-during-the-tests) option in the configuration file. The server will wait for a given port to be available before running the tests, and the port will be passed over to Playwright as a [`baseURL`](./api/class-fixtures#fixtures-base-url) when creating a context.
```ts
// playwright.config.ts

View File

@ -262,7 +262,7 @@ Previously it was not possible to get multiple header values of a response. This
- [Response.all_headers()](https://playwright.dev/python/docs/api/class-response#response-all-headers)
- [Response.headers_array()](https://playwright.dev/python/docs/api/class-response#response-headers-array)
- [Response.header_value(name: str)](https://playwright.dev/python/docs/api/class-response#response-header-value)
- [Response.header_values(name: str)](https://playwright.dev/python/docs/api/class-response/#response-header-values)
- [Response.header_values(name: str)](https://playwright.dev/python/docs/api/class-response#response-header-values)
### 🌈 Forced-Colors emulation

View File

@ -1,7 +1,7 @@
# class: Fixtures
* langs: js
Playwright Test is based on the concept of the [test fixtures](./test-fixtures.md). Test fixtures are used to establish environment for each test, giving the test everything it needs and nothing else.
Playwright Test is based on the concept of the [test fixtures](../test-fixtures.md). Test fixtures are used to establish environment for each test, giving the test everything it needs and nothing else.
Playwright Test looks at each test declaration, analyses the set of fixtures the test needs and prepares those fixtures specifically for the test. Values prepared by the fixtures are merged into a single object that is available to the `test`, hooks, annotations and other fixtures as a first parameter.
@ -28,14 +28,14 @@ Playwright Test comes with builtin fixtures listed below, and you can add your o
## property: Fixtures.browser
- type: <[Browser]>
[Browser] instance is shared between all tests in the [same worker](./test-parallel.md) - this makes testing efficient. However, each test runs in an isolated [BrowserContext] and gets a fresh environment.
[Browser] instance is shared between all tests in the [same worker](../test-parallel.md) - this makes testing efficient. However, each test runs in an isolated [BrowserContext] and gets a fresh environment.
Learn how to [configure browser](./test-configuration.md) and see [available options][TestOptions].
Learn how to [configure browser](../test-configuration.md) and see [available options][TestOptions].
## property: Fixtures.browserName
- type: <[BrowserName]<"chromium"|"firefox"|"webkit">>
Name of the browser that runs tests. Defaults to `'chromium'`. Useful to [annotate tests](./test-annotations.md) based on the browser.
Name of the browser that runs tests. Defaults to `'chromium'`. Useful to [annotate tests](../test-annotations.md) based on the browser.
```js js-flavor=js
test('skip this test in Firefox', async ({ page, browserName }) => {
@ -56,7 +56,7 @@ test('skip this test in Firefox', async ({ page, browserName }) => {
Isolated [BrowserContext] instance, created for each test. Since contexts are isolated between each other, every test gets a fresh environment, even when multiple tests run in a single [Browser] for maximum efficiency.
Learn how to [configure context](./test-configuration.md) and see [available options][TestOptions].
Learn how to [configure context](../test-configuration.md) and see [available options][TestOptions].
Default [`property: Fixtures.page`] belongs to this context.

View File

@ -63,7 +63,7 @@ Test function that takes one or two arguments: an object with fixtures and optio
Declares an `afterAll` hook that is executed once per worker after all tests. When called in the scope of a test file, runs after all tests in the file. When called inside a [`method: Test.describe`] group, runs after all tests in the group. If multiple `afterAll` hooks are added, they will run in the order of their registration.
Note that worker process is restarted on test failures, and `afterAll` hook runs again in the new worker. Learn more about [workers and failures](./test-retries.md).
Note that worker process is restarted on test failures, and `afterAll` hook runs again in the new worker. Learn more about [workers and failures](../test-retries.md).
### param: Test.afterAll.hookFunction
- `hookFunction` <[function]\([Fixtures], [TestInfo]\)>
@ -154,7 +154,7 @@ test('my test', async ({ page }) => {
});
```
Note that worker process is restarted on test failures, and `beforeAll` hook runs again in the new worker. Learn more about [workers and failures](./test-retries.md).
Note that worker process is restarted on test failures, and `beforeAll` hook runs again in the new worker. Learn more about [workers and failures](../test-retries.md).
You can use [`method: Test.afterAll`] to teardown any resources set up in `beforeAll`.
@ -253,7 +253,7 @@ A callback that is run immediately when calling [`method: Test.describe`]. Any t
Set execution mode of execution for the enclosing scope. Can be executed either on the top level or inside a describe. Configuration applies to the entire scope, regardless of whether it run before or after the test
declaration.
Learn more about the execution modes [here](./test-parallel.md).
Learn more about the execution modes [here](../test-parallel.md).
Running tests in parallel:
@ -619,12 +619,12 @@ const config: PlaywrightTestConfig<Options> = {
export default config;
```
Learn more about [fixtures](./test-fixtures.md) and [parametrizing tests](./test-parameterize.md).
Learn more about [fixtures](../test-fixtures.md) and [parametrizing tests](../test-parameterize.md).
### param: Test.extend.fixtures
- `fixtures` <[Object]>
An object containing fixtures and/or options. Learn more about [fixtures format](./test-fixtures.md).
An object containing fixtures and/or options. Learn more about [fixtures format](../test-fixtures.md).
@ -912,7 +912,7 @@ Test function that takes one or two arguments: an object with fixtures and optio
## method: Test.setTimeout
Changes the timeout for the test. Zero means no timeout. Learn more about [various timeouts](./test-timeouts.md).
Changes the timeout for the test. Zero means no timeout. Learn more about [various timeouts](../test-timeouts.md).
```js js-flavor=js
const { test, expect } = require('@playwright/test');

View File

@ -1,7 +1,7 @@
# class: TestConfig
* langs: js
Playwright Test provides many options to configure how your tests are collected and executed, for example `timeout` or `testDir`. These options are described in the [TestConfig] object in the [configuration file](./test-configuration.md).
Playwright Test provides many options to configure how your tests are collected and executed, for example `timeout` or `testDir`. These options are described in the [TestConfig] object in the [configuration file](../test-configuration.md).
Playwright Test supports running multiple test projects at the same time. Project-specific options should be put to [`property: TestConfig.projects`], but top-level [TestConfig] can also define base options shared between all projects.
@ -49,7 +49,7 @@ export default config;
- `maxDiffPixels` <[int]> an acceptable amount of pixels that could be different, unset by default.
- `maxDiffPixelRatio` <[float]> an acceptable ratio of pixels that are different to the total amount of pixels, between `0` and `1` , unset by default.
Configuration for the `expect` assertion library. Learn more about [various timeouts](./test-timeouts.md).
Configuration for the `expect` assertion library. Learn more about [various timeouts](../test-timeouts.md).
```js js-flavor=js
// playwright.config.js
@ -123,7 +123,7 @@ You can configure entire test run to concurrently execute all tests in all files
Path to the global setup file. This file will be required and run before all the tests. It must export a single function that takes a [`TestConfig`] argument.
Learn more about [global setup and teardown](./test-advanced.md#global-setup-and-teardown).
Learn more about [global setup and teardown](../test-advanced.md#global-setup-and-teardown).
```js js-flavor=js
// playwright.config.js
@ -152,7 +152,7 @@ export default config;
Path to the global teardown file. This file will be required and run after all the tests. It must export a single function. See also [`property: TestConfig.globalSetup`].
Learn more about [global setup and teardown](./test-advanced.md#global-setup-and-teardown).
Learn more about [global setup and teardown](../test-advanced.md#global-setup-and-teardown).
```js js-flavor=js
// playwright.config.js
@ -179,7 +179,7 @@ export default config;
## property: TestConfig.globalTimeout
- type: <[int]>
Maximum time in milliseconds the whole test suite can run. Zero timeout (default) disables this behavior. Useful on CI to prevent broken setup from running too long and wasting resources. Learn more about [various timeouts](./test-timeouts.md).
Maximum time in milliseconds the whole test suite can run. Zero timeout (default) disables this behavior. Useful on CI to prevent broken setup from running too long and wasting resources. Learn more about [various timeouts](../test-timeouts.md).
```js js-flavor=js
// playwright.config.js
@ -206,17 +206,17 @@ export default config;
## property: TestConfig.grep
- type: <[RegExp]|[Array]<[RegExp]>>
Filter to only run tests with a title matching one of the patterns. For example, passing `grep: /cart/` should only run tests with "cart" in the title. Also available in the [command line](./test-cli.md) with the `-g` option.
Filter to only run tests with a title matching one of the patterns. For example, passing `grep: /cart/` should only run tests with "cart" in the title. Also available in the [command line](../test-cli.md) with the `-g` option.
`grep` option is also useful for [tagging tests](./test-annotations.md#tag-tests).
`grep` option is also useful for [tagging tests](../test-annotations.md#tag-tests).
## property: TestConfig.grepInvert
- type: <[RegExp]|[Array]<[RegExp]>>
Filter to only run tests with a title **not** matching one of the patterns. This is the opposite of [`property: TestConfig.grep`]. Also available in the [command line](./test-cli.md) with the `--grep-invert` option.
Filter to only run tests with a title **not** matching one of the patterns. This is the opposite of [`property: TestConfig.grep`]. Also available in the [command line](../test-cli.md) with the `--grep-invert` option.
`grepInvert` option is also useful for [tagging tests](./test-annotations.md#tag-tests).
`grepInvert` option is also useful for [tagging tests](../test-annotations.md#tag-tests).
## property: TestConfig.maxFailures
@ -224,7 +224,7 @@ Filter to only run tests with a title **not** matching one of the patterns. This
The maximum number of test failures for the whole test suite run. After reaching this number, testing will stop and exit with an error. Setting to zero (default) disables this behavior.
Also available in the [command line](./test-cli.md) with the `--max-failures` and `-x` options.
Also available in the [command line](../test-cli.md) with the `--max-failures` and `-x` options.
```js js-flavor=js
// playwright.config.js
@ -386,7 +386,7 @@ The list of reporters to use. Each reporter can be:
You can pass options to the reporter in a tuple like `['json', { outputFile: './report.json' }]`.
Learn more in the [reporters guide](./test-reporters.md).
Learn more in the [reporters guide](../test-reporters.md).
```js js-flavor=js
// playwright.config.js
@ -422,7 +422,7 @@ Test files that took more than `threshold` milliseconds are considered slow, and
## property: TestConfig.retries
- type: <[int]>
The maximum number of retry attempts given to failed tests. By default failing tests are not retried. Learn more about [test retries](./test-retries.md#retries).
The maximum number of retry attempts given to failed tests. By default failing tests are not retried. Learn more about [test retries](../test-retries.md#retries).
```js js-flavor=js
// playwright.config.js
@ -453,7 +453,7 @@ export default config;
Shard tests and execute only the selected shard. Specify in the one-based form like `{ total: 5, current: 2 }`.
Learn more about [parallelism and sharding](./test-parallel.md) with Playwright Test.
Learn more about [parallelism and sharding](../test-parallel.md) with Playwright Test.
## property: TestConfig.testDir
- type: <[string]>
@ -545,7 +545,7 @@ export default config;
Timeout for each test in milliseconds. Defaults to 30 seconds.
This is a base timeout for all tests. In addition, each test can configure its own timeout with [`method: Test.setTimeout`]. Learn more about [various timeouts](./test-timeouts.md).
This is a base timeout for all tests. In addition, each test can configure its own timeout with [`method: Test.setTimeout`]. Learn more about [various timeouts](../test-timeouts.md).
```js js-flavor=js
// playwright.config.js
@ -577,12 +577,12 @@ Whether to update expected snapshots with the actual results produced by the tes
* `'none'` - No snapshots are updated.
* `'missing'` - Missing snapshots are created, for example when authoring a new test and running it for the first time. This is the default.
Learn more about [snapshots](./test-snapshots.md).
Learn more about [snapshots](../test-snapshots.md).
## property: TestConfig.use
- type: <[TestOptions]>
Global options for all tests, for example [`property: TestOptions.browserName`]. Learn more about [configuration](./test-configuration.md) and see [available options][TestOptions].
Global options for all tests, for example [`property: TestOptions.browserName`]. Learn more about [configuration](../test-configuration.md) and see [available options][TestOptions].
```js js-flavor=js
// playwright.config.js
@ -697,7 +697,7 @@ The maximum number of concurrent worker processes to use for parallelizing tests
Playwright Test uses worker processes to run tests. There is always at least one worker process, but more can be used to speed up test execution.
Defaults to one half of the number of CPU cores. Learn more about [parallelism and sharding](./test-parallel.md) with Playwright Test.
Defaults to one half of the number of CPU cores. Learn more about [parallelism and sharding](../test-parallel.md) with Playwright Test.
```js js-flavor=js
// playwright.config.js

View File

@ -29,7 +29,7 @@ test('basic test', async ({ page }, testInfo) => {
The list of annotations applicable to the current test. Includes annotations from the test, annotations from all [`method: Test.describe`] groups the test belongs to and file-level annotations for the test file.
Learn more about [test annotations](./test-annotations.md).
Learn more about [test annotations](../test-annotations.md).
## property: TestInfo.attachments
- type: <[Array]<[Object]>>
@ -118,7 +118,7 @@ Column number where the currently running test is declared.
## property: TestInfo.config
- type: <[TestConfig]>
Processed configuration from the [configuration file](./test-configuration.md).
Processed configuration from the [configuration file](../test-configuration.md).
## property: TestInfo.duration
@ -257,23 +257,23 @@ Path segments to append at the end of the resulting path.
The index of the worker between `0` and `workers - 1`. It is guaranteed that workers running at the same time have a different `parallelIndex`. When a worker is restarted, for example after a failure, the new worker process has the same `parallelIndex`.
Also available as `process.env.TEST_PARALLEL_INDEX`. Learn more about [parallelism and sharding](./test-parallel.md) with Playwright Test.
Also available as `process.env.TEST_PARALLEL_INDEX`. Learn more about [parallelism and sharding](../test-parallel.md) with Playwright Test.
## property: TestInfo.project
- type: <[TestProject]>
Processed project configuration from the [configuration file](./test-configuration.md).
Processed project configuration from the [configuration file](../test-configuration.md).
## property: TestInfo.repeatEachIndex
- type: <[int]>
Specifies a unique repeat index when running in "repeat each" mode. This mode is enabled by passing `--repeat-each` to the [command line](./test-cli.md).
Specifies a unique repeat index when running in "repeat each" mode. This mode is enabled by passing `--repeat-each` to the [command line](../test-cli.md).
## property: TestInfo.retry
- type: <[int]>
Specifies the retry number when the test is retried after a failure. The first test run has [`property: TestInfo.retry`] equal to zero, the first retry has it equal to one, and so on. Learn more about [retries](./test-retries.md#retries).
Specifies the retry number when the test is retried after a failure. The first test run has [`property: TestInfo.retry`] equal to zero, the first retry has it equal to one, and so on. Learn more about [retries](../test-retries.md#retries).
```js js-flavor=js
const { test, expect } = require('@playwright/test');
@ -311,9 +311,9 @@ test('my test', async ({ page }, testInfo) => {
## method: TestInfo.setTimeout
Changes the timeout for the currently running test. Zero means no timeout. Learn more about [various timeouts](./test-timeouts.md).
Changes the timeout for the currently running test. Zero means no timeout. Learn more about [various timeouts](../test-timeouts.md).
Timeout is usually specified in the [configuration file](./test-configuration.md), but it could be useful to change the timeout in certain scenarios:
Timeout is usually specified in the [configuration file](../test-configuration.md), but it could be useful to change the timeout in certain scenarios:
```js js-flavor=js
const { test, expect } = require('@playwright/test');
@ -369,7 +369,7 @@ Optional description that will be reflected in a test report.
## method: TestInfo.snapshotPath
- returns: <[string]>
Returns a path to a snapshot file with the given `pathSegments`. Learn more about [snapshots](./test-snapshots.md).
Returns a path to a snapshot file with the given `pathSegments`. Learn more about [snapshots](../test-snapshots.md).
> Note that `pathSegments` accepts path segments to the snapshot file such as `testInfo.snapshotPath('relative', '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.
@ -382,7 +382,7 @@ The name of the snapshot or the path segments to define the snapshot file path.
## property: TestInfo.snapshotSuffix
- type: <[string]>
Suffix used to differentiate snapshots between multiple test configurations. For example, if snapshots depend on the platform, you can set `testInfo.snapshotSuffix` equal to `process.platform`. In this case `expect(value).toMatchSnapshot(snapshotName)` will use different snapshots depending on the platform. Learn more about [snapshots](./test-snapshots.md).
Suffix used to differentiate snapshots between multiple test configurations. For example, if snapshots depend on the platform, you can set `testInfo.snapshotSuffix` equal to `process.platform`. In this case `expect(value).toMatchSnapshot(snapshotName)` will use different snapshots depending on the platform. Learn more about [snapshots](../test-snapshots.md).
## property: TestInfo.status
- type: <[void]|[TestStatus]<"passed"|"failed"|"timedOut"|"skipped">>
@ -422,9 +422,9 @@ Output written to `process.stdout` or `console.log` during the test execution.
## property: TestInfo.timeout
- type: <[int]>
Timeout in milliseconds for the currently running test. Zero means no timeout. Learn more about [various timeouts](./test-timeouts.md).
Timeout in milliseconds for the currently running test. Zero means no timeout. Learn more about [various timeouts](../test-timeouts.md).
Timeout is usually specified in the [configuration file](./test-configuration.md)
Timeout is usually specified in the [configuration file](../test-configuration.md)
```js js-flavor=js
const { test, expect } = require('@playwright/test');
@ -459,4 +459,4 @@ The full title path starting with the project.
The unique index of the worker process that is running the test. When a worker is restarted, for example after a failure, the new worker process gets a new unique `workerIndex`.
Also available as `process.env.TEST_WORKER_INDEX`. Learn more about [parallelism and sharding](./test-parallel.md) with Playwright Test.
Also available as `process.env.TEST_WORKER_INDEX`. Learn more about [parallelism and sharding](../test-parallel.md) with Playwright Test.

View File

@ -3,7 +3,7 @@
Playwright Test provides many options to configure test environment, [Browser], [BrowserContext] and more.
These options are usually provided in the [configuration file](./test-configuration.md) through [`property: TestConfig.use`] and [`property: TestProject.use`].
These options are usually provided in the [configuration file](../test-configuration.md) through [`property: TestConfig.use`] and [`property: TestProject.use`].
```js js-flavor=js
// @ts-check
@ -102,7 +102,7 @@ Default timeout for each Playwright action in milliseconds, defaults to 0 (no ti
This is a default timeout for all Playwright actions, same as configured via [`method: Page.setDefaultTimeout`].
Learn more about [various timeouts](./test-timeouts.md).
Learn more about [various timeouts](../test-timeouts.md).
## property: TestOptions.bypassCSP = %%-context-option-bypasscsp-%%
@ -154,7 +154,7 @@ Timeout for each navigation action in milliseconds. Defaults to 0 (no timeout).
This is a default navigation timeout, same as configured via [`method: Page.setDefaultNavigationTimeout`].
Learn more about [various timeouts](./test-timeouts.md).
Learn more about [various timeouts](../test-timeouts.md).
## property: TestOptions.offline = %%-context-option-offline-%%
@ -170,7 +170,7 @@ Whether to automatically capture a screenshot after each test. Defaults to `'off
* `'on'`: Capture screenshot after each test.
* `'only-on-failure'`: Capture screenshot after each test failure.
Learn more about [automatic screenshots](./test-configuration.md#automatic-screenshots).
Learn more about [automatic screenshots](../test-configuration.md#automatic-screenshots).
## property: TestOptions.storageState = %%-js-python-context-option-storage-state-%%
@ -191,7 +191,7 @@ Whether to record trace for each test. Defaults to `'off'`.
For more control, pass an object that specifies `mode` and trace features to enable.
Learn more about [recording trace](./test-configuration.md#record-test-trace).
Learn more about [recording trace](../test-configuration.md#record-test-trace).
## property: TestOptions.userAgent = %%-context-option-useragent-%%
@ -210,7 +210,7 @@ Whether to record video for each test. Defaults to `'off'`.
To control video size, pass an object with `mode` and `size` properties. If video size is not specified, it will be equal to [`property: TestOptions.viewport`] scaled down to fit into 800x800. If `viewport` is not configured explicitly the video size defaults to 800x450. Actual picture of each page will be scaled down if necessary to fit the specified size.
Learn more about [recording video](./test-configuration.md#record-video).
Learn more about [recording video](../test-configuration.md#record-video).
## property: TestOptions.viewport = %%-context-option-viewport-%%

View File

@ -3,7 +3,7 @@
Playwright Test supports running multiple test projects at the same time. This is useful for running tests in multiple configurations. For example, consider running tests against multiple browsers.
`TestProject` encapsulates configuration specific to a single project. Projects are configured in [`property: TestConfig.projects`] specified in the [configuration file](./test-configuration.md). Note that all properties of [TestProject] are available in the top-level [TestConfig], in which case they are shared between all projects.
`TestProject` encapsulates configuration specific to a single project. Projects are configured in [`property: TestConfig.projects`] specified in the [configuration file](../test-configuration.md). Note that all properties of [TestProject] are available in the top-level [TestConfig], in which case they are shared between all projects.
Here is an example configuration that runs every test in Chromium, Firefox and WebKit, both Desktop and Mobile versions.
@ -134,16 +134,16 @@ You can configure entire test project to concurrently run all tests in all files
## property: TestProject.grep
- type: <[RegExp]|[Array]<[RegExp]>>
Filter to only run tests with a title matching one of the patterns. For example, passing `grep: /cart/` should only run tests with "cart" in the title. Also available globally and in the [command line](./test-cli.md) with the `-g` option.
Filter to only run tests with a title matching one of the patterns. For example, passing `grep: /cart/` should only run tests with "cart" in the title. Also available globally and in the [command line](../test-cli.md) with the `-g` option.
`grep` option is also useful for [tagging tests](./test-annotations.md#tag-tests).
`grep` option is also useful for [tagging tests](../test-annotations.md#tag-tests).
## property: TestProject.grepInvert
- type: <[RegExp]|[Array]<[RegExp]>>
Filter to only run tests with a title **not** matching one of the patterns. This is the opposite of [`property: TestProject.grep`]. Also available globally and in the [command line](./test-cli.md) with the `--grep-invert` option.
Filter to only run tests with a title **not** matching one of the patterns. This is the opposite of [`property: TestProject.grep`]. Also available globally and in the [command line](../test-cli.md) with the `--grep-invert` option.
`grepInvert` option is also useful for [tagging tests](./test-annotations.md#tag-tests).
`grepInvert` option is also useful for [tagging tests](../test-annotations.md#tag-tests).
## property: TestProject.metadata
- type: <[Object]>
@ -240,7 +240,7 @@ Use [`property: TestConfig.repeatEach`] to change this option for all projects.
## property: TestProject.retries
- type: <[int]>
The maximum number of retry attempts given to failed tests. Learn more about [test retries](./test-retries.md#retries).
The maximum number of retry attempts given to failed tests. Learn more about [test retries](../test-retries.md#retries).
Use [`property: TestConfig.retries`] to change this option for all projects.
@ -365,7 +365,7 @@ Use [`property: TestConfig.timeout`] to change this option for all projects.
## property: TestProject.use
- type: <[Fixtures]>
Options for all tests in this project, for example [`property: TestOptions.browserName`]. Learn more about [configuration](./test-configuration.md) and see [available options][TestOptions].
Options for all tests in this project, for example [`property: TestOptions.browserName`]. Learn more about [configuration](../test-configuration.md) and see [available options][TestOptions].
```js js-flavor=js
// playwright.config.js

View File

@ -22,7 +22,7 @@ test.beforeAll(async ({ browserName }, workerInfo) => {
## property: WorkerInfo.config
- type: <[TestConfig]>
Processed configuration from the [configuration file](./test-configuration.md).
Processed configuration from the [configuration file](../test-configuration.md).
## property: WorkerInfo.parallelIndex
@ -30,13 +30,13 @@ Processed configuration from the [configuration file](./test-configuration.md).
The index of the worker between `0` and `workers - 1`. It is guaranteed that workers running at the same time have a different `parallelIndex`. When a worker is restarted, for example after a failure, the new worker process has the same `parallelIndex`.
Also available as `process.env.TEST_PARALLEL_INDEX`. Learn more about [parallelism and sharding](./test-parallel.md) with Playwright Test.
Also available as `process.env.TEST_PARALLEL_INDEX`. Learn more about [parallelism and sharding](../test-parallel.md) with Playwright Test.
## property: WorkerInfo.project
- type: <[TestProject]>
Processed project configuration from the [configuration file](./test-configuration.md).
Processed project configuration from the [configuration file](../test-configuration.md).
## property: WorkerInfo.workerIndex
@ -44,4 +44,4 @@ Processed project configuration from the [configuration file](./test-configurati
The unique index of the worker process that is running the test. When a worker is restarted, for example after a failure, the new worker process gets a new unique `workerIndex`.
Also available as `process.env.TEST_WORKER_INDEX`. Learn more about [parallelism and sharding](./test-parallel.md) with Playwright Test.
Also available as `process.env.TEST_WORKER_INDEX`. Learn more about [parallelism and sharding](../test-parallel.md) with Playwright Test.

View File

@ -55,7 +55,7 @@ class MyReporter implements Reporter {
export default MyReporter;
```
Now use this reporter with [`property: TestConfig.reporter`]. Learn more about [using reporters](./test-reporters.md).
Now use this reporter with [`property: TestConfig.reporter`]. Learn more about [using reporters](../test-reporters.md).
```js js-flavor=js
// playwright.config.js

View File

@ -12,7 +12,7 @@ The list of annotations applicable to the current test. Includes annotations fro
Annotations are available during test execution through [`property: TestInfo.annotations`].
Learn more about [test annotations](./test-annotations.md).
Learn more about [test annotations](../test-annotations.md).
## property: TestCase.expectedStatus
- type: <[TestStatus]<"passed"|"failed"|"timedOut"|"skipped">>
@ -49,7 +49,7 @@ Suite this test case belongs to.
## property: TestCase.repeatEachIndex
- type: <[int]>
Contains the repeat index when running in "repeat each" mode. This mode is enabled by passing `--repeat-each` to the [command line](./test-cli.md).
Contains the repeat index when running in "repeat each" mode. This mode is enabled by passing `--repeat-each` to the [command line](../test-cli.md).
## property: TestCase.results
- type: <[Array]<[TestResult]>>
@ -61,7 +61,7 @@ Results for each run of this test.
The maximum number of retries given to this test in the configuration.
Learn more about [test retries](./test-retries.md#retries).
Learn more about [test retries](../test-retries.md#retries).
## property: TestCase.timeout
- type: <[float]>

View File

@ -33,7 +33,7 @@ Errors thrown during the test execution.
When test is retries multiple times, each retry attempt is given a sequential number.
Learn more about [test retries](./test-retries.md#retries).
Learn more about [test retries](../test-retries.md#retries).
## property: TestResult.startTime
- type: <[Date]>
@ -65,4 +65,4 @@ List of steps inside this test run.
Index of the worker where the test was run.
Learn more about [parallelism and sharding](./test-parallel.md) with Playwright Test.
Learn more about [parallelism and sharding](../test-parallel.md) with Playwright Test.

View File

@ -8592,8 +8592,8 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
/**
* Returns when the element satisfies the `state`.
*
* Depending on the `state` parameter, this method waits for one of the [actionability](https://playwright.dev/docs/actionability) checks to pass.
* This method throws when the element is detached while waiting, unless waiting for the `"hidden"` state.
* Depending on the `state` parameter, this method waits for one of the [actionability](https://playwright.dev/docs/actionability) checks to
* pass. This method throws when the element is detached while waiting, unless waiting for the `"hidden"` state.
* - `"visible"` Wait until the element is [visible](https://playwright.dev/docs/actionability#visible).
* - `"hidden"` Wait until the element is [not visible](https://playwright.dev/docs/actionability#visible) or
* [not attached](https://playwright.dev/docs/actionability#attached). Note that waiting for hidden does not throw when the element detaches.
@ -13071,8 +13071,8 @@ export interface Browser extends EventEmitter {
/**
* > NOTE: This API controls [Chromium Tracing](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool)
* which is a low-level chromium-specific debugging tool. API to control [Playwright Tracing](../trace-viewer) could be
* found [here](https://playwright.dev/docs/class-tracing).
* which is a low-level chromium-specific debugging tool. API to control [Playwright Tracing](https://playwright.dev/docs/trace-viewer) could be
* found [here](https://playwright.dev/docs/api/class-tracing).
*
* You can use [browser.startTracing([page, options])](https://playwright.dev/docs/api/class-browser#browser-start-tracing)
* and [browser.stopTracing()](https://playwright.dev/docs/api/class-browser#browser-stop-tracing) to create a trace file
@ -13106,8 +13106,8 @@ export interface Browser extends EventEmitter {
/**
* > NOTE: This API controls [Chromium Tracing](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool)
* which is a low-level chromium-specific debugging tool. API to control [Playwright Tracing](../trace-viewer) could be
* found [here](https://playwright.dev/docs/class-tracing).
* which is a low-level chromium-specific debugging tool. API to control [Playwright Tracing](https://playwright.dev/docs/trace-viewer) could be
* found [here](https://playwright.dev/docs/api/class-tracing).
*
* Returns the buffer with trace data.
*/

View File

@ -122,14 +122,15 @@ async function run() {
// Validate links
{
const langs = ['js', 'java', 'python', 'csharp'];
const documentationRoot = path.join(PROJECT_DIR, 'docs', 'src');
for (const lang of langs) {
try {
let documentation = parseApi(path.join(PROJECT_DIR, 'docs', 'src', 'api'));
let documentation = parseApi(path.join(documentationRoot, 'api'));
documentation.filterForLanguage(lang);
if (lang === 'js') {
const testDocumentation = parseApi(path.join(PROJECT_DIR, 'docs', 'src', 'test-api'), path.join(PROJECT_DIR, 'docs', 'src', 'api', 'params.md'));
const testDocumentation = parseApi(path.join(documentationRoot, 'test-api'), path.join(documentationRoot, 'api', 'params.md'));
testDocumentation.filterForLanguage('js');
const testRerpoterDocumentation = parseApi(path.join(PROJECT_DIR, 'docs', 'src', 'test-reporter-api'));
const testRerpoterDocumentation = parseApi(path.join(documentationRoot, 'test-reporter-api'));
testRerpoterDocumentation.filterForLanguage('js');
documentation = documentation.mergeWith(testDocumentation).mergeWith(testRerpoterDocumentation);
}
@ -137,11 +138,63 @@ async function run() {
// This validates member links.
documentation.setLinkRenderer(() => undefined);
for (const filePath of getAllMarkdownFiles(path.join(PROJECT_DIR, 'docs', 'src'))) {
const relevantMarkdownFiles = new Set([...getAllMarkdownFiles(documentationRoot)
// filter out language specific files
.filter(filePath => {
const matches = filePath.match(/(-(js|python|csharp|java))+?/g);
// no language specific document
if (!matches)
return true;
// there is a language, lets filter for it
return matches.includes(`-${lang}`);
})
// Standardise naming and remove the filter in the file name
.map(filePath => filePath.replace(/(-(js|python|csharp|java))+/, ''))
// Internally (playwright.dev generator) we merge test-api and test-reporter-api into api.
.map(filePath => filePath.replace(/(\/|\\)(test-api|test-reporter-api)(\/|\\)/, `${path.sep}api${path.sep}`))]);
for (const filePath of getAllMarkdownFiles(documentationRoot)) {
if (langs.some(other => other !== lang && filePath.endsWith(`-${other}.md`)))
continue;
const data = fs.readFileSync(filePath, 'utf-8');
documentation.renderLinksInText(md.filterNodesForLanguage(md.parse(data), lang));
const rootNode = md.filterNodesForLanguage(md.parse(data), lang);
documentation.renderLinksInText(rootNode);
// Validate links
{
md.visitAll(rootNode, node => {
if (!node.text)
return;
for (const [, mdLinkName, mdLink] of node.text.matchAll(/\[([\w\s\d]+)\]\((.*?)\)/g)) {
const isExternal = mdLink.startsWith('http://') || mdLink.startsWith('https://');
if (isExternal)
continue;
// ignore links with only a hash (same file)
if (mdLink.startsWith('#'))
continue;
// The assertion classes are "virtual files" which get merged into test-assertions.md inside our docs generator
let markdownBasePath = path.dirname(filePath);
if ([
'class-screenshotassertions.md',
'class-locatorassertions.md',
'class-pageassertions.md'
].includes(path.basename(filePath))) {
markdownBasePath = documentationRoot;
}
let linkWithoutHash = path.join(markdownBasePath, mdLink.split('#')[0]);
if (path.extname(linkWithoutHash) !== '.md')
linkWithoutHash += '.md';
// We generate it inside the generator (playwright.dev)
if (path.basename(linkWithoutHash) === 'test-assertions.md')
return;
if (!relevantMarkdownFiles.has(linkWithoutHash))
throw new Error(`${path.relative(PROJECT_DIR, filePath)} references to '${linkWithoutHash}' as '${mdLinkName}' which does not exist.`);
}
});
}
}
} catch (e) {
e.message = `While processing "${lang}"\n` + e.message;

View File

@ -324,8 +324,8 @@ class TypesGenerator {
pushLine(line);
}
comment = out.join('\n');
comment = comment.replace(/\[([^\]]+)\]\(\.\/([^\)]+)\)/g, (match, p1, p2) => {
return `[${p1}](https://playwright.dev/docs/${p2.replace('.md', '')})`;
comment = comment.replace(/\[([^\]]+)\]\((\.[^\)]+)\)/g, (match, p1, p2) => {
return `[${p1}](${new URL(p2.replace('.md', ''), 'https://playwright.dev/docs/api/').toString()})`;
});
parts.push(indent + '/**');

View File

@ -405,7 +405,10 @@ function filterNodesForLanguage(nodes, language) {
const child = node.children[i];
if (child.type !== 'li' || child.liType !== 'bullet' || !child.text.startsWith('langs:'))
continue;
const only = child.text.substring('langs:'.length).split(',').map(l => l.trim());
const onlyText = child.text.substring('langs:'.length);
if (!onlyText)
return true;
const only = onlyText.split(',').map(l => l.trim());
node.children.splice(i, 1);
return only.includes(language);
}