rails_accessibility_testing 1.1.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 +7 -0
- data/ARCHITECTURE.md +307 -0
- data/CHANGELOG.md +81 -0
- data/CODE_OF_CONDUCT.md +125 -0
- data/CONTRIBUTING.md +225 -0
- data/GUIDES/continuous_integration.md +326 -0
- data/GUIDES/getting_started.md +205 -0
- data/GUIDES/working_with_designers_and_content_authors.md +398 -0
- data/GUIDES/writing_accessible_views_in_rails.md +412 -0
- data/LICENSE +22 -0
- data/README.md +350 -0
- data/docs_site/404.html +11 -0
- data/docs_site/Gemfile +11 -0
- data/docs_site/Makefile +14 -0
- data/docs_site/_config.yml +41 -0
- data/docs_site/_includes/header.html +13 -0
- data/docs_site/_layouts/default.html +130 -0
- data/docs_site/assets/main.scss +4 -0
- data/docs_site/ci_integration.md +76 -0
- data/docs_site/configuration.md +114 -0
- data/docs_site/contributing.md +69 -0
- data/docs_site/getting_started.md +57 -0
- data/docs_site/index.md +57 -0
- data/exe/rails_a11y +12 -0
- data/exe/rails_server_safe +41 -0
- data/lib/generators/rails_a11y/install/generator.rb +51 -0
- data/lib/rails_accessibility_testing/accessibility_helper.rb +701 -0
- data/lib/rails_accessibility_testing/change_detector.rb +114 -0
- data/lib/rails_accessibility_testing/checks/aria_landmarks_check.rb +33 -0
- data/lib/rails_accessibility_testing/checks/base_check.rb +156 -0
- data/lib/rails_accessibility_testing/checks/color_contrast_check.rb +56 -0
- data/lib/rails_accessibility_testing/checks/duplicate_ids_check.rb +49 -0
- data/lib/rails_accessibility_testing/checks/form_errors_check.rb +40 -0
- data/lib/rails_accessibility_testing/checks/form_labels_check.rb +62 -0
- data/lib/rails_accessibility_testing/checks/heading_hierarchy_check.rb +53 -0
- data/lib/rails_accessibility_testing/checks/image_alt_text_check.rb +52 -0
- data/lib/rails_accessibility_testing/checks/interactive_elements_check.rb +66 -0
- data/lib/rails_accessibility_testing/checks/keyboard_accessibility_check.rb +36 -0
- data/lib/rails_accessibility_testing/checks/skip_links_check.rb +24 -0
- data/lib/rails_accessibility_testing/checks/table_structure_check.rb +36 -0
- data/lib/rails_accessibility_testing/cli/command.rb +259 -0
- data/lib/rails_accessibility_testing/config/yaml_loader.rb +131 -0
- data/lib/rails_accessibility_testing/configuration.rb +30 -0
- data/lib/rails_accessibility_testing/engine/rule_engine.rb +97 -0
- data/lib/rails_accessibility_testing/engine/violation.rb +58 -0
- data/lib/rails_accessibility_testing/engine/violation_collector.rb +59 -0
- data/lib/rails_accessibility_testing/error_message_builder.rb +354 -0
- data/lib/rails_accessibility_testing/integration/minitest_integration.rb +74 -0
- data/lib/rails_accessibility_testing/rspec_integration.rb +58 -0
- data/lib/rails_accessibility_testing/shared_examples.rb +93 -0
- data/lib/rails_accessibility_testing/version.rb +4 -0
- data/lib/rails_accessibility_testing.rb +83 -0
- data/lib/tasks/accessibility.rake +28 -0
- metadata +218 -0
data/README.md
ADDED
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
# Rails Accessibility Testing
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/rb/rails_accessibility_testing)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
[](https://www.ruby-lang.org/)
|
|
6
|
+
[](https://rubyonrails.org/)
|
|
7
|
+
|
|
8
|
+
**The RSpec + RuboCop of accessibility for Rails. Catch WCAG violations before they reach production.**
|
|
9
|
+
|
|
10
|
+
**Current Version:** 1.1.0
|
|
11
|
+
|
|
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
|
+
|
|
14
|
+
Rails Accessibility Testing is a comprehensive, opinionated but configurable gem that makes accessibility testing as natural as unit testing. It integrates seamlessly into your Rails workflow, catching accessibility issues as you codeβnot after deployment.
|
|
15
|
+
|
|
16
|
+
## π― Positioning
|
|
17
|
+
|
|
18
|
+
Rails Accessibility Testing fills a critical gap in the Rails testing ecosystem. While RSpec ensures code works and RuboCop ensures code style, Rails Accessibility Testing ensures applications are accessible to everyone. Unlike manual accessibility audits that happen late in development, Rails Accessibility Testing integrates directly into your test suite, catching violations as you code. It's opinionated enough to guide teams new to accessibility, yet configurable enough for experienced teams. By making accessibility testing as natural as unit testing, Rails Accessibility Testing helps teams build accessible applications from day one, not as an afterthought.
|
|
19
|
+
|
|
20
|
+
## β¨ Features
|
|
21
|
+
|
|
22
|
+
- π **Zero Configuration** - Works out of the box with smart defaults
|
|
23
|
+
- π― **11+ Comprehensive Checks** - WCAG 2.1 AA aligned
|
|
24
|
+
- π **File Location Hints** - Know exactly which view file to fix
|
|
25
|
+
- π§ **Actionable Error Messages** - Code examples showing how to fix issues
|
|
26
|
+
- β‘ **Smart Change Detection** - Only runs when relevant code changes
|
|
27
|
+
- π¨ **Beautiful CLI** - Human-readable and JSON reports
|
|
28
|
+
- π **Rails Generator** - One command setup
|
|
29
|
+
- π§ͺ **RSpec & Minitest** - Works with both test frameworks
|
|
30
|
+
- βοΈ **YAML Configuration** - Profile-based config (dev/test/CI)
|
|
31
|
+
- π **Comprehensive Guides** - Learn as you go
|
|
32
|
+
|
|
33
|
+
## π Quick Start
|
|
34
|
+
|
|
35
|
+
### Installation
|
|
36
|
+
|
|
37
|
+
Add to your `Gemfile`:
|
|
38
|
+
|
|
39
|
+
```ruby
|
|
40
|
+
group :development, :test do
|
|
41
|
+
gem 'rails_accessibility_testing'
|
|
42
|
+
gem 'axe-core-capybara', '~> 4.0'
|
|
43
|
+
end
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Then run:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
bundle install
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Setup (Option 1: Generator - Recommended)
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
rails generate rails_a11y:install
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**Note:** The generator command is `rails_a11y:install` (short form). The gem name is `rails_accessibility_testing`.
|
|
59
|
+
|
|
60
|
+
This creates:
|
|
61
|
+
- `config/initializers/rails_a11y.rb` - Configuration
|
|
62
|
+
- `config/accessibility.yml` - Check settings
|
|
63
|
+
- Updates `spec/rails_helper.rb` (if using RSpec)
|
|
64
|
+
|
|
65
|
+
### Setup (Option 2: Manual)
|
|
66
|
+
|
|
67
|
+
Add to your `spec/rails_helper.rb` (RSpec):
|
|
68
|
+
|
|
69
|
+
```ruby
|
|
70
|
+
require 'rspec/rails'
|
|
71
|
+
require 'rails_accessibility_testing' # Add this line
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Or for Minitest, add to `test/test_helper.rb`:
|
|
75
|
+
|
|
76
|
+
```ruby
|
|
77
|
+
require 'rails_accessibility_testing/integration/minitest_integration'
|
|
78
|
+
RailsAccessibilityTesting::Integration::MinitestIntegration.setup!
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**That's it!** Accessibility checks now run automatically on all system tests.
|
|
82
|
+
|
|
83
|
+
## π Usage
|
|
84
|
+
|
|
85
|
+
### Automatic Checks
|
|
86
|
+
|
|
87
|
+
Just write your specs normally - checks run automatically:
|
|
88
|
+
|
|
89
|
+
```ruby
|
|
90
|
+
# spec/system/home_page_spec.rb
|
|
91
|
+
RSpec.describe "Home Page" do
|
|
92
|
+
it "displays welcome message" do
|
|
93
|
+
visit root_path
|
|
94
|
+
expect(page).to have_content("Welcome")
|
|
95
|
+
# β
Accessibility checks run automatically!
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Skip Checks for Specific Tests
|
|
101
|
+
|
|
102
|
+
```ruby
|
|
103
|
+
# RSpec
|
|
104
|
+
it "does something", skip_a11y: true do
|
|
105
|
+
# Accessibility checks won't run for this test
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# Minitest
|
|
109
|
+
test "does something", skip_a11y: true do
|
|
110
|
+
# Accessibility checks won't run for this test
|
|
111
|
+
end
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Manual Comprehensive Checks
|
|
115
|
+
|
|
116
|
+
```ruby
|
|
117
|
+
it "meets all accessibility standards" do
|
|
118
|
+
visit some_path
|
|
119
|
+
check_comprehensive_accessibility # All 11 checks
|
|
120
|
+
end
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### CLI Usage
|
|
124
|
+
|
|
125
|
+
Run checks against URLs or Rails routes:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
# Check specific paths
|
|
129
|
+
bundle exec rails_a11y check /home /about
|
|
130
|
+
|
|
131
|
+
# Check URLs
|
|
132
|
+
bundle exec rails_a11y check --urls https://example.com
|
|
133
|
+
|
|
134
|
+
# Check Rails routes
|
|
135
|
+
bundle exec rails_a11y check --routes home_path about_path
|
|
136
|
+
|
|
137
|
+
# Generate JSON report
|
|
138
|
+
bundle exec rails_a11y check --format json --output report.json
|
|
139
|
+
|
|
140
|
+
# Use CI profile
|
|
141
|
+
bundle exec rails_a11y check --profile ci
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## π― What Gets Checked
|
|
145
|
+
|
|
146
|
+
The gem automatically runs **11 comprehensive accessibility checks**:
|
|
147
|
+
|
|
148
|
+
1. β
**Form Labels** - All form inputs have associated labels
|
|
149
|
+
2. β
**Image Alt Text** - All images have descriptive alt attributes
|
|
150
|
+
3. β
**Interactive Elements** - Buttons, links have accessible names
|
|
151
|
+
4. β
**Heading Hierarchy** - Proper h1-h6 structure
|
|
152
|
+
5. β
**Keyboard Accessibility** - All interactive elements keyboard accessible
|
|
153
|
+
6. β
**ARIA Landmarks** - Proper use of ARIA landmark roles
|
|
154
|
+
7. β
**Form Error Associations** - Errors linked to form fields
|
|
155
|
+
8. β
**Table Structure** - Tables have proper headers
|
|
156
|
+
9. β
**Duplicate IDs** - No duplicate ID attributes
|
|
157
|
+
10. β
**Skip Links** - Skip navigation links present
|
|
158
|
+
11. β
**Color Contrast** - Text meets contrast requirements (optional)
|
|
159
|
+
|
|
160
|
+
## βοΈ Configuration
|
|
161
|
+
|
|
162
|
+
### YAML Configuration
|
|
163
|
+
|
|
164
|
+
Create `config/accessibility.yml`:
|
|
165
|
+
|
|
166
|
+
```yaml
|
|
167
|
+
# WCAG compliance level (A, AA, AAA)
|
|
168
|
+
wcag_level: AA
|
|
169
|
+
|
|
170
|
+
# Global check configuration
|
|
171
|
+
checks:
|
|
172
|
+
form_labels: true
|
|
173
|
+
image_alt_text: true
|
|
174
|
+
interactive_elements: true
|
|
175
|
+
heading_hierarchy: true
|
|
176
|
+
keyboard_accessibility: true
|
|
177
|
+
aria_landmarks: true
|
|
178
|
+
form_errors: true
|
|
179
|
+
table_structure: true
|
|
180
|
+
duplicate_ids: true
|
|
181
|
+
skip_links: true
|
|
182
|
+
color_contrast: false # Disabled by default (expensive)
|
|
183
|
+
|
|
184
|
+
# Profile-specific configurations
|
|
185
|
+
development:
|
|
186
|
+
checks:
|
|
187
|
+
color_contrast: false # Skip in dev for speed
|
|
188
|
+
|
|
189
|
+
ci:
|
|
190
|
+
checks:
|
|
191
|
+
color_contrast: true # Full checks in CI
|
|
192
|
+
|
|
193
|
+
# Ignored rules with reasons
|
|
194
|
+
ignored_rules:
|
|
195
|
+
# - rule: form_labels
|
|
196
|
+
# reason: "Legacy form, scheduled for refactor in Q2"
|
|
197
|
+
# comment: "Will be fixed in PR #123"
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Ruby Configuration
|
|
201
|
+
|
|
202
|
+
Edit `config/initializers/rails_a11y.rb`:
|
|
203
|
+
|
|
204
|
+
```ruby
|
|
205
|
+
RailsAccessibilityTesting.configure do |config|
|
|
206
|
+
# Automatically run checks after system specs
|
|
207
|
+
config.auto_run_checks = true
|
|
208
|
+
|
|
209
|
+
# Logger for accessibility check output
|
|
210
|
+
config.logger = Rails.logger
|
|
211
|
+
|
|
212
|
+
# Configuration file path
|
|
213
|
+
config.config_path = 'config/accessibility.yml'
|
|
214
|
+
|
|
215
|
+
# Default profile
|
|
216
|
+
config.default_profile = :test
|
|
217
|
+
end
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## π Example Error Output
|
|
221
|
+
|
|
222
|
+
When accessibility issues are found, you get detailed, actionable errors:
|
|
223
|
+
|
|
224
|
+
```
|
|
225
|
+
======================================================================
|
|
226
|
+
β ACCESSIBILITY ERROR: Image missing alt attribute
|
|
227
|
+
======================================================================
|
|
228
|
+
|
|
229
|
+
π Page Being Tested:
|
|
230
|
+
URL: http://localhost:3000/
|
|
231
|
+
Path: /
|
|
232
|
+
π Likely View File: app/views/shared/_header.html.erb
|
|
233
|
+
|
|
234
|
+
π Element Details:
|
|
235
|
+
Tag: <img>
|
|
236
|
+
ID: (none)
|
|
237
|
+
Classes: logo
|
|
238
|
+
Src: /assets/logo.png
|
|
239
|
+
|
|
240
|
+
π§ HOW TO FIX:
|
|
241
|
+
Choose ONE of these solutions:
|
|
242
|
+
|
|
243
|
+
1. Add alt text for informative images:
|
|
244
|
+
<img src="/assets/logo.png" alt="Company Logo">
|
|
245
|
+
|
|
246
|
+
2. Use Rails image_tag helper:
|
|
247
|
+
<%= image_tag 'logo.png', alt: 'Company Logo' %>
|
|
248
|
+
|
|
249
|
+
π‘ Best Practice: All images must have alt attribute.
|
|
250
|
+
Use empty alt="" only for purely decorative images.
|
|
251
|
+
|
|
252
|
+
π WCAG Reference: https://www.w3.org/WAI/WCAG21/Understanding/
|
|
253
|
+
======================================================================
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
## π Documentation
|
|
257
|
+
|
|
258
|
+
### π Online Documentation
|
|
259
|
+
|
|
260
|
+
**π [View Full Documentation on GitHub Pages](https://rayraycodes.github.io/rails-accessibility-testing/)**
|
|
261
|
+
|
|
262
|
+
Complete documentation site with all guides, examples, and API reference. The documentation is automatically deployed from this repository.
|
|
263
|
+
|
|
264
|
+
> **Note:**
|
|
265
|
+
> - **Documentation URL:** `https://rayraycodes.github.io/rails-accessibility-testing/`
|
|
266
|
+
> - If the link doesn't work, GitHub Pages may need to be enabled. See [ENABLE_GITHUB_PAGES.md](ENABLE_GITHUB_PAGES.md) for setup instructions.
|
|
267
|
+
> - To add this link to your GitHub repository page, see [GITHUB_REPO_SETUP.md](GITHUB_REPO_SETUP.md)
|
|
268
|
+
|
|
269
|
+
### Guides
|
|
270
|
+
|
|
271
|
+
- **[Getting Started](GUIDES/getting_started.md)** - Quick start guide
|
|
272
|
+
- **[Continuous Integration](GUIDES/continuous_integration.md)** - CI/CD setup
|
|
273
|
+
- **[Writing Accessible Views](GUIDES/writing_accessible_views_in_rails.md)** - Best practices
|
|
274
|
+
- **[Working with Designers](GUIDES/working_with_designers_and_content_authors.md)** - Team collaboration
|
|
275
|
+
|
|
276
|
+
### API Documentation
|
|
277
|
+
|
|
278
|
+
Generate API docs with YARD:
|
|
279
|
+
|
|
280
|
+
```bash
|
|
281
|
+
bundle exec yard doc
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
View at `doc/index.html`
|
|
285
|
+
|
|
286
|
+
## ποΈ Architecture
|
|
287
|
+
|
|
288
|
+
Rails Accessibility Testing is built with a clean, modular architecture:
|
|
289
|
+
|
|
290
|
+
- **Rule Engine** - Evaluates accessibility checks
|
|
291
|
+
- **Check Definitions** - WCAG-aligned check implementations
|
|
292
|
+
- **Violation Collector** - Aggregates and formats violations
|
|
293
|
+
- **Rails Integration** - Railtie, RSpec, Minitest helpers
|
|
294
|
+
- **CLI** - Command-line interface for URL/route scanning
|
|
295
|
+
- **Configuration** - YAML-based config with profiles
|
|
296
|
+
|
|
297
|
+
See [ARCHITECTURE.md](ARCHITECTURE.md) for detailed architecture documentation.
|
|
298
|
+
|
|
299
|
+
## π§ Requirements
|
|
300
|
+
|
|
301
|
+
- Ruby 3.0+ (3.1+ recommended)
|
|
302
|
+
- Rails 6.0+ (7.1+ recommended)
|
|
303
|
+
- RSpec Rails 6.0+ (for RSpec) or Minitest (for Minitest)
|
|
304
|
+
- Capybara 3.0+
|
|
305
|
+
- Chrome/Chromium browser
|
|
306
|
+
|
|
307
|
+
## π€ Contributing
|
|
308
|
+
|
|
309
|
+
We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
310
|
+
|
|
311
|
+
1. Fork the repository
|
|
312
|
+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
313
|
+
3. Commit your changes (`git commit -m 'Add: amazing feature'`)
|
|
314
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
315
|
+
5. Open a Pull Request
|
|
316
|
+
|
|
317
|
+
### Code of Conduct
|
|
318
|
+
|
|
319
|
+
This project adheres to a [Code of Conduct](CODE_OF_CONDUCT.md). Please read it before contributing.
|
|
320
|
+
|
|
321
|
+
## π License
|
|
322
|
+
|
|
323
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
324
|
+
|
|
325
|
+
## π Acknowledgments
|
|
326
|
+
|
|
327
|
+
- Built on [axe-core](https://github.com/dequelabs/axe-core) for accessibility testing
|
|
328
|
+
- Uses [axe-core-capybara](https://github.com/dequelabs/axe-core-capybara) for Capybara integration
|
|
329
|
+
- Inspired by the need for better accessibility testing in Rails applications
|
|
330
|
+
|
|
331
|
+
## π Support
|
|
332
|
+
|
|
333
|
+
- **Issues:** [GitHub Issues](https://github.com/rayraycodes/rails-accessibility-testing/issues)
|
|
334
|
+
- **Email:** imregan@umich.edu
|
|
335
|
+
- **Documentation:** See [GUIDES](GUIDES/) directory
|
|
336
|
+
|
|
337
|
+
## πΊοΈ Roadmap
|
|
338
|
+
|
|
339
|
+
- [ ] Enhanced color contrast checking with JS evaluation
|
|
340
|
+
- [ ] Custom rule definitions
|
|
341
|
+
- [ ] Visual regression testing
|
|
342
|
+
- [ ] Performance monitoring
|
|
343
|
+
- [ ] IDE integration (VS Code, IntelliJ)
|
|
344
|
+
- [ ] CI/CD templates (GitHub Actions, CircleCI)
|
|
345
|
+
|
|
346
|
+
---
|
|
347
|
+
|
|
348
|
+
**Made with β€οΈ for accessible Rails applications**
|
|
349
|
+
|
|
350
|
+
*Rails Accessibility Testing helps teams build accessible applications from day one, not as an afterthought.*
|
data/docs_site/404.html
ADDED
data/docs_site/Gemfile
ADDED
data/docs_site/Makefile
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Jekyll Configuration for Rails Accessibility Testing Docs
|
|
2
|
+
title: Rails Accessibility Testing
|
|
3
|
+
description: The RSpec + RuboCop of accessibility for Rails
|
|
4
|
+
url: https://rayraycodes.github.io
|
|
5
|
+
# baseurl will be set dynamically by workflow
|
|
6
|
+
baseurl: ""
|
|
7
|
+
|
|
8
|
+
# GitHub Pages settings
|
|
9
|
+
github: [metadata]
|
|
10
|
+
plugins:
|
|
11
|
+
- jekyll-feed
|
|
12
|
+
- jekyll-sitemap
|
|
13
|
+
- jekyll-relative-links
|
|
14
|
+
|
|
15
|
+
# Build settings
|
|
16
|
+
markdown: kramdown
|
|
17
|
+
highlighter: rouge
|
|
18
|
+
theme: minima
|
|
19
|
+
|
|
20
|
+
# Navigation
|
|
21
|
+
navigation:
|
|
22
|
+
- title: Home
|
|
23
|
+
url: /
|
|
24
|
+
- title: Getting Started
|
|
25
|
+
url: /getting_started.html
|
|
26
|
+
- title: Configuration
|
|
27
|
+
url: /configuration.html
|
|
28
|
+
- title: CI Integration
|
|
29
|
+
url: /ci_integration.html
|
|
30
|
+
- title: Contributing
|
|
31
|
+
url: /contributing.html
|
|
32
|
+
|
|
33
|
+
# Exclude from processing
|
|
34
|
+
exclude:
|
|
35
|
+
- Gemfile
|
|
36
|
+
- Gemfile.lock
|
|
37
|
+
- node_modules
|
|
38
|
+
- vendor
|
|
39
|
+
- README.md
|
|
40
|
+
- Makefile
|
|
41
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<header>
|
|
2
|
+
<h1><a href="{{ '/' | relative_url }}">Rails Accessibility Testing</a></h1>
|
|
3
|
+
<p>The RSpec + RuboCop of accessibility for Rails</p>
|
|
4
|
+
</header>
|
|
5
|
+
|
|
6
|
+
<nav>
|
|
7
|
+
<a href="{{ '/' | relative_url }}">Home</a>
|
|
8
|
+
<a href="{{ '/getting_started.html' | relative_url }}">Getting Started</a>
|
|
9
|
+
<a href="{{ '/configuration.html' | relative_url }}">Configuration</a>
|
|
10
|
+
<a href="{{ '/ci_integration.html' | relative_url }}">CI Integration</a>
|
|
11
|
+
<a href="{{ '/contributing.html' | relative_url }}">Contributing</a>
|
|
12
|
+
</nav>
|
|
13
|
+
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>{% if page.title %}{{ page.title }} - {% endif %}{{ site.title }}</title>
|
|
7
|
+
<meta name="description" content="{{ site.description }}">
|
|
8
|
+
<style>
|
|
9
|
+
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
10
|
+
body {
|
|
11
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
|
12
|
+
line-height: 1.6;
|
|
13
|
+
color: #333;
|
|
14
|
+
background: #fff;
|
|
15
|
+
}
|
|
16
|
+
header {
|
|
17
|
+
background: #2c3e50;
|
|
18
|
+
color: white;
|
|
19
|
+
padding: 2rem 0;
|
|
20
|
+
text-align: center;
|
|
21
|
+
}
|
|
22
|
+
header h1 { font-size: 2.5rem; margin-bottom: 0.5rem; }
|
|
23
|
+
header h1 a { color: white; text-decoration: none; }
|
|
24
|
+
header p { font-size: 1.2rem; opacity: 0.9; }
|
|
25
|
+
nav {
|
|
26
|
+
background: #34495e;
|
|
27
|
+
padding: 1rem 0;
|
|
28
|
+
text-align: center;
|
|
29
|
+
}
|
|
30
|
+
nav a {
|
|
31
|
+
color: white;
|
|
32
|
+
text-decoration: none;
|
|
33
|
+
margin: 0 1rem;
|
|
34
|
+
padding: 0.5rem 1rem;
|
|
35
|
+
display: inline-block;
|
|
36
|
+
}
|
|
37
|
+
nav a:hover { background: #2c3e50; }
|
|
38
|
+
main {
|
|
39
|
+
max-width: 1200px;
|
|
40
|
+
margin: 2rem auto;
|
|
41
|
+
padding: 0 2rem;
|
|
42
|
+
}
|
|
43
|
+
section {
|
|
44
|
+
margin: 3rem 0;
|
|
45
|
+
}
|
|
46
|
+
h1, h2 {
|
|
47
|
+
color: #2c3e50;
|
|
48
|
+
margin-bottom: 1rem;
|
|
49
|
+
}
|
|
50
|
+
h1 { font-size: 2.5rem; }
|
|
51
|
+
h2 { font-size: 2rem; }
|
|
52
|
+
h3 { font-size: 1.5rem; color: #34495e; margin-top: 2rem; margin-bottom: 1rem; }
|
|
53
|
+
code {
|
|
54
|
+
background: #f4f4f4;
|
|
55
|
+
padding: 0.2rem 0.4rem;
|
|
56
|
+
border-radius: 3px;
|
|
57
|
+
font-family: 'Courier New', monospace;
|
|
58
|
+
font-size: 0.9em;
|
|
59
|
+
}
|
|
60
|
+
pre {
|
|
61
|
+
background: #f4f4f4;
|
|
62
|
+
padding: 1rem;
|
|
63
|
+
border-radius: 5px;
|
|
64
|
+
overflow-x: auto;
|
|
65
|
+
margin: 1rem 0;
|
|
66
|
+
}
|
|
67
|
+
pre code {
|
|
68
|
+
background: none;
|
|
69
|
+
padding: 0;
|
|
70
|
+
}
|
|
71
|
+
footer {
|
|
72
|
+
background: #2c3e50;
|
|
73
|
+
color: white;
|
|
74
|
+
text-align: center;
|
|
75
|
+
padding: 2rem 0;
|
|
76
|
+
margin-top: 4rem;
|
|
77
|
+
}
|
|
78
|
+
.cta {
|
|
79
|
+
background: #3498db;
|
|
80
|
+
color: white;
|
|
81
|
+
padding: 1rem 2rem;
|
|
82
|
+
border-radius: 5px;
|
|
83
|
+
text-decoration: none;
|
|
84
|
+
display: inline-block;
|
|
85
|
+
margin: 1rem 0;
|
|
86
|
+
}
|
|
87
|
+
.cta:hover { background: #2980b9; }
|
|
88
|
+
ul, ol {
|
|
89
|
+
margin-left: 2rem;
|
|
90
|
+
margin-bottom: 1rem;
|
|
91
|
+
}
|
|
92
|
+
li {
|
|
93
|
+
margin-bottom: 0.5rem;
|
|
94
|
+
}
|
|
95
|
+
blockquote {
|
|
96
|
+
border-left: 4px solid #3498db;
|
|
97
|
+
padding-left: 1rem;
|
|
98
|
+
margin: 1rem 0;
|
|
99
|
+
color: #666;
|
|
100
|
+
}
|
|
101
|
+
table {
|
|
102
|
+
width: 100%;
|
|
103
|
+
border-collapse: collapse;
|
|
104
|
+
margin: 1rem 0;
|
|
105
|
+
}
|
|
106
|
+
th, td {
|
|
107
|
+
border: 1px solid #ddd;
|
|
108
|
+
padding: 0.5rem;
|
|
109
|
+
text-align: left;
|
|
110
|
+
}
|
|
111
|
+
th {
|
|
112
|
+
background: #f4f4f4;
|
|
113
|
+
font-weight: 600;
|
|
114
|
+
}
|
|
115
|
+
</style>
|
|
116
|
+
</head>
|
|
117
|
+
<body>
|
|
118
|
+
{% include header.html %}
|
|
119
|
+
|
|
120
|
+
<main>
|
|
121
|
+
{{ content }}
|
|
122
|
+
</main>
|
|
123
|
+
|
|
124
|
+
<footer>
|
|
125
|
+
<p>© {{ 'now' | date: "%Y" }} Rails Accessibility Testing. MIT License.</p>
|
|
126
|
+
<p><a href="https://github.com/rayraycodes/rails-accessibility-testing" style="color: white;">GitHub</a></p>
|
|
127
|
+
</footer>
|
|
128
|
+
</body>
|
|
129
|
+
</html>
|
|
130
|
+
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: default
|
|
3
|
+
title: CI Integration
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Continuous Integration with Rails Accessibility Testing
|
|
7
|
+
|
|
8
|
+
This guide shows you how to integrate Rails Accessibility Testing into your CI/CD pipeline to catch accessibility issues before they reach production.
|
|
9
|
+
|
|
10
|
+
## Why CI Integration?
|
|
11
|
+
|
|
12
|
+
- **Catch issues early** - Before code is merged
|
|
13
|
+
- **Prevent regressions** - Ensure fixes stay fixed
|
|
14
|
+
- **Team accountability** - Everyone sees accessibility status
|
|
15
|
+
- **Compliance tracking** - Document WCAG compliance
|
|
16
|
+
|
|
17
|
+
## GitHub Actions
|
|
18
|
+
|
|
19
|
+
### Basic Setup
|
|
20
|
+
|
|
21
|
+
Create `.github/workflows/accessibility.yml`:
|
|
22
|
+
|
|
23
|
+
```yaml
|
|
24
|
+
name: Accessibility Tests
|
|
25
|
+
|
|
26
|
+
on:
|
|
27
|
+
pull_request:
|
|
28
|
+
push:
|
|
29
|
+
branches: [main]
|
|
30
|
+
|
|
31
|
+
jobs:
|
|
32
|
+
accessibility:
|
|
33
|
+
runs-on: ubuntu-latest
|
|
34
|
+
|
|
35
|
+
services:
|
|
36
|
+
postgres:
|
|
37
|
+
image: postgres:14
|
|
38
|
+
env:
|
|
39
|
+
POSTGRES_PASSWORD: postgres
|
|
40
|
+
options: >-
|
|
41
|
+
--health-cmd pg_isready
|
|
42
|
+
--health-interval 10s
|
|
43
|
+
--health-timeout 5s
|
|
44
|
+
--health-retries 5
|
|
45
|
+
|
|
46
|
+
steps:
|
|
47
|
+
- uses: actions/checkout@v3
|
|
48
|
+
|
|
49
|
+
- name: Set up Ruby
|
|
50
|
+
uses: ruby/setup-ruby@v1
|
|
51
|
+
with:
|
|
52
|
+
ruby-version: 3.1
|
|
53
|
+
bundler-cache: true
|
|
54
|
+
|
|
55
|
+
- name: Install Chrome
|
|
56
|
+
run: |
|
|
57
|
+
sudo apt-get update
|
|
58
|
+
sudo apt-get install -y google-chrome-stable
|
|
59
|
+
|
|
60
|
+
- name: Setup test database
|
|
61
|
+
env:
|
|
62
|
+
RAILS_ENV: test
|
|
63
|
+
DATABASE_URL: postgres://postgres:postgres@localhost/test
|
|
64
|
+
run: |
|
|
65
|
+
bundle exec rails db:create db:schema:load
|
|
66
|
+
|
|
67
|
+
- name: Run accessibility tests
|
|
68
|
+
env:
|
|
69
|
+
RAILS_ENV: test
|
|
70
|
+
DATABASE_URL: postgres://postgres:postgres@localhost/test
|
|
71
|
+
run: |
|
|
72
|
+
bundle exec rspec spec/system/ --format documentation
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
For complete CI integration documentation, see the [CI Integration guide](https://github.com/rayraycodes/rails-accessibility-testing/blob/main/GUIDES/continuous_integration.md) in the main repository.
|
|
76
|
+
|