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

Add usage examples for integrating with browserstack and saucelabs #3

Closed arschmitz closed 9 years ago

arschmitz commented 9 years ago

These are both very popular cross browser testing services so it would make sense to have examples showing their usage.

dylanb commented 9 years ago

@dsturley what was your experience using saucelabs and how much would it take to get this working with sauce?

@arschmitz it would be great if you could help us create a browserstack example

dsturley commented 9 years ago

Sauce at its heart is just a Selenium Server; adapted an integration test:

var WebDriver = require('selenium-webdriver'),
    assert = require('chai').assert,
    AxeBuilder = require('axe-webdriverjs');

describe('sauce-example', function () {
    this.timeout(10000);

    var driver;
    var url = 'https://github.com/dequelabs/axe-webdriverjs';
    before(function (done) {
        driver = new WebDriver.Builder()
            .usingServer('http://ondemand.saucelabs.com:80/wd/hub')
            .withCapabilities({
                browserName: 'Firefox',
                // you must set these environment variables
                username: process.env.SAUCE_USERNAME,
                accessKey: process.env.SAUCE_ACCESS_KEY
            })
            .build();

        driver
            .get(url)
            .then(function () {
                done();
            });
    });

    after(function () {
        driver.quit();
    });

    it('should find violations', function (done) {
        AxeBuilder(driver)
            .analyze(function (results) {
                assert.equal(results.url, url);
                done();
            });
    });

});
arschmitz commented 9 years ago

@dsturley browser stack works exactly the same.

My suggestion was simply to add examples like the one you have here to the documentation