Istruzioni per Playwright Test e JavaScript
Configurazione dei test con Playwright Test e JavaScript
Not for use with personal data
-
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
-
Crea un file fixtures.js insieme ai tuoi test Playwright Test esistenti. In questo file, importa la funzione Playwright Test da @axe-core/watcher:
const { playwrightTest } = require('@axe-core/watcher') const API_KEY = process.env.API_KEY module.exports = playwrightTest({ axe: { apiKey: API_KEY }, headless: false, // Any other Playwright configuration you’d pass to chromium.launchPersistentContext() here })
-
Nei file di test, sostituisci le importazioni per test e expect da Playwright Test con il tuo file fixtures.js :
const { test, expect } = require('@playwright/test') // Becomes: const { test, expect } = require('./fixtures')
-
Hai terminato.