From 3fd435d1d3abd7bd69ba3367ed74e79d202b740b Mon Sep 17 00:00:00 2001 From: Andrey Lushnikov Date: Tue, 24 May 2022 11:54:32 -0600 Subject: [PATCH] docs: fix docs for toHaveScreenshot (#14280) --- docs/src/api/class-locatorassertions.md | 14 ++++-------- docs/src/api/class-pageassertions.md | 14 ++++-------- packages/playwright-test/types/test.d.ts | 28 +++++++----------------- tests/config/experimental.d.ts | 28 +++++++----------------- 4 files changed, 24 insertions(+), 60 deletions(-) diff --git a/docs/src/api/class-locatorassertions.md b/docs/src/api/class-locatorassertions.md index 2a39c68239..af9ab41464 100644 --- a/docs/src/api/class-locatorassertions.md +++ b/docs/src/api/class-locatorassertions.md @@ -1005,11 +1005,8 @@ Property value. ## async method: LocatorAssertions.toHaveScreenshot#1 * langs: js -Ensures that [Locator] resolves to a given screenshot. This function will re-take -screenshots until it matches with the saved expectation. - -If there's no expectation yet, it will wait until two consecutive screenshots -yield the same result, and save the last one as an expectation. +This function will wait until two consecutive locator screenshots +yield the same result, and then compare the last screenshot with the expectation. ```js const locator = page.locator('button'); @@ -1035,11 +1032,8 @@ Snapshot name. ## async method: LocatorAssertions.toHaveScreenshot#2 * langs: js -Ensures that [Locator] resolves to a given screenshot. This function will re-take -screenshots until it matches with the saved expectation. - -If there's no expectation yet, it will wait until two consecutive screenshots -yield the same result, and save the last one as an expectation. +This function will wait until two consecutive locator screenshots +yield the same result, and then compare the last screenshot with the expectation. ```js const locator = page.locator('button'); diff --git a/docs/src/api/class-pageassertions.md b/docs/src/api/class-pageassertions.md index 0644419eda..fc492fba80 100644 --- a/docs/src/api/class-pageassertions.md +++ b/docs/src/api/class-pageassertions.md @@ -117,11 +117,8 @@ Expected substring or RegExp. ## async method: PageAssertions.toHaveScreenshot#1 * langs: js -Ensures that the page resolves to a given screenshot. This function will re-take -screenshots until it matches with the saved expectation. - -If there's no expectation yet, it will wait until two consecutive screenshots -yield the same result, and save the last one as an expectation. +This function will wait until two consecutive page screenshots +yield the same result, and then compare the last screenshot with the expectation. ```js await expect(page).toHaveScreenshot('image.png'); @@ -148,11 +145,8 @@ Snapshot name. ## async method: PageAssertions.toHaveScreenshot#2 * langs: js -Ensures that the page resolves to a given screenshot. This function will re-take -screenshots until it matches with the saved expectation. - -If there's no expectation yet, it will wait until two consecutive screenshots -yield the same result, and save the last one as an expectation. +This function will wait until two consecutive page screenshots +yield the same result, and then compare the last screenshot with the expectation. ```js await expect(page).toHaveScreenshot(); diff --git a/packages/playwright-test/types/test.d.ts b/packages/playwright-test/types/test.d.ts index 809ed98432..0471a948a1 100644 --- a/packages/playwright-test/types/test.d.ts +++ b/packages/playwright-test/types/test.d.ts @@ -3328,11 +3328,8 @@ interface LocatorAssertions { }): Promise; /** - * Ensures that [Locator] resolves to a given screenshot. This function will re-take screenshots until it matches with the - * saved expectation. - * - * If there's no expectation yet, it will wait until two consecutive screenshots yield the same result, and save the last - * one as an expectation. + * This function will wait until two consecutive locator screenshots yield the same result, and then compare the last + * screenshot with the expectation. * * ```js * const locator = page.locator('button'); @@ -3406,11 +3403,8 @@ interface LocatorAssertions { }): Promise; /** - * Ensures that [Locator] resolves to a given screenshot. This function will re-take screenshots until it matches with the - * saved expectation. - * - * If there's no expectation yet, it will wait until two consecutive screenshots yield the same result, and save the last - * one as an expectation. + * This function will wait until two consecutive locator screenshots yield the same result, and then compare the last + * screenshot with the expectation. * * ```js * const locator = page.locator('button'); @@ -3562,11 +3556,8 @@ interface PageAssertions { not: PageAssertions; /** - * Ensures that the page resolves to a given screenshot. This function will re-take screenshots until it matches with the - * saved expectation. - * - * If there's no expectation yet, it will wait until two consecutive screenshots yield the same result, and save the last - * one as an expectation. + * This function will wait until two consecutive page screenshots yield the same result, and then compare the last + * screenshot with the expectation. * * ```js * await expect(page).toHaveScreenshot('image.png'); @@ -3670,11 +3661,8 @@ interface PageAssertions { }): Promise; /** - * Ensures that the page resolves to a given screenshot. This function will re-take screenshots until it matches with the - * saved expectation. - * - * If there's no expectation yet, it will wait until two consecutive screenshots yield the same result, and save the last - * one as an expectation. + * This function will wait until two consecutive page screenshots yield the same result, and then compare the last + * screenshot with the expectation. * * ```js * await expect(page).toHaveScreenshot(); diff --git a/tests/config/experimental.d.ts b/tests/config/experimental.d.ts index b66d8f6d6f..a625fd1eca 100644 --- a/tests/config/experimental.d.ts +++ b/tests/config/experimental.d.ts @@ -19540,11 +19540,8 @@ interface LocatorAssertions { }): Promise; /** - * Ensures that [Locator] resolves to a given screenshot. This function will re-take screenshots until it matches with the - * saved expectation. - * - * If there's no expectation yet, it will wait until two consecutive screenshots yield the same result, and save the last - * one as an expectation. + * This function will wait until two consecutive locator screenshots yield the same result, and then compare the last + * screenshot with the expectation. * * ```js * const locator = page.locator('button'); @@ -19618,11 +19615,8 @@ interface LocatorAssertions { }): Promise; /** - * Ensures that [Locator] resolves to a given screenshot. This function will re-take screenshots until it matches with the - * saved expectation. - * - * If there's no expectation yet, it will wait until two consecutive screenshots yield the same result, and save the last - * one as an expectation. + * This function will wait until two consecutive locator screenshots yield the same result, and then compare the last + * screenshot with the expectation. * * ```js * const locator = page.locator('button'); @@ -19774,11 +19768,8 @@ interface PageAssertions { not: PageAssertions; /** - * Ensures that the page resolves to a given screenshot. This function will re-take screenshots until it matches with the - * saved expectation. - * - * If there's no expectation yet, it will wait until two consecutive screenshots yield the same result, and save the last - * one as an expectation. + * This function will wait until two consecutive page screenshots yield the same result, and then compare the last + * screenshot with the expectation. * * ```js * await expect(page).toHaveScreenshot('image.png'); @@ -19882,11 +19873,8 @@ interface PageAssertions { }): Promise; /** - * Ensures that the page resolves to a given screenshot. This function will re-take screenshots until it matches with the - * saved expectation. - * - * If there's no expectation yet, it will wait until two consecutive screenshots yield the same result, and save the last - * one as an expectation. + * This function will wait until two consecutive page screenshots yield the same result, and then compare the last + * screenshot with the expectation. * * ```js * await expect(page).toHaveScreenshot();