-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
68 lines (66 loc) · 2.09 KB
/
Copy pathplaywright.config.ts
File metadata and controls
68 lines (66 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import { tmpdir } from "node:os";
import { join } from "node:path";
import { defineConfig } from "@playwright/test";
/**
* El puerto del servidor de pruebas.
*
* Fijo por omisión para que la orden sea siempre la misma, pero configurable:
* un `vite preview` olvidado en 4173 —o cualquier otra cosa escuchando ahí—
* dejaba la suite sin poder arrancar, y matar procesos ajenos para correr unas
* pruebas no es una opción.
*/
const port = Number(process.env.VINDEXA_E2E_PORT ?? 4173);
export default defineConfig({
testDir: "./tests/e2e",
testMatch: "**/*.spec.ts",
fullyParallel: false,
forbidOnly: Boolean(process.env.CI),
retries: 0,
// Un único cliente evita que la optimización bajo demanda de un chunk lazy recargue otro test.
workers: 1,
timeout: 30_000,
expect: {
timeout: 6_000,
toHaveScreenshot: {
animations: "disabled",
caret: "hide",
maxDiffPixelRatio: 0.003,
scale: "css",
},
},
reporter: process.env.CI
? [
["line"],
["html", { open: "never", outputFolder: join(tmpdir(), "vindexa-playwright-report") }],
]
: [
["list"],
["html", { open: "never", outputFolder: join(tmpdir(), "vindexa-playwright-report") }],
],
outputDir: join(tmpdir(), "vindexa-playwright-results"),
snapshotPathTemplate: "{testDir}/__screenshots__/{arg}{ext}",
use: {
baseURL: `http://127.0.0.1:${port}`,
browserName: "chromium",
colorScheme: "dark",
deviceScaleFactor: 1,
hasTouch: false,
isMobile: false,
locale: "es-ES",
timezoneId: "Atlantic/Canary",
trace: "retain-on-failure",
viewport: { width: 1440, height: 900 },
screenshot: "only-on-failure",
video: "retain-on-failure",
},
webServer: {
command: `pnpm exec vite --host 127.0.0.1 --port ${port}`,
url: `http://127.0.0.1:${port}`,
// Cada ejecución posee su servidor; reutilizar uno que otra suite está cerrando produce flakes.
reuseExistingServer: false,
timeout: 120_000,
stdout: "pipe",
stderr: "pipe",
},
projects: [{ name: "chromium", use: { browserName: "chromium" } }],
});