diff --git a/Gemfile b/Gemfile index 3860720e1..8d75b40e7 100644 --- a/Gemfile +++ b/Gemfile @@ -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' @@ -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 diff --git a/Gemfile.lock b/Gemfile.lock index 653fc1a5b..8a7050ed3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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 diff --git a/test/application_system_test_case.rb b/test/application_system_test_case.rb index dd55deaee..db7e2885b 100644 --- a/test/application_system_test_case.rb +++ b/test/application_system_test_case.rb @@ -1,5 +1,6 @@ require 'test_helper' require 'integration_helper' +require "axe/matchers/be_axe_clean" # Set systemtest behavior class ApplicationSystemTestCase < ActionDispatch::SystemTestCase diff --git a/test/integration/google_sso_test.rb b/test/integration/google_sso_test.rb index 97e22b5ec..f3c792665 100644 --- a/test/integration/google_sso_test.rb +++ b/test/integration/google_sso_test.rb @@ -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 diff --git a/test/system/routing_test.rb b/test/system/routing_test.rb index 4c0fa748e..3fd8ffa98 100644 --- a/test/system/routing_test.rb +++ b/test/system/routing_test.rb @@ -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 diff --git a/test/test_helper.rb b/test/test_helper.rb index 3e331a549..2e6577e8b 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -10,6 +10,7 @@ require 'omniauth_helper' require 'integration_helper' require 'rack/test' +require 'axe-capybara' # CI only if ENV['CI'] @@ -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