playwright icon indicating copy to clipboard operation
playwright copied to clipboard

[Feature]: Expose aria-invalid in ARIA Snapshots

Open foxable opened this issue 11 months ago • 0 comments

🚀 Feature Request

In order to allow testing form validation with ARIA snapshots, snapshots of input fields should include the invalid state, namely aria-invalid="true".

Example

Example input field:

<input type="text" value="Invalid value" aria-label="Label" aria-invalid="true" />

Potential ARIA snapshot:

- textbox "Label" [invalid]: Invalid value

Motivation

ARIA Snapshots are a great addition to Playwright, allowing to write assertions which include larger portions of the page, while also providing basic validation for the accessibility of features.

Forms and input fields are an important part of web applications and critical regarding accessibility. Being able to test them using ARIA snapshots including validation would enable testing forms with dependent form validations. In such scenarios, snapshotting the whole form would allow to reliably test dependent validations with a lower risk that later regressions affecting some form fields are missed.

foxable avatar Feb 18 '25 12:02 foxable