Skip to content

Commit

Permalink
Allow Capybara to search for ARIA labels
Browse files Browse the repository at this point in the history
It's cumbersome to find elements by CSS selectors to click them, and the
new admin has a few instances where we have no standalone label.
  • Loading branch information
mamhoff committed Jun 11, 2024
1 parent dc780f6 commit e0c883b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@

it "lists products", :js do
visit "/admin/orders"
find("button[aria-label=Filter]").click

click_button "Filter"

within("div[role=search]") do
expect(page).to have_content("Promotions")
find(:xpath, "//summary[normalize-space(text())='Promotions']").click
Expand Down
1 change: 1 addition & 0 deletions legacy_promotions/spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
require 'axe-capybara'

Capybara.javascript_driver = (ENV['CAPYBARA_DRIVER'] || :selenium_chrome_headless).to_sym
Capybara.enable_aria_label = true

RSpec.configure do |config|
config.fixture_path = File.join(__dir__, "fixtures")
Expand Down

0 comments on commit e0c883b

Please sign in to comment.