Files
Aniworld/playwright.config.js
Lukas aceaba5849 feat: Set up JavaScript testing framework (Vitest + Playwright)
- Created package.json with Vitest and Playwright dependencies
- Configured vitest.config.js with happy-dom environment
- Configured playwright.config.js with Chromium browser
- Created test directory structure (tests/frontend/unit and e2e)
- Added setup.test.js with 10 Vitest validation tests
- Added setup.spec.js with 6 Playwright E2E validation tests
- Created FRONTEND_SETUP.md with Node.js installation guide
- Updated instructions.md marking task complete

Note: Requires Node.js installation before running tests
2026-02-01 09:37:55 +01:00

89 lines
2.1 KiB
JavaScript

import { defineConfig, devices } from '@playwright/test';
/**
* Playwright configuration for E2E tests
* @see https://playwright.dev/docs/test-configuration
*/
export default defineConfig({
// Test directory
testDir: './tests/frontend/e2e',
// Maximum time one test can run for
timeout: 30 * 1000,
// Run tests in parallel
fullyParallel: true,
// Fail the build on CI if you accidentally left test.only in the source code
forbidOnly: !!process.env.CI,
// Retry on CI only
retries: process.env.CI ? 2 : 0,
// Opt out of parallel tests on CI
workers: process.env.CI ? 1 : undefined,
// Reporter to use
reporter: [
['html', { outputFolder: 'playwright-report' }],
['list']
],
// Shared settings for all the projects below
use: {
// Base URL to use in actions like `await page.goto('/')`
baseURL: 'http://127.0.0.1:8000',
// Collect trace when retrying the failed test
trace: 'on-first-retry',
// Screenshot on failure
screenshot: 'only-on-failure',
// Video on failure
video: 'retain-on-failure',
// Action timeout
actionTimeout: 10 * 1000,
// Navigation timeout
navigationTimeout: 30 * 1000
},
// Configure projects for major browsers
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
// Uncomment for cross-browser testing
// {
// name: 'firefox',
// use: { ...devices['Desktop Firefox'] },
// },
// {
// name: 'webkit',
// use: { ...devices['Desktop Safari'] },
// },
// Mobile viewports
// {
// name: 'Mobile Chrome',
// use: { ...devices['Pixel 5'] },
// },
// {
// name: 'Mobile Safari',
// use: { ...devices['iPhone 12'] },
// },
],
// Run your local dev server before starting the tests
webServer: {
command: 'conda run -n AniWorld python -m uvicorn src.server.fastapi_app:app --host 127.0.0.1 --port 8000',
url: 'http://127.0.0.1:8000',
reuseExistingServer: !process.env.CI,
timeout: 120 * 1000,
},
});