1. Nella radice della cartella di test, installa il pacchetto @axe-core/watcher e tutte le sue dipendenze utilizzando npm o il tuo gestore di pacchetti preferito (ad esempio, Yarn o pnpm).

    npm install --save-dev @axe-core/watcher
  2. Crea un file fixtures.ts insieme ai tuoi test Playwright Test esistenti. In questo file, importa la funzione Playwright Test da @axe-core/watcher:

    import { playwrightTest } from '@axe-core/watcher'
    
    const API_KEY = process.env.API_KEY!
    
    const { test, expect } = playwrightTest({
      axe: {
        apiKey: API_KEY
      },
      headless: false
      // Any other Playwright configuration you’d pass to chromium.launchPersistentContext() here
    })
    
    export { test, expect }
  3. Nei file di test, sostituisci le importazioni per test e expect di Playwright Test con il tuo file fixtures.ts :

    import { test, expect } from '@playwright/test'
    
    // Becomes:
    import { test, expect } from './fixtures';
  4. Hai terminato.