Instructies voor Playwright Test en 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

Uw tests configureren met Playwright Test en TypeScript

Not for use with personal data
  1. Installeer in de hoofdmap van uw testmap het @axe-core/watcher-pakket en al zijn afhankelijkheden met behulp van npm of uw voorkeurs pakketbeheerder (bijvoorbeeld yarn of pnpm).

    npm install --save-dev @axe-core/watcher
  2. Maak een fixtures.ts bestand naast uw bestaande Playwright Test-tests. Importeer in dit bestand de playwrightTest() functie van @axe-core/watcher:

    import { playwrightTest } from '@axe-core/watcher/playwright-test'
    
    const ACCESSIBILITY_API_KEY = process.env.ACCESSIBILITY_API_KEY
    const PROJECT_ID = process.env.PROJECT_ID
    
    const { test, expect } = playwrightTest({
      axe: {
        apiKey: ACCESSIBILITY_API_KEY,
        projectId: PROJECT_ID
      },
      headless: false
      // Any other Playwright configuration you’d pass to chromium.launchPersistentContext() here
    })
    
    export { test, expect }

    Zorg ervoor dat u ACCESSIBILITY_API_KEY en PROJECT_ID in uw omgeving instelt op uw persoonlijke API-sleutel (te vinden in uw Axe-account, tabblad API-SLEUTELS) en uw project-ID (weergegeven bovenaan deze instructies toen u uw project maakte of beschikbaar op de Projecten-pagina door Project configureren te kiezen onder Instellingen).

  3. Vervang in uw testbestanden de imports voor test en expect van Playwright Test door uw fixtures.ts bestand:

    import { test, expect } from '@playwright/test'
    
    // Becomes:
    import { test, expect } from './fixtures';
  4. En dat is alles.