rails_accessibility_testing 1.4.3 → 1.5.1

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.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/ARCHITECTURE.md +212 -53
  3. data/CHANGELOG.md +118 -0
  4. data/GUIDES/getting_started.md +105 -77
  5. data/GUIDES/system_specs_for_accessibility.md +13 -12
  6. data/README.md +150 -36
  7. data/docs_site/getting_started.md +59 -69
  8. data/exe/a11y_live_scanner +361 -0
  9. data/exe/rails_server_safe +18 -1
  10. data/lib/generators/rails_a11y/install/install_generator.rb +137 -0
  11. data/lib/generators/rails_a11y/install/templates/accessibility.yml.erb +49 -0
  12. data/lib/generators/rails_a11y/install/templates/all_pages_accessibility_spec.rb.erb +66 -0
  13. data/lib/generators/rails_a11y/install/templates/initializer.rb.erb +24 -0
  14. data/lib/rails_accessibility_testing/accessibility_helper.rb +547 -24
  15. data/lib/rails_accessibility_testing/change_detector.rb +17 -104
  16. data/lib/rails_accessibility_testing/checks/base_check.rb +56 -7
  17. data/lib/rails_accessibility_testing/checks/heading_check.rb +138 -0
  18. data/lib/rails_accessibility_testing/checks/image_alt_text_check.rb +7 -7
  19. data/lib/rails_accessibility_testing/checks/interactive_elements_check.rb +11 -1
  20. data/lib/rails_accessibility_testing/cli/command.rb +3 -1
  21. data/lib/rails_accessibility_testing/config/yaml_loader.rb +1 -1
  22. data/lib/rails_accessibility_testing/engine/rule_engine.rb +49 -5
  23. data/lib/rails_accessibility_testing/error_message_builder.rb +63 -7
  24. data/lib/rails_accessibility_testing/middleware/page_visit_logger.rb +81 -0
  25. data/lib/rails_accessibility_testing/railtie.rb +22 -0
  26. data/lib/rails_accessibility_testing/rspec_integration.rb +176 -10
  27. data/lib/rails_accessibility_testing/version.rb +1 -1
  28. data/lib/rails_accessibility_testing.rb +8 -3
  29. metadata +11 -4
  30. data/lib/generators/rails_a11y/install/generator.rb +0 -51
  31. data/lib/rails_accessibility_testing/checks/heading_hierarchy_check.rb +0 -53
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c4df6f6fa98287499a91edd38be1b081a97c3ec3ce09fade45192afe3aad7e27
4
- data.tar.gz: 412a2a707455699628ab59d64c0ed3f7607c143fbdbfb7d0d70dae80bad84c8c
3
+ metadata.gz: ed1c4100059b21f4a777e9691fec08fe59fc59f7accecc5b8f47e15b68b913ed
4
+ data.tar.gz: b65e45644fd839d960ef461b5a3c350903c93ad0a89337f5f3423e2d87b7c57a
5
5
  SHA512:
6
- metadata.gz: c6b0639e08a27ee874ff9fb98123f36cf429a6fcd98615beb6a17682da9a24adeb027305af4713a05cee02640d4f3d0b375245a4b55fdc03020a277a4c608f92
7
- data.tar.gz: df40a9a2df569f6e49a41bc3d90812c897a827a981bc555c25dec824422aac25676b53689b323d29eaa7b6a3fa046e903cb2e510148cbaf0b4bc6797deed2c91
6
+ metadata.gz: 827873b27a3a9ee68c39090838d3d422a628567df1134ea4ed807be28b909e5fe3b976fb232493633ed8f521ebf2c94eca8ce051b78b844a86424095ffcc31fc
7
+ data.tar.gz: 2f682ff20a50b1a0ec99911f0d260a6fc6400df9aac19451538efe882a7c7dd98582895e8dd151ad4bd1d80ec998a7c86ac6906b22da46beef048f2a7226490c
data/ARCHITECTURE.md CHANGED
@@ -2,20 +2,12 @@
2
2
 
3
3
  ## Project Identity
4
4
 
5
- ### Gem Name Options
6
-
7
- After careful consideration, we've selected:
5
+ ### Gem Name
8
6
 
9
7
  **Final Name: `rails_accessibility_testing`**
10
8
 
11
9
  **Note:** The gem uses `rails_a11y` as a short alias for the generator command and CLI tool, but the official gem name is `rails_accessibility_testing`.
12
10
 
13
- **Alternative names considered:**
14
- 1. `rails_accessibility_testing` - **SELECTED** - Clear and descriptive
15
- 2. `rails_a11y` - Short alias used for CLI and generator
16
- 3. `a11y_rails` - Alternative short form
17
- 4. `accessible_rails` - Descriptive but longer
18
-
19
11
  ### Tagline
20
12
 
21
13
  **"The RSpec + RuboCop of accessibility for Rails. Catch WCAG violations before they reach production."**
@@ -34,16 +26,29 @@ Rails Accessibility Testing fills a critical gap in the Rails testing ecosystem.
34
26
  2. **Accessibility at Core**: WCAG 2.1 AA compliance is the foundation
35
27
  3. **Rails Native**: Feels like a natural part of Rails, not a bolt-on
36
28
  4. **Progressive Enhancement**: Works with zero config, scales with configuration
29
+ 5. **Performance Conscious**: Smart caching and change detection for fast feedback
37
30
 
38
31
  ### Component Architecture
39
32
 
40
33
  ```
41
- rails_a11y/
34
+ rails_accessibility_testing/
42
35
  ├── Core Engine
43
36
  │ ├── Rule Engine # Evaluates accessibility rules
44
- │ ├── Check Definitions # WCAG-aligned check implementations
37
+ │ ├── Check Definitions # WCAG-aligned check implementations (11+ checks)
45
38
  │ └── Violation Collector # Aggregates and formats violations
46
39
 
40
+ ├── View Detection System (NEW in 1.5.0)
41
+ │ ├── View File Detector # Finds view files from routes/actions
42
+ │ ├── Partial Detection # Scans view files for rendered partials
43
+ │ ├── Route Recognition # Maps URLs to controller/action pairs
44
+ │ └── Fuzzy Matching # Handles action/view name mismatches
45
+
46
+ ├── Performance System (NEW in 1.5.0)
47
+ │ ├── Page Scanning Cache # Prevents duplicate scans
48
+ │ ├── Change Detector # Detects file changes and impact
49
+ │ ├── First-Run Logic # Optimizes initial vs subsequent runs
50
+ │ └── Asset Change Detection # Tracks CSS/JS changes
51
+
47
52
  ├── Rails Integration
48
53
  │ ├── Railtie # Rails initialization hooks
49
54
  │ ├── RSpec Integration # RSpec helpers and matchers
@@ -76,13 +81,20 @@ Test Execution
76
81
 
77
82
  System Test Helper (RSpec/Minitest)
78
83
 
84
+ Page Scanning Cache Check (NEW in 1.5.0)
85
+ ↓ (if not cached)
79
86
  Rule Engine
80
87
 
81
88
  Check Definitions (11+ checks)
82
89
 
90
+ View File Detection (NEW in 1.5.0)
91
+ ├── Route Recognition
92
+ ├── View File Matching
93
+ └── Partial Detection
94
+
83
95
  Violation Collector
84
96
 
85
- Error Message Builder
97
+ Error Message Builder (with file paths)
86
98
 
87
99
  Test Failure / CLI Report
88
100
  ```
@@ -91,21 +103,87 @@ Test Failure / CLI Report
91
103
 
92
104
  The rule engine is the heart of the gem. It:
93
105
 
94
- 1. **Loads Configuration**: Reads `config/accessibility.yml` with profile support**
106
+ 1. **Loads Configuration**: Reads `config/accessibility.yml` with profile support
95
107
  2. **Applies Rule Overrides**: Respects ignored rules with comments
96
108
  3. **Executes Checks**: Runs enabled checks in order
97
109
  4. **Collects Violations**: Aggregates all violations before reporting
98
- 5. **Formats Output**: Creates actionable error messages
110
+ 5. **Formats Output**: Creates actionable error messages with precise file locations
99
111
 
100
112
  ### Check Definition Structure
101
113
 
102
114
  Each check is a self-contained class that:
103
115
 
104
- - Implements a standard interface
116
+ - Implements a standard interface (`BaseCheck`)
105
117
  - Returns violations with context
106
118
  - Includes WCAG references
107
119
  - Provides remediation suggestions
108
120
  - Can be enabled/disabled via config
121
+ - **NEW in 1.5.0**: Includes partial detection methods for better file location
122
+
123
+ ### View Detection System (NEW in 1.5.0)
124
+
125
+ The view detection system is a major enhancement that makes error messages much more actionable:
126
+
127
+ #### View File Detection
128
+
129
+ 1. **Route Recognition**: Uses `Rails.application.routes.recognize_path` to get controller/action
130
+ 2. **Exact Matching**: First tries exact match (`controller/action.html.erb`)
131
+ 3. **Fuzzy Matching**: If no exact match, scans controller directory for files containing action name
132
+ 4. **Preference Logic**: Prefers files starting with action name (e.g., `search_result.html.erb` for `search` action)
133
+ 5. **Fallback**: If controller has only one view file, uses that
134
+
135
+ #### Partial Detection
136
+
137
+ 1. **Pattern Scanning**: Scans view file content for `render` statements using multiple regex patterns
138
+ 2. **Normalization**: Handles various render syntaxes (`render 'partial'`, `render partial: 'partial'`, ERB syntax)
139
+ 3. **Path Resolution**: Resolves partial paths (handles namespaced partials like `layouts/navbar`)
140
+ 4. **Multi-Location Search**: Searches in controller directory, `shared/`, and `layouts/`
141
+ 5. **Element Mapping**: When an accessibility issue is found, determines if it's in a partial
142
+
143
+ #### Module Structure
144
+
145
+ ```ruby
146
+ module AccessibilityHelper
147
+ module PartialDetection
148
+ # Reusable partial detection methods
149
+ def find_partials_in_view_file(view_file)
150
+ # Scans view file for render statements
151
+ end
152
+
153
+ def find_partial_for_element_in_list(controller, element_context, partial_list)
154
+ # Maps element to specific partial
155
+ end
156
+ end
157
+ end
158
+ ```
159
+
160
+ ### Performance System (NEW in 1.5.0)
161
+
162
+ #### Page Scanning Cache
163
+
164
+ - **Purpose**: Prevents duplicate accessibility scans of the same page
165
+ - **Implementation**: Module-level `@scanned_pages` hash
166
+ - **Key Strategy**: Uses page path (preferred) or URL as cache key
167
+ - **Lifecycle**: Persists for duration of test suite execution
168
+ - **API**: `reset_scanned_pages_cache` for manual reset
169
+
170
+ #### Change Detection
171
+
172
+ - **Purpose**: Only test pages when relevant files have changed
173
+ - **Monitored Files**: Views, controllers, helpers, CSS, JavaScript
174
+ - **Impact Analysis**:
175
+ - Main layouts → affects all pages
176
+ - Specific partials → affects only pages that render them
177
+ - Controllers → affects all routes for that controller
178
+ - Helpers → affects all pages (can be used anywhere)
179
+ - Assets → affects all pages (global impact)
180
+
181
+ #### First-Run Logic
182
+
183
+ - **Marker File**: `.rails_a11y_initialized` tracks first run
184
+ - **Initial Run**: Tests all pages to establish baseline
185
+ - **Subsequent Runs**: Only tests changed files
186
+ - **Force Option**: `TEST_ALL_PAGES=true` environment variable
109
187
 
110
188
  ---
111
189
 
@@ -135,15 +213,34 @@ Each check is a self-contained class that:
135
213
  - More efficient than stopping at first error
136
214
  - Better for CI/CD reports
137
215
 
138
- ### 4. View File Detection
216
+ ### 4. View File Detection (Enhanced in 1.5.0)
139
217
 
140
218
  **Why detect view files?**
141
219
  - Points developers to exact file to fix
142
220
  - Works with partials and layouts
143
221
  - Reduces debugging time
144
222
  - Makes errors actionable
223
+ - **NEW**: Handles action/view name mismatches
224
+ - **NEW**: Detects partials automatically
225
+
226
+ ### 5. Page Scanning Cache (NEW in 1.5.0)
227
+
228
+ **Why cache scanned pages?**
229
+ - Prevents duplicate work
230
+ - Faster test execution
231
+ - Better developer experience
232
+ - Reduces unnecessary browser automation
233
+
234
+ ### 6. Smart Change Detection (Enhanced in 1.5.0)
145
235
 
146
- ### 5. Dual Test Framework Support
236
+ **Why detect changes?**
237
+ - Only test what changed (faster feedback)
238
+ - Reduces test execution time
239
+ - Better CI/CD performance
240
+ - **NEW**: Detects asset changes (CSS/JS)
241
+ - **NEW**: Smart partial impact analysis
242
+
243
+ ### 7. Dual Test Framework Support
147
244
 
148
245
  **Why both RSpec and Minitest?**
149
246
  - Rails teams use both
@@ -157,67 +254,72 @@ Each check is a self-contained class that:
157
254
 
158
255
  ```
159
256
  lib/
160
- ├── rails_a11y.rb # Main entry point
161
- ├── rails_a11y/
257
+ ├── rails_accessibility_testing.rb # Main entry point
258
+ ├── rails_accessibility_testing/
162
259
  │ ├── version.rb
163
260
  │ ├── configuration.rb # Config management
164
261
  │ ├── railtie.rb # Rails integration
165
262
  │ │
166
263
  │ ├── engine/
167
264
  │ │ ├── rule_engine.rb # Core rule evaluator
168
- │ │ ├── violation_collector.rb # Aggregates violations
169
- │ │ └── check_context.rb # Context for checks
265
+ │ │ ├── violation_collector.rb # Aggregates violations
266
+ │ │ └── violation.rb # Violation data structure
170
267
  │ │
171
268
  │ ├── checks/
172
- │ │ ├── base_check.rb # Base class for all checks
269
+ │ │ ├── base_check.rb # Base class for all checks
270
+ │ │ │ # (includes PartialDetection in 1.5.0)
173
271
  │ │ ├── form_labels_check.rb
174
272
  │ │ ├── image_alt_text_check.rb
175
273
  │ │ ├── interactive_elements_check.rb
176
- │ │ ├── heading_hierarchy_check.rb
274
+ │ │ ├── heading_check.rb # Renamed from heading_hierarchy_check
177
275
  │ │ ├── keyboard_accessibility_check.rb
178
276
  │ │ ├── aria_landmarks_check.rb
179
277
  │ │ ├── form_errors_check.rb
180
278
  │ │ ├── table_structure_check.rb
181
279
  │ │ ├── duplicate_ids_check.rb
182
280
  │ │ ├── skip_links_check.rb
183
- │ │ └── color_contrast_check.rb # New
281
+ │ │ └── color_contrast_check.rb
282
+ │ │
283
+ │ ├── accessibility_helper.rb # Main helper module
284
+ │ │ # (includes PartialDetection, page cache)
285
+ │ │
286
+ │ ├── change_detector.rb # Smart change detection
287
+ │ │ # (enhanced in 1.5.0 for assets/partials)
184
288
  │ │
185
289
  │ ├── integration/
186
290
  │ │ ├── rspec_integration.rb
187
291
  │ │ ├── minitest_integration.rb
188
- │ │ └── system_test_helper.rb # Shared Capybara helpers
292
+ │ │ └── system_test_helper.rb # Shared Capybara helpers
189
293
  │ │
190
294
  │ ├── cli/
191
- │ │ ├── command.rb # Main CLI command
192
- │ │ ├── url_scanner.rb # Scans URLs/routes
193
- │ │ └── report_generator.rb # Generates reports
295
+ │ │ └── command.rb # Main CLI command
194
296
  │ │
195
297
  │ ├── config/
196
- │ │ ├── yaml_loader.rb # Loads YAML config
197
- │ │ ├── profile_manager.rb # Manages profiles
198
- │ │ └── rule_override.rb # Handles ignored rules
298
+ │ │ └── yaml_loader.rb # Loads YAML config
199
299
  │ │
200
- │ ├── errors/
201
- │ │ ├── error_message_builder.rb # Formats error messages
202
- │ │ └── violation_formatter.rb # Formats individual violations
300
+ │ ├── error_message_builder.rb # Formats error messages
301
+ │ │ # (enhanced with partial detection in 1.5.0)
203
302
  │ │
204
- │ └── utils/
205
- ├── view_file_detector.rb # Detects view files
206
- │ └── wcag_reference.rb # WCAG reference data
303
+ │ └── middleware/
304
+ └── page_visit_logger.rb
207
305
 
208
306
  ├── generators/
209
307
  │ └── rails_a11y/
210
308
  │ └── install/
211
- │ ├── generator.rb
309
+ │ ├── install_generator.rb
212
310
  │ └── templates/
213
311
  │ ├── initializer.rb.erb
214
- └── accessibility.yml.erb
312
+ ├── accessibility.yml.erb
313
+ │ └── all_pages_accessibility_spec.rb.erb
314
+ │ # (enhanced in 1.5.0 with dynamic route discovery)
215
315
 
216
316
  └── tasks/
217
- └── accessibility.rake # Rake tasks
317
+ └── accessibility.rake
218
318
 
219
319
  exe/
220
- └── rails_a11y # CLI executable
320
+ ├── rails_a11y # CLI executable
321
+ ├── rails_server_safe # Safe server wrapper (NEW in 1.5.0)
322
+ └── a11y_live_scanner # Live scanner tool
221
323
 
222
324
  GUIDES/
223
325
  ├── getting_started.md
@@ -227,10 +329,9 @@ GUIDES/
227
329
 
228
330
  docs_site/
229
331
  ├── index.html
230
- ├── usage.html
231
- ├── configuration.html
232
- ├── ci_integration.html
233
- └── contributing.html
332
+ ├── getting_started.md
333
+ ├── configuration.md
334
+ └── ci_integration.md
234
335
  ```
235
336
 
236
337
  ---
@@ -240,11 +341,18 @@ docs_site/
240
341
  ### Adding Custom Checks
241
342
 
242
343
  ```ruby
243
- module RailsA11y
344
+ module RailsAccessibilityTesting
244
345
  module Checks
245
346
  class CustomCheck < BaseCheck
347
+ def self.rule_name
348
+ :custom_check
349
+ end
350
+
246
351
  def check
352
+ violations = []
247
353
  # Implementation
354
+ # Access to page, context, and partial detection methods
355
+ violations
248
356
  end
249
357
  end
250
358
  end
@@ -254,10 +362,11 @@ end
254
362
  ### Custom Error Formatters
255
363
 
256
364
  ```ruby
257
- module RailsA11y
258
- module Errors
259
- class CustomFormatter < ViolationFormatter
365
+ module RailsAccessibilityTesting
366
+ class CustomFormatter
367
+ def format(violation)
260
368
  # Custom formatting logic
369
+ # Access to violation.element_context, violation.page_context
261
370
  end
262
371
  end
263
372
  end
@@ -281,10 +390,14 @@ ci:
281
390
  ## Performance Considerations
282
391
 
283
392
  1. **Lazy Loading**: Checks loaded only when needed
284
- 2. **Caching**: View file detection cached
285
- 3. **Parallel Execution**: Checks can run in parallel (future)
286
- 4. **Selective Execution**: Only run checks for changed files (existing feature)
287
- 5. **Configurable Depth**: Expensive checks behind flags
393
+ 2. **Caching**:
394
+ - View file detection cached (implicit)
395
+ - **Page scanning cache** (NEW in 1.5.0): Prevents duplicate scans
396
+ 3. **Selective Execution**:
397
+ - Only run checks for changed files (existing feature)
398
+ - **Smart change detection** (enhanced in 1.5.0)
399
+ 4. **Configurable Depth**: Expensive checks behind flags (color contrast)
400
+ 5. **Parallel Execution**: Checks can run in parallel (future)
288
401
 
289
402
  ---
290
403
 
@@ -294,6 +407,34 @@ ci:
294
407
  2. **Integration Tests**: Full Rails app with RSpec/Minitest
295
408
  3. **CLI Tests**: Test CLI against real Rails routes
296
409
  4. **Documentation Tests**: Ensure examples work
410
+ 5. **Performance Tests**: Verify caching and change detection work correctly
411
+
412
+ ---
413
+
414
+ ## Version 1.5.0 Highlights
415
+
416
+ ### New Components
417
+
418
+ 1. **PartialDetection Module**: Reusable partial detection logic
419
+ 2. **Page Scanning Cache**: Module-level cache for scanned pages
420
+ 3. **Enhanced ChangeDetector**: Asset change detection and smart partial impact analysis
421
+ 4. **Improved View File Detection**: Fuzzy matching and controller directory scanning
422
+ 5. **Rails Server Safe Wrapper**: Prevents Foreman from terminating processes
423
+
424
+ ### Enhanced Components
425
+
426
+ 1. **BaseCheck**: Now includes PartialDetection for better file location
427
+ 2. **AccessibilityHelper**: Includes page cache and partial detection
428
+ 3. **ErrorMessageBuilder**: Shows partial files in error messages
429
+ 4. **Generator Templates**: Dynamic route discovery and first-run logic
430
+ 5. **ChangeDetector**: Asset detection and improved partial impact analysis
431
+
432
+ ### Performance Improvements
433
+
434
+ 1. **Page Scanning Cache**: Eliminates duplicate scans
435
+ 2. **Smart Change Detection**: Only tests affected pages
436
+ 3. **First-Run Optimization**: Faster initial setup
437
+ 4. **Reduced Wait Times**: Faster Capybara operations
297
438
 
298
439
  ---
299
440
 
@@ -304,4 +445,22 @@ ci:
304
445
  3. **Performance Monitoring**: Track check performance
305
446
  4. **IDE Integration**: VS Code/IntelliJ plugins
306
447
  5. **CI/CD Templates**: Pre-built GitHub Actions, CircleCI configs
448
+ 6. **Parallel Check Execution**: Run checks in parallel for faster results
449
+ 7. **Incremental Reports**: Show only new issues since last run
450
+
451
+ ---
452
+
453
+ ## Migration Guide
454
+
455
+ ### From 1.4.x to 1.5.0
456
+
457
+ 1. **No breaking changes**: Fully backward compatible
458
+ 2. **Automatic benefits**: Existing installations get improved view detection automatically
459
+ 3. **Generator update**: Re-run `rails generate rails_a11y:install` to get latest spec template
460
+ 4. **CSV gem**: If using Ruby 3.3+, add `gem 'csv'` to Gemfile (generator handles this)
461
+ 5. **Config update**: `heading_hierarchy` renamed to `heading` in config (backward compatible)
462
+
463
+ ---
307
464
 
465
+ **Architecture Version**: 1.5.0
466
+ **Last Updated**: 2025-11-19
data/CHANGELOG.md CHANGED
@@ -5,6 +5,123 @@ 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.5.0] - 2025-11-19
9
+
10
+ ### 🎉 Major Release: Enhanced View Detection & Performance Optimizations
11
+
12
+ This release introduces significant improvements to view file detection, partial scanning, performance optimizations, and developer experience enhancements.
13
+
14
+ ### Added
15
+
16
+ #### Smart View File Detection
17
+ - **Intelligent view file matching**: Automatically detects view files even when action names don't match view file names (e.g., `search` action → `search_result.html.erb`)
18
+ - **Controller directory scanning**: Scans all view files in controller directories to find matching templates
19
+ - **Fuzzy matching**: Prefers files that start with the action name, handles variations like `search_result`, `search_results`, etc.
20
+ - **Single view fallback**: If a controller has only one view file, automatically uses it (useful for single-action controllers)
21
+
22
+ #### Advanced Partial Detection System
23
+ - **Automatic partial discovery**: Scans view files to detect all rendered partials using multiple pattern matching
24
+ - **Partial location detection**: Finds partials in controller directories, `shared/`, and `layouts/` directories
25
+ - **Namespaced partial support**: Handles partials with paths like `layouts/navbar` or `shared/forms/input`
26
+ - **Element-to-partial mapping**: When an accessibility issue is found, automatically determines if it's in a partial and shows the correct file path
27
+ - **Multiple render pattern support**: Detects partials rendered via `render 'partial'`, `render partial: 'partial'`, ERB syntax, and more
28
+
29
+ #### Performance Optimizations
30
+ - **Page scanning cache**: Prevents duplicate accessibility scans of the same page during a test run
31
+ - **Smart cache key**: Uses page path (preferred) or URL as cache key for efficient tracking
32
+ - **Silent skip for cached pages**: Already-scanned pages are skipped silently without output
33
+ - **Cache reset helper**: `reset_scanned_pages_cache` method for testing or forced rescans
34
+
35
+ #### Change Detection Enhancements
36
+ - **First-run detection**: Automatically tests all pages on first run, then only changed files on subsequent runs
37
+ - **Marker file system**: Creates `.rails_a11y_initialized` marker file to track first run status
38
+ - **Asset change detection**: Now detects changes in CSS (`app/assets/`) and JavaScript (`app/javascript/`) files
39
+ - **Smart partial impact analysis**: When a partial changes, only tests pages that actually render that partial
40
+ - **Layout vs partial distinction**: Main layout files trigger full retest, while specific partials only affect pages that use them
41
+ - **Improved route-to-view mapping**: Better handling of routes with `GET|POST` verbs and complex route parameters
42
+
43
+ #### Enhanced Error Reporting
44
+ - **Accurate view file paths**: Error messages now show the exact view file or partial where issues occur
45
+ - **Partial context in errors**: When an issue is in a partial, the error message shows both the partial file and the parent view
46
+ - **Better route recognition**: Improved mapping of URLs to view files using Rails route recognition
47
+ - **View file detection fallbacks**: Multiple fallback strategies ensure view files are found even in edge cases
48
+
49
+ #### Developer Experience Improvements
50
+ - **Friendly test summaries**: Enhanced summary output with passed/failed/skipped counts and reasons
51
+ - **Progress indicators**: Real-time progress feedback during accessibility checks
52
+ - **Suppressed verbose output**: Cleaner test output with less noise from skipped tests
53
+ - **Timestamp formatting**: Human-readable timestamps (HH:MM:SS) in reports instead of full dates
54
+ - **CSV warning suppression**: Automatic suppression of Ruby 3.3+ CSV deprecation warnings
55
+ - **Better skip reasons**: Clear explanations for why tests are skipped (authentication required, page not found, etc.)
56
+
57
+ #### Generator Enhancements
58
+ - **Dynamic route discovery**: Generated `all_pages_accessibility_spec.rb` now dynamically discovers all GET routes at runtime
59
+ - **Generic spec template**: Works for any Rails app without project-specific customization
60
+ - **Smart Procfile.dev integration**: Automatically updates `Procfile.dev` with `rails_server_safe` for safe server management
61
+ - **Conditional test execution**: Only runs tests when relevant files have changed
62
+ - **First-run logic**: Ensures all pages are tested on initial run, then optimizes for subsequent runs
63
+
64
+ #### Infrastructure Improvements
65
+ - **Rails server safe wrapper**: New `rails_server_safe` executable prevents Foreman from terminating all processes when server is already running
66
+ - **Improved Procfile.dev command**: More robust `a11y` command with better error handling and output filtering
67
+ - **Better RSpec integration**: Enhanced `after(:suite)` hooks for comprehensive test summaries
68
+ - **FactoryBot compatibility**: Conditional FactoryBot inclusion to prevent errors when not present
69
+
70
+ ### Changed
71
+
72
+ #### Heading Check Improvements
73
+ - **Renamed to `HeadingCheck`**: More comprehensive check covering all WCAG 2.1 AA heading requirements
74
+ - **Multiple h1 detection**: Now correctly detects and reports multiple `<h1>` tags as errors (not warnings)
75
+ - **Comprehensive heading validation**: Checks for missing h1, skipped heading levels, empty headings, and headings with images without alt text
76
+ - **Better error messages**: More specific remediation steps for different heading hierarchy issues
77
+
78
+ #### Skip Link Detection
79
+ - **Enhanced pattern matching**: Detects skip links using multiple patterns (`skip-link`, `skiplink`, `href="#main"`, `href="#maincontent"`, etc.)
80
+ - **Flexible selector support**: Works with various CSS classes and ID patterns commonly used for skip links
81
+
82
+ #### Accessible Name Detection
83
+ - **Image alt text in links**: Links containing images now properly use the image's alt text as the accessible name
84
+ - **Better ARIA label handling**: Improved detection of accessible names via `aria-label` and `aria-labelledby`
85
+
86
+ #### Error Message Formatting
87
+ - **Unified output format**: Consistent error and warning formatting with timestamps and context
88
+ - **Centralized reporting**: Errors shown first, then warnings, then success messages
89
+ - **Removed confusing messages**: Eliminated "passed with warnings" message for clearer output
90
+
91
+ ### Fixed
92
+
93
+ - **View file detection for `/items/search`**: Fixed issue where routes like `/items/search` (action: `search`, view: `search_result.html.erb`) weren't being detected
94
+ - **Partial detection in layouts**: Fixed issue where partials in `layouts/` directory weren't being properly detected
95
+ - **Change detection false positives**: Fixed issue where changing one partial was marking too many pages as affected
96
+ - **Route parameter handling**: Better handling of routes with `GET|POST` verbs and multiple parameters
97
+ - **CSV warnings in test environment**: Suppressed Ruby 3.3+ CSV deprecation warnings in both application and test environments
98
+ - **Test result tracking**: Fixed issue where tests were showing "all passed" even when errors were present
99
+ - **RSpec hook syntax**: Fixed `NoMethodError` with `RSpec.after(:suite)` by using correct `RSpec.configure` syntax
100
+ - **FactoryBot loading**: Fixed `NameError` when FactoryBot is not present in the project
101
+
102
+ ### Improved
103
+
104
+ - **Test execution speed**: Removed unnecessary `sleep` calls and reduced Capybara wait times
105
+ - **Output readability**: Better formatting, emojis, and visual hierarchy in test output
106
+ - **Documentation**: Comprehensive updates to README, ARCHITECTURE, and guides
107
+ - **Code organization**: Better separation of concerns with `PartialDetection` module
108
+ - **Error handling**: More robust error handling throughout the codebase
109
+
110
+ ### Technical Details
111
+
112
+ - **New module**: `AccessibilityHelper::PartialDetection` for reusable partial detection logic
113
+ - **Enhanced `BaseCheck`**: Now includes partial detection methods for better view file identification
114
+ - **Cache mechanism**: Module-level `@scanned_pages` hash for efficient page tracking
115
+ - **Improved `ChangeDetector`**: Enhanced logic for detecting file changes and their impact on pages
116
+ - **Better route recognition**: Uses `Rails.application.routes.recognize_path` for accurate route-to-view mapping
117
+
118
+ ### Migration Notes
119
+
120
+ - **No breaking changes**: This release is fully backward compatible
121
+ - **Automatic upgrades**: Existing installations will automatically benefit from improved view detection
122
+ - **Generator updates**: Re-running `rails generate rails_a11y:install` will update to the latest spec template
123
+ - **CSV gem**: If using Ruby 3.3+, explicitly add `gem 'csv'` to your Gemfile (generator handles this)
124
+
8
125
  ## [1.4.3] - 2025-11-19
9
126
 
10
127
  ### Added
@@ -184,6 +301,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
184
301
  - Compatible with RSpec Rails 6.0+
185
302
  - Modular architecture with rule engine and check definitions
186
303
 
304
+ [1.5.0]: https://github.com/rayraycodes/rails-accessibility-testing/releases/tag/v1.5.0
187
305
  [1.4.3]: https://github.com/rayraycodes/rails-accessibility-testing/releases/tag/v1.4.3
188
306
  [1.4.2]: https://github.com/rayraycodes/rails-accessibility-testing/releases/tag/v1.4.2
189
307
  [1.4.1]: https://github.com/rayraycodes/rails-accessibility-testing/releases/tag/v1.4.1