From 194f597ffaa08cbf1212a3da0b6fb2d51b7388f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristina=20Mu=C3=B1oz?= Date: Wed, 3 May 2023 17:39:35 -0500 Subject: [PATCH 1/5] Add axe depedency Add test helper for a11y check --- Gemfile | 2 ++ Gemfile.lock | 51 ++++++++++++++++++++--------- test/integration/google_sso_test.rb | 4 +++ test/test_helper.rb | 7 ++++ 4 files changed, 48 insertions(+), 16 deletions(-) diff --git a/Gemfile b/Gemfile index 3860720e1..c58349664 100644 --- a/Gemfile +++ b/Gemfile @@ -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..5492700eb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -73,13 +73,23 @@ GEM i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) - acts_as_tenant (0.5.1) + acts_as_tenant (0.5.3) rails (>= 5.2) request_store (>= 1.0.5) addressable (2.8.4) 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) @@ -94,7 +104,7 @@ GEM actionpack (>= 5.2) activemodel (>= 5.2) builder (3.2.4) - bullet (7.0.2) + bullet (7.0.7) activesupport (>= 3.0.0) uniform_notifier (~> 1.11) bundler-audit (0.9.1) @@ -114,12 +124,16 @@ GEM capybara (>= 1.0, < 4) launchy coderay (1.1.3) - colorize (0.8.1) + coercible (1.0.0) + descendants_tracker (~> 0.0.1) + colorize (1.0.3) 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) @@ -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) @@ -207,7 +223,6 @@ GEM minitest (> 1.2.0) rails (>= 2.3.3) mini_mime (1.1.2) - mini_portile2 (2.8.2) minitest (5.18.1) minitest-optional_retry (0.0.2) minitest (~> 5.0) @@ -215,7 +230,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) @@ -228,10 +243,7 @@ GEM net-smtp (0.3.3) net-protocol nio4r (2.5.9) - nokogiri (1.15.2) - mini_portile2 (~> 2.8.2) - racc (~> 1.4) - nokogiri (1.15.2-x86_64-linux) + nokogiri (1.15.2-arm64-darwin) racc (~> 1.4) oauth2 (2.0.9) faraday (>= 0.17.3, < 3.0) @@ -279,16 +291,16 @@ GEM pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) - psych (5.0.2) + psych (5.1.0) stringio public_suffix (5.0.1) - puma (6.2.2) + puma (6.3.0) nio4r (~> 2.0) racc (1.7.1) 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) @@ -349,7 +361,7 @@ GEM unicode-display_width (>= 2.4.0, < 3.0) rubocop-ast (1.29.0) parser (>= 3.2.1.0) - rubocop-rails (2.20.1) + rubocop-rails (2.20.2) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) @@ -392,11 +404,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 +423,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,6 +451,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 diff --git a/test/integration/google_sso_test.rb b/test/integration/google_sso_test.rb index 97e22b5ec..745e965a5 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' + assert_accessible(page) end end diff --git a/test/test_helper.rb b/test/test_helper.rb index 3e331a549..30e8b38c3 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -10,6 +10,8 @@ require 'omniauth_helper' require 'integration_helper' require 'rack/test' +require 'axe-capybara' +require 'axe-core' # CI only if ENV['CI'] @@ -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 From f1b2ea6b5ae2932ed7f680d7a84d4b0c92311d22 Mon Sep 17 00:00:00 2001 From: colinxfleming Date: Tue, 20 Jun 2023 23:22:15 -0400 Subject: [PATCH 2/5] failing accessibility test --- test/application_system_test_case.rb | 1 + test/integration/google_sso_test.rb | 2 +- test/system/routing_test.rb | 1 + test/test_helper.rb | 1 - 4 files changed, 3 insertions(+), 2 deletions(-) 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 745e965a5..f3c792665 100644 --- a/test/integration/google_sso_test.rb +++ b/test/integration/google_sso_test.rb @@ -28,6 +28,6 @@ class GoogleSSOTest < ActionDispatch::IntegrationTest it 'sign in page is accessible' do visit root_path wait_for_element 'Sign in with Google' - assert_accessible(page) + 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 30e8b38c3..2e6577e8b 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -11,7 +11,6 @@ require 'integration_helper' require 'rack/test' require 'axe-capybara' -require 'axe-core' # CI only if ENV['CI'] From d16ed370d36b1e8398dc5570a806ff016662f1b6 Mon Sep 17 00:00:00 2001 From: Cristina Munoz Date: Wed, 21 Jun 2023 17:09:11 -0500 Subject: [PATCH 3/5] Revert nokogiri, puma, and bullet versions --- Gemfile.lock | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 5492700eb..efa802f74 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -73,7 +73,7 @@ GEM i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) - acts_as_tenant (0.5.3) + acts_as_tenant (0.5.1) rails (>= 5.2) request_store (>= 1.0.5) addressable (2.8.4) @@ -104,7 +104,7 @@ GEM actionpack (>= 5.2) activemodel (>= 5.2) builder (3.2.4) - bullet (7.0.7) + bullet (7.0.2) activesupport (>= 3.0.0) uniform_notifier (~> 1.11) bundler-audit (0.9.1) @@ -126,7 +126,7 @@ GEM coderay (1.1.3) coercible (1.0.0) descendants_tracker (~> 0.0.1) - colorize (1.0.3) + colorize (0.8.1) concurrent-ruby (1.2.2) crass (1.0.6) cssbundling-rails (1.2.0) @@ -165,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) @@ -223,6 +223,7 @@ GEM minitest (> 1.2.0) rails (>= 2.3.3) mini_mime (1.1.2) + mini_portile2 (2.8.2) minitest (5.18.1) minitest-optional_retry (0.0.2) minitest (~> 5.0) @@ -243,7 +244,10 @@ GEM net-smtp (0.3.3) net-protocol nio4r (2.5.9) - nokogiri (1.15.2-arm64-darwin) + nokogiri (1.15.2) + mini_portile2 (~> 2.8.2) + racc (~> 1.4) + nokogiri (1.15.2-x86_64-linux) racc (~> 1.4) oauth2 (2.0.9) faraday (>= 0.17.3, < 3.0) @@ -291,10 +295,10 @@ GEM pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) - psych (5.1.0) + psych (5.0.2) stringio public_suffix (5.0.1) - puma (6.3.0) + puma (6.2.2) nio4r (~> 2.0) racc (1.7.1) rack (2.2.7) From 5b27de4e6e496cd037f5458ba549dbb48a9976e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristina=20Mu=C3=B1oz?= Date: Thu, 22 Jun 2023 10:56:15 -0500 Subject: [PATCH 4/5] Upgrade bootstrap form This should remove the role attribute from the default bootstrap form https://github.com/bootstrap-ruby/bootstrap_form#configuration --- Gemfile | 2 +- Gemfile.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index c58349664..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' diff --git a/Gemfile.lock b/Gemfile.lock index efa802f74..a4ba03afe 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -100,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) @@ -458,7 +458,7 @@ DEPENDENCIES axe-core-api axe-core-capybara bootsnap (>= 1.4.2) - bootstrap_form (~> 4.5.0) + bootstrap_form (~> 5.2.3) bullet bundler-audit byebug From ff4369514c85b4c1105b0d51d4416b6f650d9005 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristina=20Mu=C3=B1oz?= Date: Tue, 27 Jun 2023 11:58:04 -0500 Subject: [PATCH 5/5] Downgrade rubocop-rails --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index a4ba03afe..8a7050ed3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -365,7 +365,7 @@ GEM unicode-display_width (>= 2.4.0, < 3.0) rubocop-ast (1.29.0) parser (>= 3.2.1.0) - rubocop-rails (2.20.2) + rubocop-rails (2.20.1) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.33.0, < 2.0)