From 35aeace47616417dba1e1bba2ff6ba421bf846fb Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Mon, 13 Nov 2023 12:28:50 -0800 Subject: [PATCH] docs(assertions): note on whitespace normalization (#28110) Fixes https://github.com/microsoft/playwright-java/issues/1419 --- docs/src/api/class-locatorassertions.md | 10 ++++++++++ packages/playwright/types/test.d.ts | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/docs/src/api/class-locatorassertions.md b/docs/src/api/class-locatorassertions.md index 1569c69c2e..11244c0867 100644 --- a/docs/src/api/class-locatorassertions.md +++ b/docs/src/api/class-locatorassertions.md @@ -929,6 +929,11 @@ await Expect( Ensures the [Locator] points to an element that contains the given text. You can use regular expressions for the value as well. +**Details** + +When `expected` parameter is a string, Playwright will normalize whitespaces and line breaks both in the actual text and +in the expected string before matching. When regular expression is used, the actual text is matched as is. + **Usage** ```js @@ -1598,6 +1603,11 @@ Note that screenshot assertions only work with Playwright test runner. Ensures the [Locator] points to an element with the given text. You can use regular expressions for the value as well. +**Details** + +When `expected` parameter is a string, Playwright will normalize whitespaces and line breaks both in the actual text and +in the expected string before matching. When regular expression is used, the actual text is matched as is. + **Usage** ```js diff --git a/packages/playwright/types/test.d.ts b/packages/playwright/types/test.d.ts index e605859592..78d89b89d1 100644 --- a/packages/playwright/types/test.d.ts +++ b/packages/playwright/types/test.d.ts @@ -5632,6 +5632,11 @@ interface LocatorAssertions { * Ensures the {@link Locator} points to an element that contains the given text. You can use regular expressions for * the value as well. * + * **Details** + * + * When `expected` parameter is a string, Playwright will normalize whitespaces and line breaks both in the actual + * text and in the expected string before matching. When regular expression is used, the actual text is matched as is. + * * **Usage** * * ```js @@ -6029,6 +6034,11 @@ interface LocatorAssertions { * Ensures the {@link Locator} points to an element with the given text. You can use regular expressions for the value * as well. * + * **Details** + * + * When `expected` parameter is a string, Playwright will normalize whitespaces and line breaks both in the actual + * text and in the expected string before matching. When regular expression is used, the actual text is matched as is. + * * **Usage** * * ```js