Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

test: add a test for leading and trailing spaces (#11156)

Pavel Feldman38801a3b8524
diff --git a/tests/page/selectors-text.spec.ts b/tests/page/selectors-text.spec.ts
index e57d4550be..e0c1e6547a 100644
--- a/tests/page/selectors-text.spec.ts
+++ b/tests/page/selectors-text.spec.ts
@@ -404,3 +404,10 @@ it('should match root after >> with *', async ({ page }) => {
await page.setContent(`<button> hello world </button> <button> hellow <span> world </span> </button>`);
expect(await page.$$eval('*css=button >> text=hello >> text=world', els => els.length)).toBe(2);
});
+
+it('should work with leading and trailing spaces', async ({ page }) => {
+ it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/10997' });
+ await page.setContent(`<button> Add widget </button>`);
+ await expect(page.locator('text=Add widget')).toBeVisible();
+ await expect(page.locator('text= Add widget ')).toBeVisible();
+});