From 1dcd756996aea2d8b2feb345ca8805866ea9a186 Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Fri, 26 Aug 2022 22:16:04 -0700 Subject: [PATCH] test: proper escaping for exact text match (#16866) --- tests/page/selectors-text.spec.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/page/selectors-text.spec.ts b/tests/page/selectors-text.spec.ts index cebb004e02..002e24e2ca 100644 --- a/tests/page/selectors-text.spec.ts +++ b/tests/page/selectors-text.spec.ts @@ -442,12 +442,13 @@ it('should work with unpaired quotes when not at the start', async ({ page }) => it('should work with paired quotes in the middle of selector', async ({ page }) => { it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/16858' }); - it.fail(); await page.setContent(`
pattern "^-?\\d+$"
`); expect(await page.locator(`div >> text=pattern "^-?\\d+$`).isVisible()); expect(await page.locator(`div >> text=pattern "^-?\\d+$"`).isVisible()); - expect(await page.locator(`div >> text='pattern "^-?\\d+$"'`).isVisible()); + // Should double escape inside quoted text. + expect(await page.locator(`div >> text='pattern "^-?\\\\d+$"'`).isVisible()); await expect(page.locator(`div >> text=pattern "^-?\\d+$`)).toBeVisible(); await expect(page.locator(`div >> text=pattern "^-?\\d+$"`)).toBeVisible(); - await expect(page.locator(`div >> text='pattern "^-?\\d+$"'`)).toBeVisible(); + // Should double escape inside quoted text. + await expect(page.locator(`div >> text='pattern "^-?\\\\d+$"'`)).toBeVisible(); });