Commit 96fbf32
committed
Fix Playwright selectors for Choices.js combobox
The govuk_publishing_components v65.1.1 gem includes an upgrade of
Choices.js from v11.1.0 to v11.2.1. Choices.js v11.2.0 introduced an
ARIA accessibility fix (Choices-js/Choices#1330) that changes how
elements are exposed in the accessibility tree.
This caused Playwright's get_by_role() queries to match multiple
elements:
- get_by_role('combobox') matched both the hidden <select> and the
visible Choices.js wrapper <div>
- get_by_role('option') matched both the hidden <option> elements
and the visible Choices.js dropdown items
The fix uses CSS locators to target only the visible Choices.js
elements:
- div.choices[role='combobox'] for the combobox wrapper
- .choices__list--dropdown [role='option'] for dropdown options
Note: to reproduce CI failures locally, assets must be precompiled:
rm -rf tmp/cache public/assets
RAILS_ENV=test bundle exec rails assets:precompile
bundle exec cucumber1 parent ea21f7d commit 96fbf32
1 file changed
Lines changed: 2 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
| 91 | + | |
92 | 92 | | |
93 | | - | |
94 | | - | |
| 93 | + | |
95 | 94 | | |
96 | 95 | | |
97 | 96 | | |
| |||
0 commit comments