Skip to content

Reset cookie when validating HTML markup in accessibility test to improve reliability#12428

Merged
mitchellhenke merged 1 commit intomainfrom
mitchellhenke/fix-flaky-accessiblity-testing-matcher
Aug 15, 2025
Merged

Reset cookie when validating HTML markup in accessibility test to improve reliability#12428
mitchellhenke merged 1 commit intomainfrom
mitchellhenke/fix-flaky-accessiblity-testing-matcher

Conversation

@mitchellhenke
Copy link
Contributor

@mitchellhenke mitchellhenke commented Aug 14, 2025

🛠 Summary of changes

An additional check was added in #7640 to better ensure HTML markup validity. It requires some more complex uses of Capybara drivers, and one of the (unintuitive) side effects is that the cookie that is set in the rack driver can persist beyond the current test. For a consistent reproduction, I have been running:

./bin/rspec spec/features/idv/in_person_threatmetrix_spec.rb:75 spec/features/idv/cancel_spec.rb:23 --seed 17897

The result of the existing behavior is a test that follows one that calls expect_page_to_have_no_accessibility_violations may have an existing session. It is not a more consistent issue as the data in the session is frequently overwritten (especially warden-based elements). The specific issue for this more common failure is the SP request may still be persisted in the session, but the test expects the content to be presented based on no SP being present.

The proposed fix is to set the cookie to an empty string, which seems to address the issue in my testing, at least for now. We may want to consider different approaches as the behavior is deeper in the Capybara driver and harder to reason about.

@mitchellhenke mitchellhenke force-pushed the mitchellhenke/fix-flaky-accessiblity-testing-matcher branch from fe4087b to d509152 Compare August 14, 2025 16:44
@mitchellhenke mitchellhenke marked this pull request as ready for review August 14, 2025 17:07
@mitchellhenke mitchellhenke force-pushed the mitchellhenke/fix-flaky-accessiblity-testing-matcher branch from cdf4dad to 2e9d9b8 Compare August 14, 2025 17:28
…rove reliability

changelog: Internal, Testing, Reset cookie when validating HTML markup in accessibility test to improve reliability

Co-authored-by: Davi (she/they) <davida.marion@gsa.gov>
@mitchellhenke mitchellhenke force-pushed the mitchellhenke/fix-flaky-accessiblity-testing-matcher branch from 2e9d9b8 to 41c5270 Compare August 14, 2025 17:31
@mitchellhenke mitchellhenke requested a review from Sgtpluck August 14, 2025 17:49
@mitchellhenke mitchellhenke force-pushed the mitchellhenke/fix-flaky-accessiblity-testing-matcher branch from dcadb84 to 41c5270 Compare August 14, 2025 19:42
@mitchellhenke mitchellhenke merged commit fcc7003 into main Aug 15, 2025
1 check passed
@mitchellhenke mitchellhenke deleted the mitchellhenke/fix-flaky-accessiblity-testing-matcher branch August 15, 2025 12:42
mitchellhenke pushed a commit that referenced this pull request Aug 19, 2025
* LG-16538: sms one account notifications (#12408)

* changelog: Upcoming Features, One Account, Notify users via text message

* add changes

* fix translation error and rubocop

* Reset cookie when validating HTML markup in accessibility test to improve reliability (#12428)

changelog: Internal, Testing, Reset cookie when validating HTML markup in accessibility test to improve reliability

Co-authored-by: Davi (she/they) <davida.marion@gsa.gov>

* Bump libphonenumber-js from 1.12.10 to 1.12.12 (#12431)

Bumps [libphonenumber-js](https://gitlab.com/catamphetamine/libphonenumber-js) from 1.12.10 to 1.12.12.
- [Changelog](https://gitlab.com/catamphetamine/libphonenumber-js/blob/master/CHANGELOG.md)
- [Commits](https://gitlab.com/catamphetamine/libphonenumber-js/compare/v1.12.10...v1.12.12)

---
updated-dependencies:
- dependency-name: libphonenumber-js
  dependency-version: 1.12.12
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Update Rails dependencies to patch vulnerabilities (#12433)

changelog: Internal, Maintenance, Update Rails dependencies to patch vulnerabilities

* Update rubyzip (#12435)

changelog: Internal, Maintenance, Update rubyzip

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Malick Diarra <malick.diarra@gsa.gov>
Co-authored-by: Davi (she/they) <davida.marion@gsa.gov>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants