Skip to content

Enhance automated accessibility tests to check markup validity#7640

Merged
aduth merged 3 commits intomainfrom
aduth-try-invalid-html-test
Jan 18, 2023
Merged

Enhance automated accessibility tests to check markup validity#7640
aduth merged 3 commits intomainfrom
aduth-try-invalid-html-test

Conversation

@aduth
Copy link
Contributor

@aduth aduth commented Jan 13, 2023

🛠 Summary of changes

Updates accessibility feature specs to check for valid HTML markup.

Related Slack discussion: https://gsa-tts.slack.com/archives/C01C89LM6UF/p1673541645409329

The implementation ended up being more difficult than I expected, due to how the existing specs run using ChromeDriver, and Chrome will try to automatically repair much of the invalid HTML we're interested in.

📜 Testing Plan

  1. Intentionally introduce errors to page HTML (e.g. git cherry-pick 226bee4)
  2. rspec ./spec/features/accessibility
  3. Observe failures

Example:

Expected page to have valid markup. Found syntax errors:
     
#<Nokogiri::XML::SyntaxError:"208:17: ERROR: That tag isn't allowed here  Currently open tags: html, body.\n  <p><div></div></p>\n                ^">
#<Nokogiri::XML::SyntaxError:"209:18: ERROR: Tag contains multiple attributes with the same name.\n  <div class=\"a\" class=\"b\"></div>\n                 ^">
#<Nokogiri::XML::SyntaxError:"211:1: ERROR: That tag isn't allowed here  Currently open tags: html, body, div.\n</body>\n^">

@aduth aduth requested a review from nickttng January 13, 2023 14:13
Copy link
Contributor

@nickttng nickttng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for looking into this! 👍🏼

Copy link
Contributor

@zachmargolis zachmargolis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

aduth and others added 3 commits January 17, 2023 13:33
changelog: Internal, Automated Testing, Enhance accessibility tests to check for invalid HTML markup
See: #7640 (comment)
Co-Authored-By: Zach Margolis <zbmargolis@gmail.com>
@aduth aduth force-pushed the aduth-try-invalid-html-test branch from 09aadad to d96b3e3 Compare January 17, 2023 18:48
@aduth aduth merged commit 1ba415b into main Jan 18, 2023
@aduth aduth deleted the aduth-try-invalid-html-test branch January 18, 2023 13:19
@mdiarra3 mdiarra3 mentioned this pull request Jan 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants