Module: AxeCuprite

Defined in:
lib/axe/cuprite.rb,
lib/axe/cuprite/rspec.rb,
lib/axe/cuprite/errors.rb,
lib/axe/cuprite/runner.rb,
lib/axe/cuprite/results.rb,
lib/axe/cuprite/version.rb,
lib/axe/cuprite/injector.rb,
lib/axe/cuprite/normalize.rb,
lib/axe/cuprite/configuration.rb,
lib/axe/cuprite/rspec/matchers.rb

Overview

axe-cuprite drives the axe-core accessibility engine through Capybara’s driver-neutral JavaScript API, so it works with Cuprite (Ferrum/CDP) and any other real-browser Capybara driver — without ever touching Selenium internals.

Quick start:

require "axe/cuprite"
require "axe/cuprite/rspec"   # in a spec_helper, to load the matchers

expect(page).to be_axe_clean.checking_only(:color_contrast)

Defined Under Namespace

Modules: Normalize, RSpec Classes: AxeRunError, Configuration, ContrastData, Error, InjectionError, Injector, Node, Results, Runner, TimeoutError, Violation

Constant Summary collapse

VERSION =

Version of the axe-cuprite gem itself.

"0.1.0"
AXE_CORE_VERSION =

Version of the axe-core engine vendored under lib/axe/cuprite/vendor/axe.min.js. Keep this in sync with the vendored file via ‘rake axe:update`.

"4.12.0"

Class Method Summary collapse

Class Method Details

.axe_pathObject

Path to the vendored axe-core JavaScript engine.



45
46
47
# File 'lib/axe/cuprite.rb', line 45

def axe_path
  File.expand_path("cuprite/vendor/axe.min.js", __dir__)
end

.axe_sourceObject

The cached source of the vendored axe-core engine.



50
51
52
# File 'lib/axe/cuprite.rb', line 50

def axe_source
  @axe_source ||= File.read(axe_path)
end

.configurationObject

The global configuration object. See AxeCuprite::Configuration.



24
25
26
# File 'lib/axe/cuprite.rb', line 24

def configuration
  @configuration ||= Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Configure axe-cuprite:

AxeCuprite.configure do |c|
  c.timeout = 30
  c.report_only = true
end

Yields:



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

def configure
  yield configuration if block_given?
  configuration
end

.reset_configuration!Object

Reset configuration to defaults (mainly useful in tests).



40
41
42
# File 'lib/axe/cuprite.rb', line 40

def reset_configuration!
  @configuration = Configuration.new
end