Instrucciones para Playwright Test y TypeScript
Configurando tus pruebas con Playwright Test y TypeScript
Not for use with personal data
-
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
-
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 }
-
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';
-
Ya está todo listo.