playwright icon indicating copy to clipboard operation
playwright copied to clipboard

[Bug]: ariaSnapshot generates invalid yaml when text node has content "-"

Open MinnDevelopment opened this issue 1 year ago • 0 comments

Version

1.49.0

Steps to reproduce

Having an HTML region of this form

<section aria-labelledby="heading-id">
  <h3 id="heading-id">Title</h3>
  -
</section>

generates an invalid yaml output:

- region "Title":
  - heading "Title" [level=3]
  - text: -

From js-yaml with yaml.load(await locator.ariaSnapshot()):

YAMLException: bad indentation of a mapping entry (10:15)

  8 |     - region "Title":
  9 |       - heading "Title" [level=3]
 10 |       - text: -
--------------------^

Expected behavior

The YAML should be valid.

Actual behavior

Invalid characters in YAML, due to missing escaping.

Additional context

No response

Environment

System:
    OS: Linux 5.15 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish)
    CPU: (4) x64 13th Gen Intel(R) Core(TM) i7-1355U
    Memory: 2.96 GB / 7.76 GB
    Container: Yes
  Binaries:
    Node: 18.17.1 - ~/.nvm/versions/node/v18.17.1/bin/node
    npm: 9.6.7 - ~/.nvm/versions/node/v18.17.1/bin/npm
    pnpm: 8.12.1 - ~/.local/share/pnpm/pnpm
  npmPackages:
    @playwright/test: 1.49.0 => 1.49.0
    js-yaml: 4.1.0 => 4.1.0

MinnDevelopment avatar Dec 05 '24 13:12 MinnDevelopment