Axe Core
オープンソースのアクセシビリティツールであるDequeのAxeを使用して、WebdriverIOテストスイートにアクセシビリティテストを含めることができます。設定は非常に簡単で、必要なのはWebdriverIO Axeアダプターを以下のようにインストールすることだけです。
- npm
- Yarn
- pnpm
npm install -g @axe-core/webdriverio
yarn global add @axe-core/webdriverio
pnpm add -g @axe-core/webdriverio
Axeアダプターは、スタンドアロンまたはテストランナーモードで、ブラウザオブジェクトを使用してインポートして初期化することで使用できます。例:
import { browser } from '@wdio/globals'
import AxeBuilder from '@axe-core/webdriverio'
describe('Accessibility Test', () => {
it('should get the accessibility results from a page', async () => {
const builder = new AxeBuilder({ client: browser })
await browser.url('https://testingbot.com')
const result = await builder.analyze()
console.log('Acessibility Results:', result)
})
})
Axe WebdriverIOアダプターに関する詳細なドキュメントは、GitHubにあります。