Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a11y testing #2946

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ gem 'net-smtp', require: false # for compat reasons, required in builds
gem 'sprockets-rails'
gem 'jsbundling-rails'
gem 'cssbundling-rails'
gem 'bootstrap_form', '~> 4.5.0'
gem 'bootstrap_form', '~> 5.2.3'

# Our database is postgres
gem 'pg', '~> 1.2'
Expand Down 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
43 changes: 33 additions & 10 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 All @@ -90,9 +100,9 @@ GEM
smart_properties
bootsnap (1.16.0)
msgpack (~> 1.2)
bootstrap_form (4.5.0)
actionpack (>= 5.2)
activemodel (>= 5.2)
bootstrap_form (5.2.3)
actionpack (>= 6.0)
activemodel (>= 6.0)
builder (3.2.4)
bullet (7.0.2)
activesupport (>= 3.0.0)
Expand All @@ -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.2.0)
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 All @@ -141,7 +156,7 @@ GEM
railties (>= 5.0.0)
faker (3.2.0)
i18n (>= 1.8.11, < 2)
faraday (2.7.6)
faraday (2.7.7)
faraday-net_http (>= 2.0, < 3.1)
ruby2_keywords (>= 0.0.4)
faraday-net_http (3.0.2)
Expand All @@ -150,7 +165,7 @@ GEM
thor (>= 0.14.0, < 2)
foreman (0.87.2)
geokit (1.14.0)
globalid (1.1.0)
globalid (1.0.1)
activesupport (>= 5.0)
hashery (2.1.2)
hashie (5.0.0)
Expand All @@ -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.2)
railties (>= 6.0.0)
json (2.6.3)
Expand Down Expand Up @@ -215,7 +231,7 @@ GEM
minitest (>= 5.0)
railties (>= 4.1)
minitest-stub-const (0.6)
msgpack (1.6.1)
msgpack (1.7.1)
multi_json (1.15.0)
multi_xml (0.6.0)
net-imap (0.3.6)
Expand Down Expand Up @@ -288,7 +304,7 @@ GEM
rack (2.2.7)
rack-attack (6.6.1)
rack (>= 1.0, < 3)
rack-protection (3.0.5)
rack-protection (3.0.6)
rack
rack-test (2.1.0)
rack (>= 1.3)
Expand Down Expand Up @@ -392,11 +408,12 @@ GEM
activesupport (>= 5.2)
sprockets (>= 3.0.0)
state_geo_tools (1.0.0)
stringio (3.0.5)
stringio (3.0.7)
strong_password (0.0.10)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
thor (1.2.2)
thread_safe (0.3.6)
timecop (0.9.6)
timeout (0.4.0)
ttfunk (1.7.0)
Expand All @@ -410,7 +427,11 @@ GEM
tzinfo (>= 1.0.0)
unicode-display_width (2.4.2)
uniform_notifier (1.16.0)
version_gem (1.1.1)
version_gem (1.1.3)
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 @@ -434,8 +455,10 @@ 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)
bootstrap_form (~> 5.2.3)
bullet
bundler-audit
byebug
Expand Down
1 change: 1 addition & 0 deletions test/application_system_test_case.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require 'test_helper'
require 'integration_helper'
require "axe/matchers/be_axe_clean"

# Set systemtest behavior
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
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'
end
end
end
1 change: 1 addition & 0 deletions test/system/routing_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ class RoutingTest < ApplicationSystemTestCase
log_in_as @user
visit authenticated_root_path
assert has_text? "DARIA - #{ActsAsTenant.current_tenant.full_name} - Development"
assert_accessible page
end
end
6 changes: 6 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
require 'omniauth_helper'
require 'integration_helper'
require 'rack/test'
require 'axe-capybara'

# CI only
if ENV['CI']
Expand Down Expand Up @@ -129,3 +130,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