Skip to content

Commit

Permalink
Add axe depedency
Browse files Browse the repository at this point in the history
Add test helper for a11y check
  • Loading branch information
Cristina Muñoz committed May 3, 2023
1 parent 758dc6c commit efde603
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ group :test do
gem 'capybara-screenshot'
gem 'launchy' # open up capybara screenshots automatically with `save_and_open_screenshot`
gem 'webdrivers'
gem 'axe-core-capybara'
gem 'axe-core-api'

# Test coverage related libraries
gem 'simplecov', require: false
Expand Down
23 changes: 23 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,16 @@ GEM
public_suffix (>= 2.0.2, < 6.0)
afm (0.2.2)
ast (2.4.2)
axe-core-api (4.7.0)
dumb_delegator
virtus
axe-core-capybara (4.7.0)
axe-core-api
dumb_delegator
axiom-types (0.1.1)
descendants_tracker (~> 0.0.4)
ice_nine (~> 0.11.0)
thread_safe (~> 0.3, >= 0.3.1)
bcrypt (3.1.18)
better_html (2.0.1)
actionview (>= 6.0)
Expand Down Expand Up @@ -114,12 +124,16 @@ GEM
capybara (>= 1.0, < 4)
launchy
coderay (1.1.3)
coercible (1.0.0)
descendants_tracker (~> 0.0.1)
colorize (0.8.1)
concurrent-ruby (1.2.2)
crass (1.0.6)
cssbundling-rails (1.1.2)
railties (>= 6.0.0)
date (3.3.3)
descendants_tracker (0.0.4)
thread_safe (~> 0.3, >= 0.3.1)
devise (4.9.2)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
Expand All @@ -133,6 +147,7 @@ GEM
dotenv-rails (2.8.1)
dotenv (= 2.8.1)
railties (>= 3.2)
dumb_delegator (1.0.0)
erubi (1.12.0)
factory_bot (6.2.1)
activesupport (>= 5.0.0)
Expand Down Expand Up @@ -171,6 +186,7 @@ GEM
rails-i18n
rainbow (>= 2.2.2, < 4.0)
terminal-table (>= 1.5.1)
ice_nine (0.11.2)
jsbundling-rails (1.1.1)
railties (>= 6.0.0)
json (2.6.3)
Expand Down Expand Up @@ -395,6 +411,7 @@ GEM
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
thor (1.2.1)
thread_safe (0.3.6)
timecop (0.9.6)
timeout (0.3.1)
ttfunk (1.7.0)
Expand All @@ -409,6 +426,10 @@ GEM
unicode-display_width (2.4.2)
uniform_notifier (1.16.0)
version_gem (1.1.1)
virtus (2.0.0)
axiom-types (~> 0.1)
coercible (~> 1.0)
descendants_tracker (~> 0.0, >= 0.0.3)
warden (1.2.9)
rack (>= 2.0.9)
webdrivers (5.2.0)
Expand All @@ -432,6 +453,8 @@ PLATFORMS
DEPENDENCIES
activerecord-session_store
acts_as_tenant (~> 0.5.0)
axe-core-api
axe-core-capybara
bootsnap (>= 1.4.2)
bootstrap_form (~> 4.5.0)
bullet
Expand Down
4 changes: 4 additions & 0 deletions test/integration/google_sso_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,9 @@ class GoogleSSOTest < ActionDispatch::IntegrationTest

assert has_content? 'Forgot your password?'
end
it 'sign in page is accessible' do
visit root_path
wait_for_element 'Sign in with Google'
assert_accessible(page)
end
end
7 changes: 7 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
require 'omniauth_helper'
require 'integration_helper'
require 'rack/test'
require 'axe-capybara'
require 'axe-core-api'

# CI only
if ENV['CI']
Expand Down Expand Up @@ -129,3 +131,8 @@ class ActionDispatch::IntegrationTest

# for controllers
end

def assert_accessible(page, matcher = Axe::Matchers::BeAxeClean.new.according_to(:wcag21aa, 'best-practice'))
audit_result = matcher.audit(page)
assert(audit_result.passed?, audit_result.failure_message)
end

0 comments on commit efde603

Please sign in to comment.