Class: AxeCuprite::Configuration
- Inherits:
-
Object
- Object
- AxeCuprite::Configuration
- Defined in:
- lib/axe/cuprite/configuration.rb
Overview
Global configuration for axe-cuprite. Accessed via AxeCuprite.configure.
Instance Attribute Summary collapse
-
#auto_inject ⇒ Object
When true, axe is (re)injected on every #run if missing.
-
#default_options ⇒ Object
Default axe run options merged into every run (e.g. { resultTypes: […] }).
-
#default_tags ⇒ Object
Default axe tags applied when no explicit rule/tag scoping is given, e.g.
-
#include_html ⇒ Object
When true (default), failure messages and report_only logs include a truncated outer-HTML snippet of each offending element.
-
#logger ⇒ Object
Logger used for report_only output and warnings.
-
#report_only ⇒ Object
When true, the matcher logs violations instead of failing the example.
-
#skip_rules ⇒ Object
Global list of rule ids (or symbols) to disable on every run, e.g.
-
#timeout ⇒ Object
Maximum time (seconds) to wait for axe.run to resolve.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/axe/cuprite/configuration.rb', line 44 def initialize @timeout = 30 @default_options = {} @default_tags = [] @skip_rules = [] @auto_inject = true @report_only = false @include_html = true @logger = default_logger end |
Instance Attribute Details
#auto_inject ⇒ Object
When true, axe is (re)injected on every #run if missing. Injection is always idempotent (guarded on ‘typeof window.axe`), so this mainly controls whether a stale axe (after navigation) is re-injected.
28 29 30 |
# File 'lib/axe/cuprite/configuration.rb', line 28 def auto_inject @auto_inject end |
#default_options ⇒ Object
Default axe run options merged into every run (e.g. { resultTypes: […] }). Caller / matcher options are deep-merged on top of these.
15 16 17 |
# File 'lib/axe/cuprite/configuration.rb', line 15 def @default_options end |
#default_tags ⇒ Object
Default axe tags applied when no explicit rule/tag scoping is given, e.g. [“wcag2a”, “wcag2aa”]. Empty means “run all default rules”.
19 20 21 |
# File 'lib/axe/cuprite/configuration.rb', line 19 def @default_tags end |
#include_html ⇒ Object
When true (default), failure messages and report_only logs include a truncated outer-HTML snippet of each offending element. Set to false to suppress those snippets (rule id + selector + check message only) on suites that render sensitive data, so page content can’t leak into CI logs. See BeAxeClean#format_node.
42 43 44 |
# File 'lib/axe/cuprite/configuration.rb', line 42 def include_html @include_html end |
#logger ⇒ Object
Logger used for report_only output and warnings.
35 36 37 |
# File 'lib/axe/cuprite/configuration.rb', line 35 def logger @logger end |
#report_only ⇒ Object
When true, the matcher logs violations instead of failing the example. Eases incremental adoption on an existing app.
32 33 34 |
# File 'lib/axe/cuprite/configuration.rb', line 32 def report_only @report_only end |
#skip_rules ⇒ Object
Global list of rule ids (or symbols) to disable on every run, e.g. [:color_contrast, “region”]. Normalized underscores -> hyphens.
23 24 25 |
# File 'lib/axe/cuprite/configuration.rb', line 23 def skip_rules @skip_rules end |
#timeout ⇒ Object
Maximum time (seconds) to wait for axe.run to resolve. This is decoupled from Capybara.default_max_wait_time — see Injector. Default 30s because axe.run on a large page routinely exceeds Capybara’s 2s default.
11 12 13 |
# File 'lib/axe/cuprite/configuration.rb', line 11 def timeout @timeout end |