@a11ycore/selenium 中文文档教程
@a11ycore/selenium
为 aXe 用于测试可访问性
⚠️✋ This project does not guarantee what you build is accessible.
GDS 可访问性团队发现只有 ~30% 的问题是通过自动化测试发现的。
Installation:
npm install --save-dev @a11ycore/selenium
Usage:
const { Builder } = require('selenium-webdriver');
const { runA11ySelenium } = require('@a11ycore/selenium');
describe("test runA11ySelenium", () => {
let driver;
beforeAll(async() => {
driver = await new Builder().forBrowser('chrome').build();
});
afterAll(() => {
driver.quit();
})
it('should test accessibility', async () => {
await driver.get('http://www.google.com/ncr');
const results = await runA11ySelenium(driver, {});
expect(typeof results).toBe('object');
expect(Array.isArray(results.inapplicable)).toBe(true);
expect(Array.isArray(results.violations)).toBe(true);
expect(results.testRunner.name).toEqual('axe');
});
});
请参阅开发 Axe-core 规则以获取有关如何开发自定义规则的说明规则和检查。
Thanks
- aXe for the wonderful axe-core that makes it so easy to do this.
- Government Digital Service for making coding in the open the default.
- GOV.UK Publishing Frontend team who published the basis of the aXe reporter
@a11ycore/selenium
Custom [Selenium] runner matcher for aXe for testing accessibility
⚠️✋ This project does not guarantee what you build is accessible.
The GDS Accessibility team found that only ~30% of issues are found by automated testing.
Installation:
npm install --save-dev @a11ycore/selenium
Usage:
const { Builder } = require('selenium-webdriver');
const { runA11ySelenium } = require('@a11ycore/selenium');
describe("test runA11ySelenium", () => {
let driver;
beforeAll(async() => {
driver = await new Builder().forBrowser('chrome').build();
});
afterAll(() => {
driver.quit();
})
it('should test accessibility', async () => {
await driver.get('http://www.google.com/ncr');
const results = await runA11ySelenium(driver, {});
expect(typeof results).toBe('object');
expect(Array.isArray(results.inapplicable)).toBe(true);
expect(Array.isArray(results.violations)).toBe(true);
expect(results.testRunner.name).toEqual('axe');
});
});
Refer to Developing Axe-core Rules for instructions on how to develop custom rules and checks.
Thanks
- aXe for the wonderful axe-core that makes it so easy to do this.
- Government Digital Service for making coding in the open the default.
- GOV.UK Publishing Frontend team who published the basis of the aXe reporter