Skip to content

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

test: cover more aria escaping edge cases (#33463)

Pavel Feldman2f8a14c6e2c2
diff --git a/tests/page/to-match-aria-snapshot.spec.ts b/tests/page/to-match-aria-snapshot.spec.ts
index 3b226f480a..754f3fd2a9 100644
--- a/tests/page/to-match-aria-snapshot.spec.ts
+++ b/tests/page/to-match-aria-snapshot.spec.ts
@@ -441,12 +441,21 @@ test('should unpack escaped names', async ({ page }) => {
await expect(page.locator('body')).toMatchAriaSnapshot(`
- button "Click \\\" me"
`);
+ await expect(page.locator('body')).toMatchAriaSnapshot(`
+ - button /Click \" me/
+ `);
+ await expect(page.locator('body')).toMatchAriaSnapshot(`
+ - button /Click \\\" me/
+ `);
}
{
await page.setContent(`
<button>Click \\ me</button>
`);
+ await expect(page.locator('body')).toMatchAriaSnapshot(`
+ - button "Click \\\\ me"
+ `);
await expect(page.locator('body')).toMatchAriaSnapshot(`
- button /Click \\\\ me/
`);
diff --git a/tests/playwright-test/update-aria-snapshot.spec.ts b/tests/playwright-test/update-aria-snapshot.spec.ts
index d58bfce899..e8999052a1 100644
--- a/tests/playwright-test/update-aria-snapshot.spec.ts
+++ b/tests/playwright-test/update-aria-snapshot.spec.ts
@@ -167,7 +167,9 @@ test('should generate baseline with special characters', async ({ runInlineTest
<button>Click ' me</button>
<button>Click: ' me</button>
<button>Click " me</button>
+ <button>Click " me 123</button>
<button>Click \\\\ me</button>
+ <button>Click \\\\ me 123</button>
<li>Item: 1</li>
<li>Item {a: b}</li>
</ul>\`);
@@ -181,7 +183,7 @@ test('should generate baseline with special characters', async ({ runInlineTest
const data = fs.readFileSync(patchPath, 'utf-8');
expect(data).toBe(`--- a/a.spec.ts
+++ b/a.spec.ts
-@@ -11,6 +11,16 @@
+@@ -13,6 +13,18 @@
<li>Item: 1</li>
<li>Item {a: b}</li>
</ul>\`);
@@ -193,7 +195,9 @@ test('should generate baseline with special characters', async ({ runInlineTest
+ - button "Click ' me"
+ - 'button "Click: '' me"'
+ - button "Click \\\\" me"
++ - button /Click " me \\\\d+/
+ - button "Click \\\\\\\\ me"
++ - button /Click \\\\\\\\ me \\\\d+/
+ - listitem: \"Item: 1\"
+ - listitem: \"Item {a: b}\"
+ \`);