mirror of
https://github.com/microsoft/playwright.git
synced 2025-01-05 19:04:43 +03:00
docs: Improved JSDoc for expect.toPass (#29722)
This commit is contained in:
parent
a8c26d235c
commit
4e0bd6286e
19
packages/playwright/types/test.d.ts
vendored
19
packages/playwright/types/test.d.ts
vendored
@ -6957,7 +6957,24 @@ interface GenericAssertions<R> {
|
||||
|
||||
type FunctionAssertions = {
|
||||
/**
|
||||
* Retries the callback until it passes.
|
||||
* Retries the callback until all assertions within it pass or the `timeout` value is reached.
|
||||
* The `intervals` parameter can be used to establish the probing frequency or pattern.
|
||||
*
|
||||
* **Usage**
|
||||
* ```js
|
||||
* await expect(async () => {
|
||||
* const response = await page.request.get('https://api.example.com');
|
||||
* expect(response.status()).toBe(200);
|
||||
* }).toPass({
|
||||
* // Probe, wait 1s, probe, wait 2s, probe, wait 10s, probe, wait 10s, probe
|
||||
* intervals: [1_000, 2_000, 10_000], // Defaults to [100, 250, 500, 1000].
|
||||
* timeout: 60_000 // Defaults to 0
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* Note that by default `toPass` does not respect custom expect timeout.
|
||||
*
|
||||
* @param options
|
||||
*/
|
||||
toPass(options?: { timeout?: number, intervals?: number[] }): Promise<void>;
|
||||
};
|
||||
|
19
utils/generate_types/overrides-test.d.ts
vendored
19
utils/generate_types/overrides-test.d.ts
vendored
@ -341,7 +341,24 @@ interface GenericAssertions<R> {
|
||||
|
||||
type FunctionAssertions = {
|
||||
/**
|
||||
* Retries the callback until it passes.
|
||||
* Retries the callback until all assertions within it pass or the `timeout` value is reached.
|
||||
* The `intervals` parameter can be used to establish the probing frequency or pattern.
|
||||
*
|
||||
* **Usage**
|
||||
* ```js
|
||||
* await expect(async () => {
|
||||
* const response = await page.request.get('https://api.example.com');
|
||||
* expect(response.status()).toBe(200);
|
||||
* }).toPass({
|
||||
* // Probe, wait 1s, probe, wait 2s, probe, wait 10s, probe, wait 10s, probe
|
||||
* intervals: [1_000, 2_000, 10_000], // Defaults to [100, 250, 500, 1000].
|
||||
* timeout: 60_000 // Defaults to 0
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* Note that by default `toPass` does not respect custom expect timeout.
|
||||
*
|
||||
* @param options
|
||||
*/
|
||||
toPass(options?: { timeout?: number, intervals?: number[] }): Promise<void>;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user