docs: restore assertions timeout option in js (#12467)

This commit is contained in:
Yury Semikhatsky 2022-03-02 12:43:16 -08:00 committed by GitHub
parent 608873e945
commit a413c0f94c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 116 additions and 56 deletions

View file

@ -91,56 +91,64 @@ await Expect(locator).Not.ToContainTextAsync("error");
The opposite of [`method: LocatorAssertions.toBeChecked`].
### option: LocatorAssertions.NotToBeChecked.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.NotToBeChecked.timeout = %%-js-assertions-timeout-%%
### option: LocatorAssertions.NotToBeChecked.timeout = %%-csharp-java-python-assertions-timeout-%%
## async method: LocatorAssertions.NotToBeDisabled
* langs: python
The opposite of [`method: LocatorAssertions.toBeDisabled`].
### option: LocatorAssertions.NotToBeDisabled.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.NotToBeDisabled.timeout = %%-js-assertions-timeout-%%
### option: LocatorAssertions.NotToBeDisabled.timeout = %%-csharp-java-python-assertions-timeout-%%
## async method: LocatorAssertions.NotToBeEditable
* langs: python
The opposite of [`method: LocatorAssertions.toBeEditable`].
### option: LocatorAssertions.NotToBeEditable.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.NotToBeEditable.timeout = %%-js-assertions-timeout-%%
### option: LocatorAssertions.NotToBeEditable.timeout = %%-csharp-java-python-assertions-timeout-%%
## async method: LocatorAssertions.NotToBeEmpty
* langs: python
The opposite of [`method: LocatorAssertions.toBeEmpty`].
### option: LocatorAssertions.NotToBeEmpty.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.NotToBeEmpty.timeout = %%-js-assertions-timeout-%%
### option: LocatorAssertions.NotToBeEmpty.timeout = %%-csharp-java-python-assertions-timeout-%%
## async method: LocatorAssertions.NotToBeEnabled
* langs: python
The opposite of [`method: LocatorAssertions.toBeEnabled`].
### option: LocatorAssertions.NotToBeEnabled.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.NotToBeEnabled.timeout = %%-js-assertions-timeout-%%
### option: LocatorAssertions.NotToBeEnabled.timeout = %%-csharp-java-python-assertions-timeout-%%
## async method: LocatorAssertions.NotToBeFocused
* langs: python
The opposite of [`method: LocatorAssertions.toBeFocused`].
### option: LocatorAssertions.NotToBeFocused.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.NotToBeFocused.timeout = %%-js-assertions-timeout-%%
### option: LocatorAssertions.NotToBeFocused.timeout = %%-csharp-java-python-assertions-timeout-%%
## async method: LocatorAssertions.NotToBeHidden
* langs: python
The opposite of [`method: LocatorAssertions.toBeHidden`].
### option: LocatorAssertions.NotToBeHidden.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.NotToBeHidden.timeout = %%-js-assertions-timeout-%%
### option: LocatorAssertions.NotToBeHidden.timeout = %%-csharp-java-python-assertions-timeout-%%
## async method: LocatorAssertions.NotToBeVisible
* langs: python
The opposite of [`method: LocatorAssertions.toBeVisible`].
### option: LocatorAssertions.NotToBeVisible.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.NotToBeVisible.timeout = %%-js-assertions-timeout-%%
### option: LocatorAssertions.NotToBeVisible.timeout = %%-csharp-java-python-assertions-timeout-%%
## async method: LocatorAssertions.NotToContainText
@ -158,7 +166,8 @@ Expected substring or RegExp or a list of those.
Whether to use `element.innerText` instead of `element.textContent` when retrieving DOM node text.
### option: LocatorAssertions.NotToContainText.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.NotToContainText.timeout = %%-js-assertions-timeout-%%
### option: LocatorAssertions.NotToContainText.timeout = %%-csharp-java-python-assertions-timeout-%%
## async method: LocatorAssertions.NotToHaveAttribute
* langs: python
@ -175,7 +184,8 @@ Attribute name.
Expected attribute value.
### option: LocatorAssertions.NotToHaveAttribute.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.NotToHaveAttribute.timeout = %%-js-assertions-timeout-%%
### option: LocatorAssertions.NotToHaveAttribute.timeout = %%-csharp-java-python-assertions-timeout-%%
## async method: LocatorAssertions.NotToHaveClass
* langs: python
@ -187,7 +197,8 @@ The opposite of [`method: LocatorAssertions.toHaveClass`].
Expected class or RegExp or a list of those.
### option: LocatorAssertions.NotToHaveClass.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.NotToHaveClass.timeout = %%-js-assertions-timeout-%%
### option: LocatorAssertions.NotToHaveClass.timeout = %%-csharp-java-python-assertions-timeout-%%
## async method: LocatorAssertions.NotToHaveCount
* langs: python
@ -199,7 +210,8 @@ The opposite of [`method: LocatorAssertions.toHaveCount`].
Expected count.
### option: LocatorAssertions.NotToHaveCount.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.NotToHaveCount.timeout = %%-js-assertions-timeout-%%
### option: LocatorAssertions.NotToHaveCount.timeout = %%-csharp-java-python-assertions-timeout-%%
## async method: LocatorAssertions.NotToHaveCSS
* langs: python
@ -216,7 +228,8 @@ CSS property name.
CSS property value.
### option: LocatorAssertions.NotToHaveCSS.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.NotToHaveCSS.timeout = %%-js-assertions-timeout-%%
### option: LocatorAssertions.NotToHaveCSS.timeout = %%-csharp-java-python-assertions-timeout-%%
## async method: LocatorAssertions.NotToHaveId
* langs: python
@ -228,7 +241,8 @@ The opposite of [`method: LocatorAssertions.toHaveId`].
Element id.
### option: LocatorAssertions.NotToHaveId.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.NotToHaveId.timeout = %%-js-assertions-timeout-%%
### option: LocatorAssertions.NotToHaveId.timeout = %%-csharp-java-python-assertions-timeout-%%
## async method: LocatorAssertions.NotToHaveJSProperty
* langs: python
@ -245,7 +259,8 @@ Property name.
Property value.
### option: LocatorAssertions.NotToHaveJSProperty.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.NotToHaveJSProperty.timeout = %%-js-assertions-timeout-%%
### option: LocatorAssertions.NotToHaveJSProperty.timeout = %%-csharp-java-python-assertions-timeout-%%
## async method: LocatorAssertions.NotToHaveText
* langs: python
@ -262,7 +277,8 @@ Expected substring or RegExp or a list of those.
Whether to use `element.innerText` instead of `element.textContent` when retrieving DOM node text.
### option: LocatorAssertions.NotToHaveText.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.NotToHaveText.timeout = %%-js-assertions-timeout-%%
### option: LocatorAssertions.NotToHaveText.timeout = %%-csharp-java-python-assertions-timeout-%%
## async method: LocatorAssertions.NotToHaveValue
* langs: python
@ -274,7 +290,8 @@ The opposite of [`method: LocatorAssertions.toHaveValue`].
Expected value.
### option: LocatorAssertions.NotToHaveValue.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.NotToHaveValue.timeout = %%-js-assertions-timeout-%%
### option: LocatorAssertions.NotToHaveValue.timeout = %%-csharp-java-python-assertions-timeout-%%
## async method: LocatorAssertions.toBeChecked
@ -314,7 +331,8 @@ await Expect(locator).ToBeCheckedAsync();
### option: LocatorAssertions.toBeChecked.checked
- `checked` <[boolean]>
### option: LocatorAssertions.toBeChecked.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.toBeChecked.timeout = %%-js-assertions-timeout-%%
### option: LocatorAssertions.toBeChecked.timeout = %%-csharp-java-python-assertions-timeout-%%
## async method: LocatorAssertions.toBeDisabled
@ -351,7 +369,8 @@ var locator = Page.Locator("button.submit");
await Expect(locator).ToBeDisabledAsync();
```
### option: LocatorAssertions.toBeDisabled.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.toBeDisabled.timeout = %%-js-assertions-timeout-%%
### option: LocatorAssertions.toBeDisabled.timeout = %%-csharp-java-python-assertions-timeout-%%
## async method: LocatorAssertions.toBeEditable
@ -388,7 +407,8 @@ var locator = Page.Locator("input");
await Expect(locator).ToBeEditableAsync();
```
### option: LocatorAssertions.toBeEditable.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.toBeEditable.timeout = %%-js-assertions-timeout-%%
### option: LocatorAssertions.toBeEditable.timeout = %%-csharp-java-python-assertions-timeout-%%
## async method: LocatorAssertions.toBeEmpty
@ -425,7 +445,8 @@ var locator = Page.Locator("div.warning");
await Expect(locator).ToBeEmptyAsync();
```
### option: LocatorAssertions.toBeEmpty.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.toBeEmpty.timeout = %%-js-assertions-timeout-%%
### option: LocatorAssertions.toBeEmpty.timeout = %%-csharp-java-python-assertions-timeout-%%
## async method: LocatorAssertions.toBeEnabled
@ -462,7 +483,8 @@ var locator = Page.Locator("button.submit");
await Expect(locator).toBeEnabledAsync();
```
### option: LocatorAssertions.toBeEnabled.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.toBeEnabled.timeout = %%-js-assertions-timeout-%%
### option: LocatorAssertions.toBeEnabled.timeout = %%-csharp-java-python-assertions-timeout-%%
## async method: LocatorAssertions.toBeFocused
@ -499,7 +521,8 @@ var locator = Page.Locator("input");
await Expect(locator).ToBeFocusedAsync();
```
### option: LocatorAssertions.toBeFocused.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.toBeFocused.timeout = %%-js-assertions-timeout-%%
### option: LocatorAssertions.toBeFocused.timeout = %%-csharp-java-python-assertions-timeout-%%
## async method: LocatorAssertions.toBeHidden
@ -536,7 +559,8 @@ var locator = Page.Locator(".my-element");
await Expect(locator).ToBeHiddenAsync();
```
### option: LocatorAssertions.toBeHidden.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.toBeHidden.timeout = %%-js-assertions-timeout-%%
### option: LocatorAssertions.toBeHidden.timeout = %%-csharp-java-python-assertions-timeout-%%
## async method: LocatorAssertions.toBeVisible
@ -573,7 +597,8 @@ var locator = Page.Locator(".my-element");
await Expect(locator).ToBeVisibleAsync();
```
### option: LocatorAssertions.toBeVisible.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.toBeVisible.timeout = %%-js-assertions-timeout-%%
### option: LocatorAssertions.toBeVisible.timeout = %%-csharp-java-python-assertions-timeout-%%
## async method: LocatorAssertions.toContainText
* langs:
@ -664,7 +689,8 @@ Expected substring or RegExp or a list of those.
Whether to use `element.innerText` instead of `element.textContent` when retrieving DOM node text.
### option: LocatorAssertions.toContainText.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.toContainText.timeout = %%-js-assertions-timeout-%%
### option: LocatorAssertions.toContainText.timeout = %%-csharp-java-python-assertions-timeout-%%
## async method: LocatorAssertions.toHaveAttribute
@ -711,7 +737,8 @@ Attribute name.
Expected attribute value.
### option: LocatorAssertions.toHaveAttribute.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.toHaveAttribute.timeout = %%-js-assertions-timeout-%%
### option: LocatorAssertions.toHaveAttribute.timeout = %%-csharp-java-python-assertions-timeout-%%
## async method: LocatorAssertions.toHaveClass
* langs:
@ -789,7 +816,8 @@ Expected class or RegExp or a list of those.
Expected class or RegExp or a list of those.
### option: LocatorAssertions.toHaveClass.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.toHaveClass.timeout = %%-js-assertions-timeout-%%
### option: LocatorAssertions.toHaveClass.timeout = %%-csharp-java-python-assertions-timeout-%%
## async method: LocatorAssertions.toHaveCount
@ -831,7 +859,8 @@ await Expect(locator).ToHaveCountAsync(3);
Expected count.
### option: LocatorAssertions.toHaveCount.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.toHaveCount.timeout = %%-js-assertions-timeout-%%
### option: LocatorAssertions.toHaveCount.timeout = %%-csharp-java-python-assertions-timeout-%%
## async method: LocatorAssertions.toHaveCSS
* langs:
@ -877,7 +906,8 @@ CSS property name.
CSS property value.
### option: LocatorAssertions.toHaveCSS.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.toHaveCSS.timeout = %%-js-assertions-timeout-%%
### option: LocatorAssertions.toHaveCSS.timeout = %%-csharp-java-python-assertions-timeout-%%
## async method: LocatorAssertions.toHaveId
* langs:
@ -918,7 +948,8 @@ await Expect(locator).ToHaveIdAsync("lastname");
Element id.
### option: LocatorAssertions.toHaveId.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.toHaveId.timeout = %%-js-assertions-timeout-%%
### option: LocatorAssertions.toHaveId.timeout = %%-csharp-java-python-assertions-timeout-%%
## async method: LocatorAssertions.toHaveJSProperty
@ -966,7 +997,8 @@ Property name.
Property value.
### option: LocatorAssertions.toHaveJSProperty.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.toHaveJSProperty.timeout = %%-js-assertions-timeout-%%
### option: LocatorAssertions.toHaveJSProperty.timeout = %%-csharp-java-python-assertions-timeout-%%
## async method: LocatorAssertions.toHaveScreenshot
* langs: js
@ -982,7 +1014,8 @@ const locator = page.locator('button');
await expect(locator).toHaveScreenshot();
```
### option: LocatorAssertions.toHaveScreenshot.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.toHaveScreenshot.timeout = %%-js-assertions-timeout-%%
### option: LocatorAssertions.toHaveScreenshot.timeout = %%-csharp-java-python-assertions-timeout-%%
### option: LocatorAssertions.toHaveScreenshot.disableAnimations = %%-screenshot-option-disable-animations-%%
@ -1086,7 +1119,8 @@ Expected substring or RegExp or a list of those.
Whether to use `element.innerText` instead of `element.textContent` when retrieving DOM node text.
### option: LocatorAssertions.toHaveText.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.toHaveText.timeout = %%-js-assertions-timeout-%%
### option: LocatorAssertions.toHaveText.timeout = %%-csharp-java-python-assertions-timeout-%%
## async method: LocatorAssertions.toHaveValue
* langs:
@ -1129,4 +1163,5 @@ await Expect(locator).ToHaveValueAsync(new Regex("[0-9]"));
Expected value.
### option: LocatorAssertions.toHaveValue.timeout = %%-assertions-timeout-%%
### option: LocatorAssertions.toHaveValue.timeout = %%-js-assertions-timeout-%%
### option: LocatorAssertions.toHaveValue.timeout = %%-csharp-java-python-assertions-timeout-%%

View file

@ -99,7 +99,8 @@ The opposite of [`method: PageAssertions.toHaveTitle`].
Expected title or RegExp.
### option: PageAssertions.NotToHaveTitle.timeout = %%-assertions-timeout-%%
### option: PageAssertions.NotToHaveTitle.timeout = %%-js-assertions-timeout-%%
### option: PageAssertions.NotToHaveTitle.timeout = %%-csharp-java-python-assertions-timeout-%%
## async method: PageAssertions.NotToHaveURL
* langs: python
@ -112,7 +113,8 @@ The opposite of [`method: PageAssertions.toHaveURL`].
Expected substring or RegExp.
### option: PageAssertions.NotToHaveURL.timeout = %%-assertions-timeout-%%
### option: PageAssertions.NotToHaveURL.timeout = %%-js-assertions-timeout-%%
### option: PageAssertions.NotToHaveURL.timeout = %%-csharp-java-python-assertions-timeout-%%
## async method: PageAssertions.toHaveScreenshot
* langs: js
@ -127,7 +129,8 @@ yield the same result, and save the last one as an expectation.
await expect(page).toHaveScreenshot();
```
### option: PageAssertions.toHaveScreenshot.timeout = %%-assertions-timeout-%%
### option: PageAssertions.toHaveScreenshot.timeout = %%-js-assertions-timeout-%%
### option: PageAssertions.toHaveScreenshot.timeout = %%-csharp-java-python-assertions-timeout-%%
### option: PageAssertions.toHaveScreenshot.disableAnimations = %%-screenshot-option-disable-animations-%%
@ -184,7 +187,8 @@ await Expect(page).ToHaveTitle("Playwright");
Expected title or RegExp.
### option: PageAssertions.toHaveTitle.timeout = %%-assertions-timeout-%%
### option: PageAssertions.toHaveTitle.timeout = %%-js-assertions-timeout-%%
### option: PageAssertions.toHaveTitle.timeout = %%-csharp-java-python-assertions-timeout-%%
## async method: PageAssertions.toHaveURL
* langs:
@ -225,4 +229,5 @@ await Expect(page).ToHaveURL(new Regex(".*checkout"));
Expected substring or RegExp.
### option: PageAssertions.toHaveURL.timeout = %%-assertions-timeout-%%
### option: PageAssertions.toHaveURL.timeout = %%-js-assertions-timeout-%%
### option: PageAssertions.toHaveURL.timeout = %%-csharp-java-python-assertions-timeout-%%

View file

@ -703,31 +703,36 @@ The default value can be changed by using the [`method: BrowserContext.setDefaul
Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by
using the [`method: AndroidDevice.setDefaultTimeout`] method.
## assertions-timeout
## js-assertions-timeout
* langs: js
- `timeout` <[float]>
Time to retry the assertion for. Defaults to `timeout` in [`property: TestConfig.expect`].
Time to retry the assertion for. Defaults to `timeout` in `TestConfig.expect`.
## assertions-pixel-count
* langs: js
- `pixelCount` <[int]> an acceptable amount of pixels that could be different, unset by default.
## assertions-pixel-ratio
* langs: js
- `pixelRatio` <[float]> an acceptable ratio of pixels that are different to the total amount of pixels, between `0` and `1`, unset by default.
## assertions-threshold
* langs: js
- `threshold` <[float]> an acceptable percieved color difference in the [YIQ color space](https://en.wikipedia.org/wiki/YIQ) between pixels in compared images, between zero (strict) and one (lax), default is configurable with [`property: TestConfig.expect`]. Defaults to `0.2`.
## assertions-timeout
## csharp-java-python-assertions-timeout
* langs: java, python, csharp
- `timeout` <[float]>
Time to retry the assertion for.
## assertions-pixel-count
* langs: js
- `pixelCount` <[int]>
An acceptable amount of pixels that could be different, unset by default.
## assertions-pixel-ratio
* langs: js
- `pixelRatio` <[float]>
An acceptable ratio of pixels that are different to the total amount of pixels, between `0` and `1`, unset by default.
## assertions-threshold
* langs: js
- `threshold` <[float]>
An acceptable percieved color difference in the [YIQ color space](https://en.wikipedia.org/wiki/YIQ) between pixels in compared images, between zero (strict) and one (lax), default is configurable with `TestConfig.expect`. Defaults to `0.2`.
## shared-context-params-list
- %%-context-option-acceptdownloads-%%
- %%-context-option-ignorehttpserrors-%%

View file

@ -40,6 +40,7 @@ class ApiParser {
}
const body = md.parse(bodyParts.join('\n'));
const params = paramsPath ? md.parse(fs.readFileSync(paramsPath).toString()) : null;
checkNoDuplicateParamEntries(params);
const api = params ? applyTemplates(body, params) : body;
/** @type {Map<string, Documentation.Class>} */
this.classes = new Map();
@ -371,4 +372,18 @@ function isTypeOverride(existingMember, member) {
return false;
}
/**
* @param {MarkdownNode[]=} params
*/
function checkNoDuplicateParamEntries(params) {
if (!params)
return;
const entries = new Set();
for (const node of params) {
if (entries.has(node.text))
throw new Error('Duplicate param entry, for language-specific params use prefix (e.g. js-...): ' + node.text);
entries.add(node.text);
}
}
module.exports = { parseApi };