Istruzioni per Playwright Test e JavaScript

Link to Istruzioni per Playwright Test e JavaScript copied to clipboard

Configurazione dei test con Playwright Test e JavaScript

Free Trial
Not for use with personal data
  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.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
    })
  3. 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')
  4. Hai terminato.