QA-1: Playwright e2e harness - config (phone 390px + desktop projects, mock/live via E2E_BASE_URL), npm run e2e, vitest excludes e2e/
This commit is contained in:
4
gerbil-manager-web/.gitignore
vendored
4
gerbil-manager-web/.gitignore
vendored
@@ -22,3 +22,7 @@ dist-ssr
|
|||||||
*.njsproj
|
*.njsproj
|
||||||
*.sln
|
*.sln
|
||||||
*.sw?
|
*.sw?
|
||||||
|
|
||||||
|
# QA-1: Playwright-Artefakte
|
||||||
|
test-results/
|
||||||
|
playwright-report/
|
||||||
|
|||||||
@@ -9,7 +9,8 @@
|
|||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"test": "vitest run",
|
"test": "vitest run",
|
||||||
"test:watch": "vitest"
|
"test:watch": "vitest",
|
||||||
|
"e2e": "playwright test"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"jszip": "^3.10.1",
|
"jszip": "^3.10.1",
|
||||||
|
|||||||
58
gerbil-manager-web/playwright.config.ts
Normal file
58
gerbil-manager-web/playwright.config.ts
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
/**
|
||||||
|
* QA-1: App-weite E2E-Smoke-Suite (Playwright, getrennt von vitest).
|
||||||
|
*
|
||||||
|
* Zwei Betriebsarten:
|
||||||
|
* - MOCK (Standard): startet den Vite-Dev-Server auf :5199 und fängt alle
|
||||||
|
* API-Aufrufe per Route-Interception ab (Fixtures nach DATA-2-Vertrag,
|
||||||
|
* siehe e2e/mock-api.ts). Kein Backend nötig.
|
||||||
|
* - LIVE: `E2E_BASE_URL` zeigt auf das laufende Frontend (z. B. via Aspire
|
||||||
|
* AppHost); es wird NICHT gemockt und kein Dev-Server gestartet.
|
||||||
|
* Fixture-gebundene Tests überspringen sich dann selbst.
|
||||||
|
*
|
||||||
|
* Viewports: Smartphone (390px, mobile-first) und Laptop (1280px) — jede
|
||||||
|
* Spec läuft in beiden Projekten.
|
||||||
|
*/
|
||||||
|
import { defineConfig, devices } from '@playwright/test'
|
||||||
|
|
||||||
|
const LIVE_BASE_URL = process.env.E2E_BASE_URL
|
||||||
|
const MOCK_PORT = 5199
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
testDir: './e2e',
|
||||||
|
fullyParallel: true,
|
||||||
|
forbidOnly: !!process.env.CI,
|
||||||
|
retries: process.env.CI ? 1 : 0,
|
||||||
|
reporter: [['list']],
|
||||||
|
timeout: 30_000,
|
||||||
|
use: {
|
||||||
|
baseURL: LIVE_BASE_URL ?? `http://localhost:${MOCK_PORT}`,
|
||||||
|
locale: 'de-DE',
|
||||||
|
trace: 'retain-on-failure',
|
||||||
|
},
|
||||||
|
projects: [
|
||||||
|
{
|
||||||
|
name: 'phone',
|
||||||
|
use: {
|
||||||
|
...devices['Desktop Chrome'],
|
||||||
|
viewport: { width: 390, height: 844 },
|
||||||
|
deviceScaleFactor: 2,
|
||||||
|
hasTouch: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'desktop',
|
||||||
|
use: {
|
||||||
|
...devices['Desktop Chrome'],
|
||||||
|
viewport: { width: 1280, height: 800 },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
webServer: LIVE_BASE_URL
|
||||||
|
? undefined
|
||||||
|
: {
|
||||||
|
command: `npm run dev -- --port ${MOCK_PORT} --strictPort`,
|
||||||
|
url: `http://localhost:${MOCK_PORT}`,
|
||||||
|
reuseExistingServer: true,
|
||||||
|
timeout: 60_000,
|
||||||
|
},
|
||||||
|
})
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import { defineConfig } from 'vite'
|
import { defineConfig } from 'vite'
|
||||||
|
import { configDefaults } from 'vitest/config'
|
||||||
import react from '@vitejs/plugin-react'
|
import react from '@vitejs/plugin-react'
|
||||||
|
|
||||||
// https://vite.dev/config/
|
// https://vite.dev/config/
|
||||||
@@ -10,4 +11,8 @@ export default defineConfig({
|
|||||||
// the port; this only widens the host from localhost to 0.0.0.0.
|
// the port; this only widens the host from localhost to 0.0.0.0.
|
||||||
host: true,
|
host: true,
|
||||||
},
|
},
|
||||||
|
test: {
|
||||||
|
// QA-1: e2e/ gehört Playwright (npm run e2e), nicht vitest.
|
||||||
|
exclude: [...configDefaults.exclude, 'e2e/**'],
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user