Instrucciones para Playwright Test y 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

Configurando tus pruebas con Playwright Test y TypeScript

Free Trial
Not for use with personal data
  1. En el nivel raíz de su carpeta de pruebas, instale el paquete @axe-core/watcher y todas sus dependencias usando npm o su administrador de paquetes preferido (por ejemplo, Yarn o pnpm).

    npm install --save-dev @axe-core/watcher
  2. Cree un archivo fixtures.ts junto con sus pruebas de Playwright Test existentes. En este archivo, importe la función Playwright Test desde @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. En sus archivos de prueba, reemplace las importaciones de test y expect de Playwright Test con su archivo fixtures.ts :

    import { test, expect } from '@playwright/test'
    
    // Becomes:
    import { test, expect } from './fixtures';
  4. Ya está todo listo.