Skip to content

visible/matches assertions cannot match page text containing quotes (snapshot YAML re-escaping) #14

Description

@queso

Found during the follow-up work on #12 (args-array migration).

The visible / not_visible / matches assertions read agent-browser's accessibility snapshot, whose YAML renderer re-escapes quotes inside quoted node labels: an apostrophe is doubled (it'sit''s) and a double quote is backslash-escaped. A visible: assertion on page text containing a quote can therefore never match, regardless of how faithfully the text reached the page.

Demonstrated: after set headers + open /echo-header, the page renders Header: Bearer it's-a-token verbatim (server receives it correctly), but the snapshot line is:

'heading "Header: Bearer it''s-a-token" [level=1]'

The runner's assertion layer should compare against un-escaped snapshot text (or parse the snapshot YAML properly) so quote-bearing page text is assertable. Textbox values are unaffected (value lines aren't YAML-quoted).

Note: two tests in test/runner-headers.test.ts currently work around this with matches patterns that tolerate exactly the doubled-apostrophe escaping (documented with block comments) — those workarounds can be simplified once this is fixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions