rails_accessibility_testing 1.4.1 → 1.4.3
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 +31 -0
- data/GUIDES/getting_started.md +163 -4
- data/README.md +20 -5
- data/docs_site/getting_started.md +185 -3
- data/docs_site/index.md +7 -1
- data/lib/rails_accessibility_testing/version.rb +1 -1
- data/lib/rails_accessibility_testing.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c4df6f6fa98287499a91edd38be1b081a97c3ec3ce09fade45192afe3aad7e27
|
|
4
|
+
data.tar.gz: 412a2a707455699628ab59d64c0ed3f7607c143fbdbfb7d0d70dae80bad84c8c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c6b0639e08a27ee874ff9fb98123f36cf429a6fcd98615beb6a17682da9a24adeb027305af4713a05cee02640d4f3d0b375245a4b55fdc03020a277a4c608f92
|
|
7
|
+
data.tar.gz: df40a9a2df569f6e49a41bc3d90812c897a827a981bc555c25dec824422aac25676b53689b323d29eaa7b6a3fa046e903cb2e510148cbaf0b4bc6797deed2c91
|
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.4.3] - 2025-11-19
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Comprehensive driver setup documentation for Capybara and Selenium WebDriver
|
|
12
|
+
- Explicit `selenium-webdriver` gem requirement in all Gemfile examples
|
|
13
|
+
- Chrome/Chromium installation instructions for macOS, Linux, and Windows
|
|
14
|
+
- Troubleshooting section covering common errors including `DriverFinder` issues
|
|
15
|
+
- Version compatibility table with recommended and minimum versions
|
|
16
|
+
- Rails 8 specific setup notes and requirements
|
|
17
|
+
|
|
18
|
+
### Improved
|
|
19
|
+
- Enhanced getting started guides with complete driver configuration examples
|
|
20
|
+
- Better documentation for Rails 8 compatibility and `driven_by` method usage
|
|
21
|
+
- Clearer instructions for resolving `uninitialized constant Selenium::WebDriver::DriverFinder` errors
|
|
22
|
+
- More comprehensive setup instructions covering all required dependencies
|
|
23
|
+
|
|
24
|
+
## [1.4.2] - 2025-11-18
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
- Procfile.dev documentation for continuous accessibility checking during development
|
|
28
|
+
- Instructions for running accessibility checks automatically every 30 seconds via `bin/dev`
|
|
29
|
+
- Updated getting started guides with Procfile setup examples
|
|
30
|
+
- Enhanced README with continuous testing workflow documentation
|
|
31
|
+
|
|
32
|
+
### Improved
|
|
33
|
+
- Better developer experience with continuous accessibility feedback during development
|
|
34
|
+
- Clearer documentation on multiple ways to run accessibility checks (manual vs continuous)
|
|
35
|
+
- Improved onboarding with step-by-step Procfile setup instructions
|
|
36
|
+
|
|
8
37
|
## [1.4.1] - 2025-11-18
|
|
9
38
|
|
|
10
39
|
### Changed
|
|
@@ -155,6 +184,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
155
184
|
- Compatible with RSpec Rails 6.0+
|
|
156
185
|
- Modular architecture with rule engine and check definitions
|
|
157
186
|
|
|
187
|
+
[1.4.3]: https://github.com/rayraycodes/rails-accessibility-testing/releases/tag/v1.4.3
|
|
188
|
+
[1.4.2]: https://github.com/rayraycodes/rails-accessibility-testing/releases/tag/v1.4.2
|
|
158
189
|
[1.4.1]: https://github.com/rayraycodes/rails-accessibility-testing/releases/tag/v1.4.1
|
|
159
190
|
[1.4.0]: https://github.com/rayraycodes/rails-accessibility-testing/releases/tag/v1.4.0
|
|
160
191
|
[1.3.0]: https://github.com/rayraycodes/rails-accessibility-testing/releases/tag/v1.3.0
|
data/GUIDES/getting_started.md
CHANGED
|
@@ -16,9 +16,14 @@ Add to your `Gemfile`:
|
|
|
16
16
|
group :development, :test do
|
|
17
17
|
gem 'rails_accessibility_testing'
|
|
18
18
|
gem 'axe-core-capybara', '~> 4.0'
|
|
19
|
+
gem 'capybara', '~> 3.40'
|
|
20
|
+
gem 'selenium-webdriver', '~> 4.0'
|
|
21
|
+
gem 'webdrivers', '~> 5.0' # Optional but recommended for automatic driver management
|
|
19
22
|
end
|
|
20
23
|
```
|
|
21
24
|
|
|
25
|
+
**Important:** You must explicitly add `selenium-webdriver` to your Gemfile. It's not automatically included as a dependency.
|
|
26
|
+
|
|
22
27
|
Then run:
|
|
23
28
|
|
|
24
29
|
```bash
|
|
@@ -38,9 +43,72 @@ This creates:
|
|
|
38
43
|
- `config/accessibility.yml` - Check settings
|
|
39
44
|
- Updates `spec/rails_helper.rb` (if using RSpec)
|
|
40
45
|
|
|
41
|
-
### Step
|
|
46
|
+
### Step 2.5: Configure Capybara Driver (Required for System Tests)
|
|
47
|
+
|
|
48
|
+
For system tests to work, you need to configure Capybara with a Selenium driver. Create `spec/support/driver.rb`:
|
|
49
|
+
|
|
50
|
+
```ruby
|
|
51
|
+
# spec/support/driver.rb
|
|
52
|
+
require 'selenium-webdriver'
|
|
53
|
+
require 'capybara/rails'
|
|
54
|
+
require 'capybara/rspec'
|
|
55
|
+
|
|
56
|
+
# Configure Chrome options
|
|
57
|
+
browser_options = Selenium::WebDriver::Chrome::Options.new
|
|
58
|
+
browser_options.add_argument('--window-size=1920,1080')
|
|
59
|
+
browser_options.add_argument('--headless') unless ENV['SHOW_TEST_BROWSER']
|
|
60
|
+
|
|
61
|
+
# Register the driver
|
|
62
|
+
Capybara.register_driver :selenium_chrome_headless do |app|
|
|
63
|
+
Capybara::Selenium::Driver.new(
|
|
64
|
+
app,
|
|
65
|
+
browser: :chrome,
|
|
66
|
+
options: browser_options
|
|
67
|
+
)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Set as default JavaScript driver
|
|
71
|
+
Capybara.javascript_driver = :selenium_chrome_headless
|
|
72
|
+
|
|
73
|
+
# Configure RSpec to use the driver for system tests
|
|
74
|
+
RSpec.configure do |config|
|
|
75
|
+
config.before(:each, type: :system) do
|
|
76
|
+
driven_by :selenium_chrome_headless
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**Note for Rails 8:** Rails 8 uses `driven_by` to configure system tests. Make sure your `spec/support/driver.rb` is loaded by `rails_helper.rb` (it should be automatically loaded if it's in the `spec/support/` directory).
|
|
82
|
+
|
|
83
|
+
### Step 3: Install Chrome/Chromium (Required)
|
|
84
|
+
|
|
85
|
+
System tests require Chrome or Chromium to be installed on your system:
|
|
86
|
+
|
|
87
|
+
**macOS:**
|
|
88
|
+
```bash
|
|
89
|
+
brew install --cask google-chrome
|
|
90
|
+
# or for Chromium:
|
|
91
|
+
brew install --cask chromium
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**Linux (Ubuntu/Debian):**
|
|
95
|
+
```bash
|
|
96
|
+
sudo apt-get update
|
|
97
|
+
sudo apt-get install -y google-chrome-stable
|
|
98
|
+
# or for Chromium:
|
|
99
|
+
sudo apt-get install -y chromium-browser
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**Windows:**
|
|
103
|
+
Download and install Chrome from [google.com/chrome](https://www.google.com/chrome/)
|
|
104
|
+
|
|
105
|
+
The `webdrivers` gem will automatically download and manage the ChromeDriver binary for you.
|
|
42
106
|
|
|
43
|
-
|
|
107
|
+
### Step 4: Run Your Tests
|
|
108
|
+
|
|
109
|
+
You can run accessibility checks in several ways:
|
|
110
|
+
|
|
111
|
+
#### Option A: Run Tests Manually
|
|
44
112
|
|
|
45
113
|
```bash
|
|
46
114
|
bundle exec rspec spec/system/
|
|
@@ -48,6 +116,29 @@ bundle exec rspec spec/system/
|
|
|
48
116
|
|
|
49
117
|
Accessibility checks run automatically on every system test that visits a page.
|
|
50
118
|
|
|
119
|
+
#### Option B: Run Continuously with Procfile (Recommended for Development)
|
|
120
|
+
|
|
121
|
+
For continuous accessibility checking during development, add to your `Procfile.dev`:
|
|
122
|
+
|
|
123
|
+
```procfile
|
|
124
|
+
web: bin/rails server
|
|
125
|
+
css: bin/rails dartsass:watch
|
|
126
|
+
a11y: while true; do bundle exec rspec spec/system/*_accessibility_spec.rb; sleep 30; done
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Then run:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
bin/dev
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
This will:
|
|
136
|
+
- Start your Rails server
|
|
137
|
+
- Watch for CSS changes
|
|
138
|
+
- **Automatically run accessibility checks every 30 seconds** on all `*_accessibility_spec.rb` files
|
|
139
|
+
|
|
140
|
+
The accessibility checker will continuously monitor your pages and alert you to any issues as you develop!
|
|
141
|
+
|
|
51
142
|
## Your First Accessibility Check
|
|
52
143
|
|
|
53
144
|
Let's see it in action. Create a simple system spec:
|
|
@@ -225,6 +316,74 @@ end
|
|
|
225
316
|
- **Check out [Writing Accessible Views](writing_accessible_views_in_rails.md)** for best practices
|
|
226
317
|
- **See [Working with Designers](working_with_designers_and_content_authors.md)** for team collaboration
|
|
227
318
|
|
|
319
|
+
## Troubleshooting
|
|
320
|
+
|
|
321
|
+
### Error: `uninitialized constant Selenium::WebDriver::DriverFinder`
|
|
322
|
+
|
|
323
|
+
This error typically occurs when:
|
|
324
|
+
1. **Missing selenium-webdriver gem** - Make sure you've added `gem 'selenium-webdriver', '~> 4.0'` to your Gemfile
|
|
325
|
+
2. **Version incompatibility** - Ensure you're using compatible versions:
|
|
326
|
+
- `selenium-webdriver` ~> 4.0 (4.6.0+ recommended for Rails 8)
|
|
327
|
+
- `webdrivers` ~> 5.0 (if using webdrivers)
|
|
328
|
+
- `capybara` ~> 3.40
|
|
329
|
+
|
|
330
|
+
**Solution:**
|
|
331
|
+
```bash
|
|
332
|
+
# Update your Gemfile
|
|
333
|
+
gem 'selenium-webdriver', '~> 4.10'
|
|
334
|
+
gem 'webdrivers', '~> 5.3'
|
|
335
|
+
gem 'capybara', '~> 3.40'
|
|
336
|
+
|
|
337
|
+
# Then run
|
|
338
|
+
bundle update selenium-webdriver webdrivers capybara
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
### Error: Chrome/ChromeDriver not found
|
|
342
|
+
|
|
343
|
+
**Solution:**
|
|
344
|
+
1. Make sure Chrome is installed (see Step 3 above)
|
|
345
|
+
2. If using `webdrivers` gem, it should auto-download ChromeDriver. If not:
|
|
346
|
+
```bash
|
|
347
|
+
bundle exec webdrivers chrome
|
|
348
|
+
```
|
|
349
|
+
3. For manual installation, download from [ChromeDriver downloads](https://chromedriver.chromium.org/downloads)
|
|
350
|
+
|
|
351
|
+
### System tests not running
|
|
352
|
+
|
|
353
|
+
**Check:**
|
|
354
|
+
1. Your spec has `type: :system` metadata
|
|
355
|
+
2. `spec/support/driver.rb` exists and is properly configured
|
|
356
|
+
3. `spec/rails_helper.rb` loads support files (should be automatic)
|
|
357
|
+
4. Chrome is installed and accessible
|
|
358
|
+
|
|
359
|
+
### Tests are slow
|
|
360
|
+
|
|
361
|
+
Disable expensive checks in development:
|
|
362
|
+
```yaml
|
|
363
|
+
# config/accessibility.yml
|
|
364
|
+
development:
|
|
365
|
+
checks:
|
|
366
|
+
color_contrast: false # Disable expensive color contrast checks
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
## Version Compatibility
|
|
370
|
+
|
|
371
|
+
For best results, use these compatible versions:
|
|
372
|
+
|
|
373
|
+
| Component | Recommended Version | Minimum Version |
|
|
374
|
+
|-----------|-------------------|-----------------|
|
|
375
|
+
| Ruby | 3.1+ | 3.0+ |
|
|
376
|
+
| Rails | 7.1+ / 8.0+ | 6.0+ |
|
|
377
|
+
| RSpec Rails | 6.0+ | 5.0+ |
|
|
378
|
+
| Capybara | ~> 3.40 | 3.0+ |
|
|
379
|
+
| selenium-webdriver | ~> 4.10 | 4.0+ |
|
|
380
|
+
| webdrivers | ~> 5.3 | 5.0+ |
|
|
381
|
+
|
|
382
|
+
**Rails 8 Notes:**
|
|
383
|
+
- Rails 8 requires `selenium-webdriver` 4.6.0+ for `DriverFinder` support
|
|
384
|
+
- Make sure your `driven_by` configuration is in `spec/support/driver.rb`
|
|
385
|
+
- Rails 8 system tests use `driven_by` instead of direct Capybara configuration
|
|
386
|
+
|
|
228
387
|
## Common Questions
|
|
229
388
|
|
|
230
389
|
### Q: Do I need to change my existing tests?
|
|
@@ -246,8 +405,8 @@ end
|
|
|
246
405
|
## Getting Help
|
|
247
406
|
|
|
248
407
|
- **Documentation:** See the main [README](../README.md)
|
|
249
|
-
- **Issues:** [GitHub Issues](https://github.com/
|
|
250
|
-
- **Email:**
|
|
408
|
+
- **Issues:** [GitHub Issues](https://github.com/rayraycodes/rails-accessibility-testing/issues)
|
|
409
|
+
- **Email:** imregan@umich.edu
|
|
251
410
|
|
|
252
411
|
---
|
|
253
412
|
|
data/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
**The RSpec + RuboCop of accessibility for Rails. Catch WCAG violations before they reach production.**
|
|
9
9
|
|
|
10
|
-
**Current Version:** 1.4.
|
|
10
|
+
**Current Version:** 1.4.3
|
|
11
11
|
|
|
12
12
|
📖 **[📚 Full Documentation](https://rayraycodes.github.io/rails-accessibility-testing/)** | [💻 GitHub](https://github.com/rayraycodes/rails-accessibility-testing) | [💎 RubyGems](https://rubygems.org/gems/rails_accessibility_testing)
|
|
13
13
|
|
|
@@ -40,11 +40,14 @@ Add to your `Gemfile`:
|
|
|
40
40
|
group :development, :test do
|
|
41
41
|
gem 'rails_accessibility_testing'
|
|
42
42
|
gem 'axe-core-capybara', '~> 4.0'
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
gem 'capybara', '~> 3.40'
|
|
44
|
+
gem 'selenium-webdriver', '~> 4.0'
|
|
45
|
+
gem 'webdrivers', '~> 5.0' # Optional but recommended for automatic driver management
|
|
45
46
|
end
|
|
46
47
|
```
|
|
47
48
|
|
|
49
|
+
**Important:** You must explicitly add `selenium-webdriver` to your Gemfile. It's not automatically included as a dependency. The gem has minimal dependencies - you control your own driver setup.
|
|
50
|
+
|
|
48
51
|
Then run:
|
|
49
52
|
|
|
50
53
|
```bash
|
|
@@ -108,12 +111,24 @@ end
|
|
|
108
111
|
|
|
109
112
|
**Accessibility checks run automatically after each `visit` in system specs!**
|
|
110
113
|
|
|
111
|
-
|
|
114
|
+
#### Continuous Testing with Procfile (Recommended for Development)
|
|
112
115
|
|
|
113
|
-
|
|
116
|
+
For continuous accessibility checking during development, add to your `Procfile.dev`:
|
|
117
|
+
|
|
118
|
+
```procfile
|
|
119
|
+
web: bin/rails server
|
|
120
|
+
css: bin/rails dartsass:watch
|
|
114
121
|
a11y: while true; do bundle exec rspec spec/system/*_accessibility_spec.rb; sleep 30; done
|
|
115
122
|
```
|
|
116
123
|
|
|
124
|
+
Then run:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
bin/dev
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
This will automatically run accessibility checks every 30 seconds on all `*_accessibility_spec.rb` files, giving you continuous feedback as you develop!
|
|
131
|
+
|
|
117
132
|
📖 **[See the full System Specs Guide](GUIDES/system_specs_for_accessibility.md)** for detailed examples and best practices.
|
|
118
133
|
|
|
119
134
|
### Automatic Checks
|
|
@@ -21,9 +21,14 @@ Add to your `Gemfile`:
|
|
|
21
21
|
group :development, :test do
|
|
22
22
|
gem 'rails_accessibility_testing'
|
|
23
23
|
gem 'axe-core-capybara', '~> 4.0'
|
|
24
|
+
gem 'capybara', '~> 3.40'
|
|
25
|
+
gem 'selenium-webdriver', '~> 4.0'
|
|
26
|
+
gem 'webdrivers', '~> 5.0' # Optional but recommended for automatic driver management
|
|
24
27
|
end
|
|
25
28
|
```
|
|
26
29
|
|
|
30
|
+
**Important:** You must explicitly add `selenium-webdriver` to your Gemfile. It's not automatically included as a dependency.
|
|
31
|
+
|
|
27
32
|
Then run:
|
|
28
33
|
|
|
29
34
|
```bash
|
|
@@ -43,9 +48,92 @@ This creates:
|
|
|
43
48
|
- `config/accessibility.yml` - Check settings
|
|
44
49
|
- Updates `spec/rails_helper.rb` (if using RSpec)
|
|
45
50
|
|
|
46
|
-
### Step
|
|
51
|
+
### Step 2.5: Configure Capybara Driver (Required for System Tests)
|
|
52
|
+
|
|
53
|
+
For system tests to work, you need to configure Capybara with a Selenium driver. Create `spec/support/driver.rb`:
|
|
54
|
+
|
|
55
|
+
```ruby
|
|
56
|
+
# spec/support/driver.rb
|
|
57
|
+
require 'selenium-webdriver'
|
|
58
|
+
require 'capybara/rails'
|
|
59
|
+
require 'capybara/rspec'
|
|
60
|
+
|
|
61
|
+
# Configure Chrome options
|
|
62
|
+
browser_options = Selenium::WebDriver::Chrome::Options.new
|
|
63
|
+
browser_options.add_argument('--window-size=1920,1080')
|
|
64
|
+
browser_options.add_argument('--headless') unless ENV['SHOW_TEST_BROWSER']
|
|
65
|
+
|
|
66
|
+
# Register the driver
|
|
67
|
+
Capybara.register_driver :selenium_chrome_headless do |app|
|
|
68
|
+
Capybara::Selenium::Driver.new(
|
|
69
|
+
app,
|
|
70
|
+
browser: :chrome,
|
|
71
|
+
options: browser_options
|
|
72
|
+
)
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# Set as default JavaScript driver
|
|
76
|
+
Capybara.javascript_driver = :selenium_chrome_headless
|
|
47
77
|
|
|
48
|
-
|
|
78
|
+
# Configure RSpec to use the driver for system tests
|
|
79
|
+
RSpec.configure do |config|
|
|
80
|
+
config.before(:each, type: :system) do
|
|
81
|
+
driven_by :selenium_chrome_headless
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**Note for Rails 8:** Rails 8 uses `driven_by` to configure system tests. Make sure your `spec/support/driver.rb` is loaded by `rails_helper.rb` (it should be automatically loaded if it's in the `spec/support/` directory).
|
|
87
|
+
|
|
88
|
+
### Step 3: Install Chrome/Chromium (Required)
|
|
89
|
+
|
|
90
|
+
System tests require Chrome or Chromium to be installed on your system:
|
|
91
|
+
|
|
92
|
+
**macOS:**
|
|
93
|
+
```bash
|
|
94
|
+
brew install --cask google-chrome
|
|
95
|
+
# or for Chromium:
|
|
96
|
+
brew install --cask chromium
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Linux (Ubuntu/Debian):**
|
|
100
|
+
```bash
|
|
101
|
+
sudo apt-get update
|
|
102
|
+
sudo apt-get install -y google-chrome-stable
|
|
103
|
+
# or for Chromium:
|
|
104
|
+
sudo apt-get install -y chromium-browser
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**Windows:**
|
|
108
|
+
Download and install Chrome from [google.com/chrome](https://www.google.com/chrome/)
|
|
109
|
+
|
|
110
|
+
The `webdrivers` gem will automatically download and manage the ChromeDriver binary for you.
|
|
111
|
+
|
|
112
|
+
### Step 4: Create System Specs (Recommended)
|
|
113
|
+
|
|
114
|
+
Create system specs for the pages you want to test. This is the **recommended and most reliable** approach:
|
|
115
|
+
|
|
116
|
+
```ruby
|
|
117
|
+
# spec/system/home_page_accessibility_spec.rb
|
|
118
|
+
require 'rails_helper'
|
|
119
|
+
|
|
120
|
+
RSpec.describe 'Home Page Accessibility', type: :system do
|
|
121
|
+
it 'loads the page and runs comprehensive accessibility checks' do
|
|
122
|
+
visit root_path
|
|
123
|
+
|
|
124
|
+
# Run comprehensive accessibility checks
|
|
125
|
+
# This will fail the test if any accessibility issues are found
|
|
126
|
+
check_comprehensive_accessibility
|
|
127
|
+
# ✅ If all checks pass, you'll see: "All comprehensive accessibility checks passed! (11 checks)"
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Step 5: Run Your Tests
|
|
133
|
+
|
|
134
|
+
You can run accessibility checks in several ways:
|
|
135
|
+
|
|
136
|
+
#### Option A: Run Tests Manually
|
|
49
137
|
|
|
50
138
|
```bash
|
|
51
139
|
bundle exec rspec spec/system/
|
|
@@ -53,5 +141,99 @@ bundle exec rspec spec/system/
|
|
|
53
141
|
|
|
54
142
|
Accessibility checks run automatically on every system test that visits a page.
|
|
55
143
|
|
|
56
|
-
|
|
144
|
+
#### Option B: Run Continuously with Procfile (Recommended for Development)
|
|
145
|
+
|
|
146
|
+
For continuous accessibility checking during development, add to your `Procfile.dev`:
|
|
147
|
+
|
|
148
|
+
```procfile
|
|
149
|
+
web: bin/rails server
|
|
150
|
+
css: bin/rails dartsass:watch
|
|
151
|
+
a11y: while true; do bundle exec rspec spec/system/*_accessibility_spec.rb; sleep 30; done
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Then run:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
bin/dev
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
This will:
|
|
161
|
+
- Start your Rails server
|
|
162
|
+
- Watch for CSS changes
|
|
163
|
+
- **Automatically run accessibility checks every 30 seconds** on all `*_accessibility_spec.rb` files
|
|
164
|
+
|
|
165
|
+
The accessibility checker will continuously monitor your pages and alert you to any issues as you develop!
|
|
166
|
+
|
|
167
|
+
## Troubleshooting
|
|
168
|
+
|
|
169
|
+
### Error: `uninitialized constant Selenium::WebDriver::DriverFinder`
|
|
170
|
+
|
|
171
|
+
This error typically occurs when:
|
|
172
|
+
1. **Missing selenium-webdriver gem** - Make sure you've added `gem 'selenium-webdriver', '~> 4.0'` to your Gemfile
|
|
173
|
+
2. **Version incompatibility** - Ensure you're using compatible versions:
|
|
174
|
+
- `selenium-webdriver` ~> 4.0 (4.6.0+ recommended for Rails 8)
|
|
175
|
+
- `webdrivers` ~> 5.0 (if using webdrivers)
|
|
176
|
+
- `capybara` ~> 3.40
|
|
177
|
+
|
|
178
|
+
**Solution:**
|
|
179
|
+
```bash
|
|
180
|
+
# Update your Gemfile
|
|
181
|
+
gem 'selenium-webdriver', '~> 4.10'
|
|
182
|
+
gem 'webdrivers', '~> 5.3'
|
|
183
|
+
gem 'capybara', '~> 3.40'
|
|
184
|
+
|
|
185
|
+
# Then run
|
|
186
|
+
bundle update selenium-webdriver webdrivers capybara
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Error: Chrome/ChromeDriver not found
|
|
190
|
+
|
|
191
|
+
**Solution:**
|
|
192
|
+
1. Make sure Chrome is installed (see Step 2.5 above)
|
|
193
|
+
2. If using `webdrivers` gem, it should auto-download ChromeDriver. If not:
|
|
194
|
+
```bash
|
|
195
|
+
bundle exec webdrivers chrome
|
|
196
|
+
```
|
|
197
|
+
3. For manual installation, download from [ChromeDriver downloads](https://chromedriver.chromium.org/downloads)
|
|
198
|
+
|
|
199
|
+
### System tests not running
|
|
200
|
+
|
|
201
|
+
**Check:**
|
|
202
|
+
1. Your spec has `type: :system` metadata
|
|
203
|
+
2. `spec/support/driver.rb` exists and is properly configured
|
|
204
|
+
3. `spec/rails_helper.rb` loads support files (should be automatic)
|
|
205
|
+
4. Chrome is installed and accessible
|
|
206
|
+
|
|
207
|
+
### Tests are slow
|
|
208
|
+
|
|
209
|
+
Disable expensive checks in development:
|
|
210
|
+
```yaml
|
|
211
|
+
# config/accessibility.yml
|
|
212
|
+
development:
|
|
213
|
+
checks:
|
|
214
|
+
color_contrast: false # Disable expensive color contrast checks
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
## Version Compatibility
|
|
218
|
+
|
|
219
|
+
For best results, use these compatible versions:
|
|
220
|
+
|
|
221
|
+
| Component | Recommended Version | Minimum Version |
|
|
222
|
+
|-----------|-------------------|-----------------|
|
|
223
|
+
| Ruby | 3.1+ | 3.0+ |
|
|
224
|
+
| Rails | 7.1+ / 8.0+ | 6.0+ |
|
|
225
|
+
| RSpec Rails | 6.0+ | 5.0+ |
|
|
226
|
+
| Capybara | ~> 3.40 | 3.0+ |
|
|
227
|
+
| selenium-webdriver | ~> 4.10 | 4.0+ |
|
|
228
|
+
| webdrivers | ~> 5.3 | 5.0+ |
|
|
229
|
+
|
|
230
|
+
**Rails 8 Notes:**
|
|
231
|
+
- Rails 8 requires `selenium-webdriver` 4.6.0+ for `DriverFinder` support
|
|
232
|
+
- Make sure your `driven_by` configuration is in `spec/support/driver.rb`
|
|
233
|
+
- Rails 8 system tests use `driven_by` instead of direct Capybara configuration
|
|
234
|
+
|
|
235
|
+
## Learn More
|
|
236
|
+
|
|
237
|
+
- **[System Specs Guide](https://github.com/rayraycodes/rails-accessibility-testing/blob/main/GUIDES/system_specs_for_accessibility.md)** - ⭐ Recommended approach for reliable accessibility testing
|
|
238
|
+
- **[Complete Getting Started Guide](https://github.com/rayraycodes/rails-accessibility-testing/blob/main/GUIDES/getting_started.md)** - Detailed setup instructions
|
|
57
239
|
|
data/docs_site/index.md
CHANGED
|
@@ -7,7 +7,7 @@ title: Home
|
|
|
7
7
|
|
|
8
8
|
**The RSpec + RuboCop of accessibility for Rails. Catch WCAG violations before they reach production.**
|
|
9
9
|
|
|
10
|
-
**Version:** 1.
|
|
10
|
+
**Version:** 1.4.3
|
|
11
11
|
|
|
12
12
|
Rails Accessibility Testing is a comprehensive accessibility testing gem that makes accessibility testing as natural as unit testing. It integrates seamlessly into your Rails workflow, catching WCAG 2.1 AA violations as you code—not after deployment.
|
|
13
13
|
|
|
@@ -48,6 +48,12 @@ bundle exec rspec spec/system/
|
|
|
48
48
|
- [CI Integration]({{ '/ci_integration.html' | relative_url }}) - CI/CD setup
|
|
49
49
|
- [Contributing]({{ '/contributing.html' | relative_url }}) - How to contribute
|
|
50
50
|
|
|
51
|
+
## Additional Guides
|
|
52
|
+
|
|
53
|
+
- [System Specs for Accessibility](https://github.com/rayraycodes/rails-accessibility-testing/blob/main/GUIDES/system_specs_for_accessibility.md) - ⭐ Recommended approach
|
|
54
|
+
- [Writing Accessible Views](https://github.com/rayraycodes/rails-accessibility-testing/blob/main/GUIDES/writing_accessible_views_in_rails.md) - Best practices
|
|
55
|
+
- [Working with Designers](https://github.com/rayraycodes/rails-accessibility-testing/blob/main/GUIDES/working_with_designers_and_content_authors.md) - Team collaboration
|
|
56
|
+
|
|
51
57
|
## Links
|
|
52
58
|
|
|
53
59
|
- [GitHub Repository](https://github.com/rayraycodes/rails-accessibility-testing)
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
# Automatically configures accessibility testing for Rails system specs with
|
|
6
6
|
# comprehensive checks and detailed error messages.
|
|
7
7
|
#
|
|
8
|
-
# @version 1.4.
|
|
8
|
+
# @version 1.4.3
|
|
9
9
|
# @author Regan Maharjan
|
|
10
10
|
#
|
|
11
11
|
# @example Basic usage
|
|
@@ -38,7 +38,7 @@ begin
|
|
|
38
38
|
require_relative 'rails_accessibility_testing/version'
|
|
39
39
|
rescue LoadError
|
|
40
40
|
module RailsAccessibilityTesting
|
|
41
|
-
VERSION = '1.4.
|
|
41
|
+
VERSION = '1.4.3'
|
|
42
42
|
end
|
|
43
43
|
end
|
|
44
44
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rails_accessibility_testing
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.4.
|
|
4
|
+
version: 1.4.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Regan Maharjan
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-11-
|
|
11
|
+
date: 2025-11-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: axe-core-capybara
|