Browse Source

CLDC-4115: Ensure page is loaded before running accessibility tests

unclear whether this will make a difference, will push now and run the pipeline a couple times
pull/3149/head
Samuel Young 4 weeks ago
parent
commit
c036bcb171
  1. 12
      spec/features/accessibility_spec.rb

12
spec/features/accessibility_spec.rb

@ -44,6 +44,8 @@ RSpec.describe "Accessibility", js: true do
it "is has accessible pages" do it "is has accessible pages" do
user_paths.each do |path| user_paths.each do |path|
visit(path) visit(path)
wait = Selenium::WebDriver::Wait.new(timeout: 10)
wait.until { execute_script("return document.readyState") == "complete" }
expect(page).to have_current_path(path) expect(page).to have_current_path(path)
expect(page).to be_axe_clean.according_to :wcag2aa expect(page).to be_axe_clean.according_to :wcag2aa
end end
@ -77,6 +79,8 @@ RSpec.describe "Accessibility", js: true do
it "is has accessible pages" do it "is has accessible pages" do
organisation_paths.each do |path| organisation_paths.each do |path|
visit(path) visit(path)
wait = Selenium::WebDriver::Wait.new(timeout: 10)
wait.until { execute_script("return document.readyState") == "complete" }
expect(page).to have_current_path(path) expect(page).to have_current_path(path)
expect(page).to be_axe_clean.according_to :wcag2aa expect(page).to be_axe_clean.according_to :wcag2aa
end end
@ -120,6 +124,8 @@ RSpec.describe "Accessibility", js: true do
path.gsub!("/start", "/prepare-your-file?form[year]=2024") if path.include?("bulk-upload-logs/start") path.gsub!("/start", "/prepare-your-file?form[year]=2024") if path.include?("bulk-upload-logs/start")
path.gsub!("/start", "/fix-choice") if path.include?("/bulk-upload-resume/#{bulk_upload.id}/start") path.gsub!("/start", "/fix-choice") if path.include?("/bulk-upload-resume/#{bulk_upload.id}/start")
visit(path) visit(path)
wait = Selenium::WebDriver::Wait.new(timeout: 10)
wait.until { execute_script("return document.readyState") == "complete" }
expect(page).to have_current_path(path) expect(page).to have_current_path(path)
expect(page).to be_axe_clean.according_to :wcag2aa expect(page).to be_axe_clean.according_to :wcag2aa
end end
@ -164,6 +170,8 @@ RSpec.describe "Accessibility", js: true do
path.gsub!("/start", "/fix-choice") if path.include?("/bulk-upload-resume/#{bulk_upload.id}/start") path.gsub!("/start", "/fix-choice") if path.include?("/bulk-upload-resume/#{bulk_upload.id}/start")
visit(path) visit(path)
wait = Selenium::WebDriver::Wait.new(timeout: 10)
wait.until { execute_script("return document.readyState") == "complete" }
expect(page).to have_current_path(path) expect(page).to have_current_path(path)
expect(page).to be_axe_clean.according_to :wcag2aa expect(page).to be_axe_clean.according_to :wcag2aa
end end
@ -189,6 +197,8 @@ RSpec.describe "Accessibility", js: true do
it "is has accessible pages" do it "is has accessible pages" do
scheme_paths.each do |path| scheme_paths.each do |path|
visit(path) visit(path)
wait = Selenium::WebDriver::Wait.new(timeout: 10)
wait.until { execute_script("return document.readyState") == "complete" }
expect(page).to have_current_path(path) expect(page).to have_current_path(path)
expect(page).to be_axe_clean.according_to :wcag2aa expect(page).to be_axe_clean.according_to :wcag2aa
end end
@ -203,6 +213,8 @@ RSpec.describe "Accessibility", js: true do
{ path: "/sales-logs/bulk-upload-logs/guidance?form[year]=2024&referrer=home", title: "sales BU guidance" }].each do |test_case| { path: "/sales-logs/bulk-upload-logs/guidance?form[year]=2024&referrer=home", title: "sales BU guidance" }].each do |test_case|
it "is has accessible #{test_case[:title]} page" do it "is has accessible #{test_case[:title]} page" do
visit(test_case[:path]) visit(test_case[:path])
wait = Selenium::WebDriver::Wait.new(timeout: 10)
wait.until { execute_script("return document.readyState") == "complete" }
expect(page).to have_current_path(test_case[:path]) expect(page).to have_current_path(test_case[:path])
expect(page).to be_axe_clean.according_to :wcag2aa expect(page).to be_axe_clean.according_to :wcag2aa
end end

Loading…
Cancel
Save