Skip to content
This repository has been archived by the owner on Nov 18, 2020. It is now read-only.

Latest commit

 

History

History
67 lines (48 loc) · 1.25 KB

README.md

File metadata and controls

67 lines (48 loc) · 1.25 KB

Nightwatch Axe

Circle CI

Nightwatch.js custom commands for aXe.

Install

Install using yarn or npm

yarn add nightwatch-axe

Update your nightwatch config file with new paths to command and assertion files

{
  custom_commands_path : [
    "./node_modules/nightwatch-axe/src/commands"
  ]
}

aXe Commands

axeInject()

Injects the axe-core js library into your test page

export default {
  '@tags': ['accessibility'],

  'Page Is Accessible'(browser) {
    ...
    
    browser.axeInject()
  }
}

axeRun(options)

Analyzes the current page against applied axe rules

Parameter Name Parameter Type Description
selector string css selector to area under test
options object set of axe options
export default {
  '@tags': ['accessibility'],

  'Page Is Accessible'(browser) {
    ...
    
    browser.axeInject()
    browser.axeRun('#main', {
      rules: {
        'color-contrast': { enabled: false }
      }
    })
  }
}