dequelabs / axe-webdriverjs

Provides a chainable axe API for Selenium's WebDriverJS and automatically injects into all frames.
Mozilla Public License 2.0
130 stars 46 forks source link

Make axe-core a peer dependency #119

Closed liron-navon closed 5 years ago

liron-navon commented 5 years ago

I'm using axe-webdriverjs for automated e2e tests, but I also use the axe-chrome extension - each comes with a different version of axe-core which produces different errors.

axe-webdriverjs uses axe-core 3.3 (^3.1.2) axe chrome extention uses axe 3.2

It would be great if axe-core would have been a peer dependency so I could give it the same version as I have in other axe tools.

stephenmathieson commented 5 years ago

Making axe-core a peer dependency here would break the "most common" usage of this package and would require a major version bump. I do not think this should happen right now.

Instead, you can provide your own copy of axe-core to the AxeBuilder constructor. This looks something like:

var fs = require('fs')
var AxeBuilder = require('axe-webdriverjs')
var WebDriver = require('selenium-webdriver');

var axeSource = fs.readFileSync('./path/to/your/axe.js', 'utf-8')

var driver = new WebDriver.Builder()
  .forBrowser('firefox')
  .build();

var axe = new AxeBuilder(driver, axeSource)
axe.analyze(...)