[Bug]: ariaSnapshot() emits \uXXXX / \b escapes in role names that toMatchAriaSnapshot() parses back incorrectly
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 3/5
- 見積もり時間
- 半日
- 初心者へのやさしさ
- 22/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript
- 領域
- testing
調査の方向性
Start with createKey() in packages/isomorphic/ariaSnapshotRenderer.ts, which quotes role names with JSON.stringify, and with KeyParser._readString() in packages/isomorphic/ariaSnapshot.ts, which drops the backslash from escapes like \u001f and \b. Run the four-case round-trip spec from the report. Done when those cases pass and the emitted YAML matches its source element. Open PR #43490 already targets this, so check it before starting.
索引モデルが issue の本文から書いたものです。
説明
Version
1.64.1 (the relevant code is unchanged on current main)
Steps to reproduce
- Add
tests/aria-name-escape.spec.tsto any project with@playwright/test1.64.1:
import { test, expect } from '@playwright/test';
for (const label of ['a\u0001b', 'a\u001fb', 'a\u0008b', '\ud83d'])
test(`round trip ${JSON.stringify(label)}`, async ({ page }) => {
await page.setContent('<button id="b"></button>');
await page.evaluate(l => document.getElementById('b')!.setAttribute('aria-label', l), label);
const snapshot = await page.locator('button').ariaSnapshot();
console.log(JSON.stringify(snapshot));
// A snapshot generated from an element should match that same element.
await expect(page.locator('button')).toMatchAriaSnapshot(snapshot);
});
npx playwright test aria-name-escape
Expected behavior
All four tests pass: the YAML emitted by ariaSnapshot() should match the element it was generated from.
Actual behavior
All four fail. Emitted snapshots:
- button "a\u0001b"
- button "a\u001fb"
- button "a\bb"
- button "\ud83d"
Error:
Error: expect(locator).toMatchAriaSnapshot(expected) failed
Received: serializes to the same string
For comparison, names containing " or \ round-trip fine.
Additional context
createKey() in packages/isomorphic/ariaSnapshotRenderer.ts quotes the role name with JSON.stringify(name), which writes control characters as \uXXXX (and \b for backspace) and lone surrogates as \udXXX.
KeyParser._readString() in packages/isomorphic/ariaSnapshot.ts treats \X as plain X, so \u001f is read back as u001f and \b as b, and the name no longer matches.
Only role names are affected. text: values and listitem content go through the yaml quoting (\x1f), which round-trips correctly.
A possible fix is to decode \uXXXX, \xXX, \b, \t, \n, \r and \f in _readString(), or to make the renderer use the same \xXX escaping as the yaml code. Happy to send a PR for whichever approach the team prefers.
This is a different problem from #43451 (unquoted ~/.inf/.nan scalars) and #43346 (quotes in names, closed).
Environment
System:
OS: Windows 11 10.0.26200
Binaries:
Node: 22.14.0
npmPackages:
@playwright/test: 1.64.1
Browser: Chromium (bundled with 1.64.1)
- 主要言語
- TypeScript
- スター
- 98k
- フォーク
- 6.6k
- 平均マージ
- 15時間 28分
- マージ済み PR(30日)
- 279
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/playwright のほかの issue
-
[Bug]: `playwright install` hangs silently for ~8 minutes when PLAYWRIGHT_BROWSERS_PATH is not writable対応中かも @dcrousso が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
microsoft/playwright#43606 ·
メンテナーはふだん 1 日以内に返信
-
[Feature]: Set `this.name` in `TargetClosedError` constructor再び着手できるかも @LeonxLJX が 51 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンP3-collecting-feedback
難易度 1/5 1時間未満 初心者へのやさしさ 86/100
microsoft/playwright#42522 · コメント 7 件 ·
メンテナーはふだん 1 日以内に返信
-
[Bug]: MCP browser_route with only `headers` bypasses --blocked-origins and --allowed-origins対応中かも @dhruv-techdev が今日担当しました。 オープン
microsoft/playwright#43630 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
microsoft/playwright#43629 ·
メンテナーはふだん 1 日以内に返信
-
microsoft/playwright#43628 ·
メンテナーはふだん 1 日以内に返信
microsoft/playwright の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
awesome-dsh-plugin/awesome-dsh-plugin#9184 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
farion1231/cc-switch#8829 ·
メンテナーはふだん 1 日以内に返信
-
[core-client] Remove unused hand-maintained transport helpers after the definition-table cutoverオープンdoc-audit enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100