rails_accessibility_testing 1.1.3 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +33 -0
- data/lib/rails_accessibility_testing/cli/command.rb +60 -4
- data/lib/rails_accessibility_testing/version.rb +1 -1
- metadata +1 -57
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a7f693b05664c88f5b08e1917caa94ad360754d3113787d89c8d7b59331c1b55
|
|
4
|
+
data.tar.gz: 29bfe1bfa996b04d9f779c4d576c9a2b799a041ecc52d0d35c94b1cefb9b2f0a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b525904eca4df9bf87d32fed9b27587681a45cfb73ae4f630ba8700929fa763fef316940e0b246c84eb2d7216b3def1df82e99d6375c859760d72f34e05ac1fa
|
|
7
|
+
data.tar.gz: 750912a05ec0b37f24bdb2011052f140c827940ec1063f6beaf1d5974708e386d21399808ecc3133ed7899f4ba7202638292f20950de953dca9508f0a275af70
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,35 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.2.0] - 2024-12-XX
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
- **BREAKING**: Removed unnecessary dependencies (selenium-webdriver, capybara from gemspec)
|
|
12
|
+
- Gem now has minimal dependencies - only requires `axe-core-capybara`
|
|
13
|
+
- Users provide their own capybara, selenium-webdriver, webdrivers in their Gemfile
|
|
14
|
+
- This allows users to control their own driver configuration for RSpec system specs
|
|
15
|
+
- CLI tool still works but requires users to have selenium-webdriver in their Gemfile if they want to use it
|
|
16
|
+
|
|
17
|
+
## [1.1.6] - 2024-12-XX
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
- Added server readiness check with retry mechanism to prevent connection refused errors
|
|
21
|
+
- CLI tool now waits up to 20 seconds for Rails server to be ready before attempting accessibility checks
|
|
22
|
+
- Prevents race conditions when running in Procfile.dev where a11y process starts before web server
|
|
23
|
+
|
|
24
|
+
## [1.1.5] - 2024-12-XX
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
- Fixed CLI tool "invalid argument" error when visiting paths by automatically converting paths to full URLs
|
|
28
|
+
- CLI tool now properly constructs `http://localhost:PORT/path` URLs when using Selenium with Rails apps
|
|
29
|
+
- Respects PORT, RAILS_PORT, and RAILS_URL environment variables for server URL configuration
|
|
30
|
+
|
|
31
|
+
## [1.1.4] - 2024-12-XX
|
|
32
|
+
|
|
33
|
+
### Fixed
|
|
34
|
+
- Fixed CLI tool chromedriver discovery issue by automatically requiring webdrivers gem when available
|
|
35
|
+
- CLI tool now works properly with projects that use webdrivers for driver management
|
|
36
|
+
|
|
8
37
|
## [1.1.3] - 2024-12-XX
|
|
9
38
|
|
|
10
39
|
### Fixed
|
|
@@ -82,6 +111,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
82
111
|
- Compatible with RSpec Rails 6.0+
|
|
83
112
|
- Modular architecture with rule engine and check definitions
|
|
84
113
|
|
|
114
|
+
[1.2.0]: https://github.com/rayraycodes/rails-accessibility-testing/releases/tag/v1.2.0
|
|
115
|
+
[1.1.6]: https://github.com/rayraycodes/rails-accessibility-testing/releases/tag/v1.1.6
|
|
116
|
+
[1.1.5]: https://github.com/rayraycodes/rails-accessibility-testing/releases/tag/v1.1.5
|
|
117
|
+
[1.1.4]: https://github.com/rayraycodes/rails-accessibility-testing/releases/tag/v1.1.4
|
|
85
118
|
[1.1.3]: https://github.com/rayraycodes/rails-accessibility-testing/releases/tag/v1.1.3
|
|
86
119
|
[1.1.0]: https://github.com/rayraycodes/rails-accessibility-testing/releases/tag/v1.1.0
|
|
87
120
|
[1.0.0]: https://github.com/rayraycodes/rails-accessibility-testing/releases/tag/v1.0.0
|
|
@@ -110,9 +110,17 @@ module RailsAccessibilityTesting
|
|
|
110
110
|
require 'capybara/dsl'
|
|
111
111
|
require 'selenium-webdriver'
|
|
112
112
|
|
|
113
|
+
# Try to require webdrivers for automatic chromedriver management
|
|
114
|
+
begin
|
|
115
|
+
require 'webdrivers'
|
|
116
|
+
rescue LoadError
|
|
117
|
+
# webdrivers gem not available, selenium-webdriver will try to manage drivers
|
|
118
|
+
end
|
|
119
|
+
|
|
113
120
|
# Setup Capybara
|
|
114
121
|
Capybara.default_driver = :selenium_chrome_headless
|
|
115
|
-
Capybara.app
|
|
122
|
+
# Don't set Capybara.app when using Selenium - it needs a real HTTP server
|
|
123
|
+
# The Rails server should be running separately (e.g., via Procfile.dev)
|
|
116
124
|
|
|
117
125
|
engine = Engine::RuleEngine.new(config: config)
|
|
118
126
|
all_violations = []
|
|
@@ -123,10 +131,16 @@ module RailsAccessibilityTesting
|
|
|
123
131
|
|
|
124
132
|
targets.each do |target|
|
|
125
133
|
begin
|
|
126
|
-
|
|
127
|
-
|
|
134
|
+
# Convert path to full URL if needed (when using Selenium with Rails)
|
|
135
|
+
url = normalize_url(target)
|
|
136
|
+
|
|
137
|
+
# Wait for server to be ready (with retries)
|
|
138
|
+
wait_for_server(url) if url.match?(/\Ahttps?:\/\//)
|
|
139
|
+
|
|
140
|
+
Capybara.visit(url)
|
|
141
|
+
violations = engine.check(Capybara.current_session, context: { url: url })
|
|
128
142
|
all_violations.concat(violations)
|
|
129
|
-
checked_urls << { url:
|
|
143
|
+
checked_urls << { url: url, violations: violations.count }
|
|
130
144
|
rescue StandardError => e
|
|
131
145
|
$stderr.puts "Error checking #{target}: #{e.message}"
|
|
132
146
|
end
|
|
@@ -161,6 +175,48 @@ module RailsAccessibilityTesting
|
|
|
161
175
|
targets.uniq
|
|
162
176
|
end
|
|
163
177
|
|
|
178
|
+
def normalize_url(target)
|
|
179
|
+
# If it's already a full URL, return as-is
|
|
180
|
+
return target if target.match?(/\Ahttps?:\/\//)
|
|
181
|
+
|
|
182
|
+
# If it's a path and we're using Selenium, construct a full URL
|
|
183
|
+
# Default to localhost:3000 (standard Rails port)
|
|
184
|
+
port = ENV['PORT'] || ENV['RAILS_PORT'] || '3000'
|
|
185
|
+
base_url = ENV['RAILS_URL'] || "http://localhost:#{port}"
|
|
186
|
+
|
|
187
|
+
# Ensure path starts with /
|
|
188
|
+
path = target.start_with?('/') ? target : "/#{target}"
|
|
189
|
+
"#{base_url}#{path}"
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
def wait_for_server(url, max_retries: 10, retry_delay: 2)
|
|
193
|
+
require 'net/http'
|
|
194
|
+
require 'uri'
|
|
195
|
+
|
|
196
|
+
uri = URI.parse(url)
|
|
197
|
+
base_url = "#{uri.scheme}://#{uri.host}:#{uri.port}"
|
|
198
|
+
|
|
199
|
+
max_retries.times do |attempt|
|
|
200
|
+
begin
|
|
201
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
|
202
|
+
http.open_timeout = 1
|
|
203
|
+
http.read_timeout = 1
|
|
204
|
+
response = http.head('/')
|
|
205
|
+
return if response.code.to_i < 500 # Server is responding
|
|
206
|
+
rescue Errno::ECONNREFUSED, Errno::ETIMEDOUT, Net::OpenTimeout, Net::ReadTimeout, SocketError
|
|
207
|
+
# Server not ready yet
|
|
208
|
+
if attempt < max_retries - 1
|
|
209
|
+
sleep(retry_delay)
|
|
210
|
+
next
|
|
211
|
+
else
|
|
212
|
+
# Last attempt failed, but we'll still try to visit (might be a different error)
|
|
213
|
+
$stderr.puts "Warning: Server at #{base_url} not responding after #{max_retries} attempts, attempting anyway..."
|
|
214
|
+
return
|
|
215
|
+
end
|
|
216
|
+
end
|
|
217
|
+
end
|
|
218
|
+
end
|
|
219
|
+
|
|
164
220
|
def resolve_routes(routes)
|
|
165
221
|
return [] unless defined?(Rails) && Rails.application
|
|
166
222
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rails_accessibility_testing
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Regan Maharjan
|
|
@@ -24,20 +24,6 @@ dependencies:
|
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '4.0'
|
|
27
|
-
- !ruby/object:Gem::Dependency
|
|
28
|
-
name: capybara
|
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
|
30
|
-
requirements:
|
|
31
|
-
- - "~>"
|
|
32
|
-
- !ruby/object:Gem::Version
|
|
33
|
-
version: '3.0'
|
|
34
|
-
type: :runtime
|
|
35
|
-
prerelease: false
|
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
-
requirements:
|
|
38
|
-
- - "~>"
|
|
39
|
-
- !ruby/object:Gem::Version
|
|
40
|
-
version: '3.0'
|
|
41
27
|
- !ruby/object:Gem::Dependency
|
|
42
28
|
name: bundler
|
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -66,20 +52,6 @@ dependencies:
|
|
|
66
52
|
- - "~>"
|
|
67
53
|
- !ruby/object:Gem::Version
|
|
68
54
|
version: '13.0'
|
|
69
|
-
- !ruby/object:Gem::Dependency
|
|
70
|
-
name: yard
|
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
|
72
|
-
requirements:
|
|
73
|
-
- - "~>"
|
|
74
|
-
- !ruby/object:Gem::Version
|
|
75
|
-
version: '0.9'
|
|
76
|
-
type: :development
|
|
77
|
-
prerelease: false
|
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
-
requirements:
|
|
80
|
-
- - "~>"
|
|
81
|
-
- !ruby/object:Gem::Version
|
|
82
|
-
version: '0.9'
|
|
83
55
|
- !ruby/object:Gem::Dependency
|
|
84
56
|
name: rspec
|
|
85
57
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -94,34 +66,6 @@ dependencies:
|
|
|
94
66
|
- - "~>"
|
|
95
67
|
- !ruby/object:Gem::Version
|
|
96
68
|
version: '3.12'
|
|
97
|
-
- !ruby/object:Gem::Dependency
|
|
98
|
-
name: capybara
|
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
|
100
|
-
requirements:
|
|
101
|
-
- - "~>"
|
|
102
|
-
- !ruby/object:Gem::Version
|
|
103
|
-
version: '3.0'
|
|
104
|
-
type: :development
|
|
105
|
-
prerelease: false
|
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
-
requirements:
|
|
108
|
-
- - "~>"
|
|
109
|
-
- !ruby/object:Gem::Version
|
|
110
|
-
version: '3.0'
|
|
111
|
-
- !ruby/object:Gem::Dependency
|
|
112
|
-
name: selenium-webdriver
|
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
|
114
|
-
requirements:
|
|
115
|
-
- - "~>"
|
|
116
|
-
- !ruby/object:Gem::Version
|
|
117
|
-
version: '4.0'
|
|
118
|
-
type: :development
|
|
119
|
-
prerelease: false
|
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
-
requirements:
|
|
122
|
-
- - "~>"
|
|
123
|
-
- !ruby/object:Gem::Version
|
|
124
|
-
version: '4.0'
|
|
125
69
|
description: Comprehensive, opinionated but configurable accessibility testing gem
|
|
126
70
|
for Rails. Integrates seamlessly into your test suite with RSpec and Minitest support.
|
|
127
71
|
Includes CLI tool, Rails generator, YAML configuration, and 11+ WCAG 2.1 AA aligned
|