From c02cb92159e2125f01b03a792dfa9f13bc32a091 Mon Sep 17 00:00:00 2001 From: Kate Lynch Date: Tue, 25 Jan 2022 16:50:23 -0500 Subject: [PATCH 1/5] Initial integration, failing homepage test --- Gemfile | 1 + Gemfile.lock | 23 +++++++++++++++++++++++ spec/rails_helper.rb | 2 ++ spec/system/accessibility_spec.rb | 22 ++++++++++++++++++++++ 4 files changed, 48 insertions(+) create mode 100644 spec/system/accessibility_spec.rb diff --git a/Gemfile b/Gemfile index 2b8e2fe4..da774865 100644 --- a/Gemfile +++ b/Gemfile @@ -59,6 +59,7 @@ group :development do end group :test do + gem 'axe-core-rspec' gem 'capybara', '>= 3.26' gem 'coveralls', require: false gem 'selenium-webdriver' diff --git a/Gemfile.lock b/Gemfile.lock index 4b91c6e1..2b9b35ed 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -75,6 +75,17 @@ GEM ast (2.4.2) autoprefixer-rails (10.2.5.1) execjs (> 0) + axe-core-api (4.3.2) + dumb_delegator + virtus + axe-core-rspec (4.3.2) + axe-core-api + dumb_delegator + virtus + 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.16) bcrypt_pbkdf (1.1.0) bindex (0.8.1) @@ -133,6 +144,8 @@ GEM childprocess (3.0.0) chronic (0.10.2) coderay (1.1.3) + coercible (1.0.0) + descendants_tracker (~> 0.0.1) concurrent-ruby (1.1.9) coveralls (0.8.23) json (>= 1.8, < 3) @@ -145,6 +158,8 @@ GEM crass (1.0.6) deprecation (1.1.0) activesupport + descendants_tracker (0.0.4) + thread_safe (~> 0.3, >= 0.3.1) devise (4.8.0) bcrypt (~> 3.0) orm_adapter (~> 0.1) @@ -158,6 +173,7 @@ GEM domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) dot-properties (0.1.3) + dumb_delegator (1.0.0) ed25519 (1.2.4) erubi (1.10.0) execjs (2.8.1) @@ -197,6 +213,7 @@ GEM httpclient (2.8.3) i18n (1.8.10) concurrent-ruby (~> 1.0) + ice_nine (0.11.2) jbuilder (2.11.2) activesupport (>= 5.0.0) jquery-rails (4.4.0) @@ -403,6 +420,7 @@ GEM term-ansicolor (1.7.1) tins (~> 1.0) thor (1.1.0) + thread_safe (0.3.6) tilt (2.0.10) tins (1.29.1) sync @@ -432,6 +450,10 @@ GEM unicode-display_width (1.7.0) view_component (2.34.0) activesupport (>= 5.0.0, < 7.0) + 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) web-console (4.1.0) @@ -469,6 +491,7 @@ PLATFORMS x86_64-linux DEPENDENCIES + axe-core-rspec bcrypt (~> 3.1.7) bcrypt_pbkdf bixby diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index cc54fe28..98c41d06 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -2,11 +2,13 @@ # This file is copied to spec/ when you run 'rails generate rspec:install' require 'spec_helper' + ENV['RAILS_ENV'] ||= 'test' require File.expand_path('../config/environment', __dir__) # Prevent database truncation if the environment is production abort('The Rails environment is running in production mode!') if Rails.env.production? require 'rspec/rails' +require 'axe-rspec' # Add additional requires below this line. Rails is not loaded until this point! require 'webmock/rspec' diff --git a/spec/system/accessibility_spec.rb b/spec/system/accessibility_spec.rb new file mode 100644 index 00000000..aebfd37b --- /dev/null +++ b/spec/system/accessibility_spec.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true +require "rails_helper" + +describe "accessibility", type: :system, js: true do + before do + stub_request(:get, "https://github.com/mozilla/geckodriver/releases/latest"). + with( + headers: { + 'Accept'=>'*/*', + 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', + 'Host'=>'github.com', + 'User-Agent'=>'Ruby' + } + ) + end + context "homepage" do + it "complies with ..." do + visit "/" + expect(page).to be_axe_clean + end + end +end From 7abfeb2268eb1eb1650474ad53654921fb7d7150 Mon Sep 17 00:00:00 2001 From: Kate Lynch Date: Tue, 25 Jan 2022 16:54:59 -0500 Subject: [PATCH 2/5] Use WCAG 2.0 AA and Section 508 --- spec/system/accessibility_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/system/accessibility_spec.rb b/spec/system/accessibility_spec.rb index aebfd37b..51ac13f6 100644 --- a/spec/system/accessibility_spec.rb +++ b/spec/system/accessibility_spec.rb @@ -3,8 +3,8 @@ describe "accessibility", type: :system, js: true do before do - stub_request(:get, "https://github.com/mozilla/geckodriver/releases/latest"). - with( + stub_request(:get, "https://github.com/mozilla/geckodriver/releases/latest") + .with( headers: { 'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', @@ -16,7 +16,7 @@ context "homepage" do it "complies with ..." do visit "/" - expect(page).to be_axe_clean + expect(page).to be_axe_clean.according_to :wcag2aa, :section508 end end end From b3b750194665be7aee9126b98f767ed0adb2ab67 Mon Sep 17 00:00:00 2001 From: Kate Lynch Date: Wed, 26 Jan 2022 09:49:22 -0500 Subject: [PATCH 3/5] Added search results, about page, show view to accessibility tests --- spec/system/accessibility_spec.rb | 32 ++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/spec/system/accessibility_spec.rb b/spec/system/accessibility_spec.rb index 51ac13f6..824b9264 100644 --- a/spec/system/accessibility_spec.rb +++ b/spec/system/accessibility_spec.rb @@ -2,7 +2,16 @@ require "rails_helper" describe "accessibility", type: :system, js: true do + + let(:community_fetch_with_expanded_metadata) { file_fixture("single_item.xml").read } + let(:indexer) do + Indexer.new(community_fetch_with_expanded_metadata) + end + before do + Blacklight.default_index.connection.delete_by_query("*:*") + Blacklight.default_index.connection.commit + indexer.index stub_request(:get, "https://github.com/mozilla/geckodriver/releases/latest") .with( headers: { @@ -14,9 +23,30 @@ ) end context "homepage" do - it "complies with ..." do + it "complies with WCAG 2.0 AA and Section 508" do visit "/" expect(page).to be_axe_clean.according_to :wcag2aa, :section508 end end + + context "about page" do + it "complies with WCAG 2.0 AA and Section 508" do + visit "/about" + expect(page).to be_axe_clean.according_to :wcag2aa, :section508 + end + end + + context "search results page" do + it "complies with WCAG 2.0 AA and Section 508" do + visit '/?search_field=all_fields&q=' + expect(page).to be_axe_clean.according_to :wcag2aa, :section508 + end + end + + context "single record page page" do + it "complies with WCAG 2.0 AA and Section 508" do + visit '/catalog/78348' + expect(page).to be_axe_clean.according_to :wcag2aa, :section508 + end + end end From 78e92370463768b31b3fc63e72d058fef61fd36e Mon Sep 17 00:00:00 2001 From: Kate Lynch Date: Wed, 26 Jan 2022 16:22:25 -0500 Subject: [PATCH 4/5] First pass accessibility suite, ignoring false positives --- app/assets/stylesheets/components/header.scss | 5 + .../components/recently_added.scss | 1 + app/assets/stylesheets/components/search.scss | 5 + .../modules/deployment_version.scss | 2 +- app/views/catalog/show.html.erb | 132 +++++++++--------- spec/system/accessibility_spec.rb | 20 ++- 6 files changed, 97 insertions(+), 68 deletions(-) create mode 100644 app/assets/stylesheets/components/search.scss diff --git a/app/assets/stylesheets/components/header.scss b/app/assets/stylesheets/components/header.scss index 96de25f4..f977c6cb 100644 --- a/app/assets/stylesheets/components/header.scss +++ b/app/assets/stylesheets/components/header.scss @@ -14,3 +14,8 @@ .navbar-light .navbar-nav .nav-link:hover { text-decoration: underline; } + +.submit-search-text { + background-color: #005BBD; + color: #ffffff; +} diff --git a/app/assets/stylesheets/components/recently_added.scss b/app/assets/stylesheets/components/recently_added.scss index 66667152..cb00190a 100644 --- a/app/assets/stylesheets/components/recently_added.scss +++ b/app/assets/stylesheets/components/recently_added.scss @@ -16,6 +16,7 @@ } .title a { font-size: 1.2em; + color: #005BBD; } } } diff --git a/app/assets/stylesheets/components/search.scss b/app/assets/stylesheets/components/search.scss new file mode 100644 index 00000000..6dbd7cb8 --- /dev/null +++ b/app/assets/stylesheets/components/search.scss @@ -0,0 +1,5 @@ +.input-group { + button.btn { + background-color: #005BBD; + } +} diff --git a/app/assets/stylesheets/modules/deployment_version.scss b/app/assets/stylesheets/modules/deployment_version.scss index 300dcbba..7842f0e1 100644 --- a/app/assets/stylesheets/modules/deployment_version.scss +++ b/app/assets/stylesheets/modules/deployment_version.scss @@ -9,7 +9,7 @@ margin-left: $space-base; margin-right: $space-base; - color: #aaa; /* gray */ + color: #000000; /* gray */ .lux-text-style[data-v-ba32f400] { font-size: $font-size-x-small; diff --git a/app/views/catalog/show.html.erb b/app/views/catalog/show.html.erb index 6403440f..a75eb40e 100644 --- a/app/views/catalog/show.html.erb +++ b/app/views/catalog/show.html.erb @@ -1,7 +1,7 @@