WebdriverIO TestrunnerおよびTypeScriptのための手順

This page is not available in the language you requested. You have been redirected to the English version of the page.
Link to this page copied to clipboard

WebdriverIO TestrunnerとTypeScriptでテストを設定する

Not for use with personal data
  1. テストフォルダのルートレベルに、 @axe-core/watcher パッケージとそのすべての依存関係をインストールします。 npm またはお好みのパッケージマネージャを使用します(例: yarn または pnpm)。

    npm install --save-dev @axe-core/watcher
  2. ファイルで、 wdio.config.ts 関数、 wdioTestRunner() 関数、および wrapWdio() クラスをインポートしてください。 WdioController : @axe-core/watcher/wdioあなたのWebdriverIO設定をエクスポートする前に、

    import {
      wdioTestRunner,
      wrapWdio,
      WdioController
    } from '@axe-core/watcher/wdio'
  3. を呼び出して、それにAPIキーを提供してください: wdioTestRunner() テスト設定コード内(通常は

    // Original code:
    
    export const config = {
      // Your config options here...
    }
    
    // Becomes:
    
    const ACCESSIBILITY_API_KEY = process.env.ACCESSIBILITY_API_KEY
    const PROJECT_ID = process.env.PROJECT_ID
    
    export const config = wdioTestRunner({
      axe: {
        apiKey: ACCESSIBILITY_API_KEY,
        projectId: PROJECT_ID
      }, {
        // Your config options here...
      }
    })

    環境に ACCESSIBILITY_API_KEYPROJECT_ID を設定し、あなたの個人的なAPIキーに設定してください(Axeアカウントの API KEYS タブで見つけられます)、およびプロジェクトID(プロジェクトを作成した際のこれらの説明の上部に示されています。または、プロジェクトページで プロジェクトを設定 を選択し、 設定から確認できます)。

  4. または before ブロックで)、 beforeAll クラスのインスタンスを作成し、その後 WdioController オブジェクトをラップしてください: browser 最後に、すべてのaxe Watcherのテスト結果が出力されていることを確認してください。そのためには、次のコードブロックをテストの終了処理コード(通常は

    const controller = new WdioController(browser)
    wrapWdio(browser, controller)
  5. ブロックで)に追加してください: afterFetch block):

    afterEach(async () => {
      await controller.flush()
    })