-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
70 lines (56 loc) · 1.94 KB
/
playwright.config.ts
File metadata and controls
70 lines (56 loc) · 1.94 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
69
70
import { defineConfig, devices } from "@playwright/test";
import dotenv from "dotenv";
import { existsSync } from "node:fs";
import path from "node:path";
const configDir = path.resolve(__dirname);
const envPath = path.resolve(configDir, ".env.test");
if (existsSync(envPath)) {
dotenv.config({ path: envPath, override: true });
} else {
console.warn("Playwright could not locate .env.test in the project root.");
}
/**
* Konfiguracja Playwright dla testów E2E
* Dokumentacja: https://playwright.dev/docs/test-configuration
*/
export default defineConfig({
testDir: "./e2e",
timeout: 3 * 60 * 1000,
// Uruchamiaj testy sekwencyjnie na początku (łatwiej debugować)
// Zmień na true gdy będziesz mieć dużo testów i będą stabilne
fullyParallel: false,
// Fail jeśli zostawisz test.only (tylko w CI)
forbidOnly: !!process.env.CI,
// Retry tylko w CI (lokalnie lepiej od razu widzieć błędy)
retries: process.env.CI ? 2 : 0,
// Jeden worker lokalnie = łatwiej debugować
// W CI też jeden dla stabilności
workers: 1,
// Reportery: HTML (po testach) i list (w terminalu)
reporter: [["html"], ["list"]],
use: {
// Możesz pisać page.goto('/') zamiast pełnego URL
baseURL: "http://localhost:3000",
// Zbieraj trace tylko przy pierwszym retry, żeby ograniczyć narzut
trace: "on-first-retry",
// Screenshot przy błędach
screenshot: "only-on-failure",
// Bez wideo - screenshoty wystarczą na początku
// (wideo zajmuje dużo miejsca)
video: "off",
},
projects: [
{
name: "chromium",
use: { ...devices["Desktop Chrome"] },
},
],
globalTeardown: require.resolve("./e2e/global.teardown.ts"),
// Automatycznie uruchamia dev server przed testami
webServer: {
command: "npm run dev",
url: "http://localhost:3000",
reuseExistingServer: !process.env.CI, // Użyj istniejącego serwera lokalnie, uruchom nowy w CI
timeout: 120 * 1000,
},
});