Class: AxeCuprite::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/axe/cuprite/configuration.rb

Overview

Global configuration for axe-cuprite. Accessed via AxeCuprite.configure.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



37
38
39
40
41
42
43
44
45
# File 'lib/axe/cuprite/configuration.rb', line 37

def initialize
  @timeout         = 30
  @default_options = {}
  @default_tags    = []
  @skip_rules      = []
  @auto_inject     = true
  @report_only     = false
  @logger          = default_logger
end

Instance Attribute Details

#auto_injectObject

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_optionsObject

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
  @default_options
end

#default_tagsObject

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
  @default_tags
end

#loggerObject

Logger used for report_only output and warnings.



35
36
37
# File 'lib/axe/cuprite/configuration.rb', line 35

def logger
  @logger
end

#report_onlyObject

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_rulesObject

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

#timeoutObject

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