diff --git a/packages/playwright/types/test.d.ts b/packages/playwright/types/test.d.ts index 11ceb7153a..1e610baf53 100644 --- a/packages/playwright/types/test.d.ts +++ b/packages/playwright/types/test.d.ts @@ -6957,7 +6957,24 @@ interface GenericAssertions { 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; }; diff --git a/utils/generate_types/overrides-test.d.ts b/utils/generate_types/overrides-test.d.ts index eed775d21f..6cafdcc932 100644 --- a/utils/generate_types/overrides-test.d.ts +++ b/utils/generate_types/overrides-test.d.ts @@ -341,7 +341,24 @@ interface GenericAssertions { 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; };