forked from galette/galette
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
89 lines (77 loc) · 2.69 KB
/
Copy pathplaywright.config.ts
File metadata and controls
89 lines (77 loc) · 2.69 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/**
* This file is part of Galette (https://galette.eu).
* SPDX-FileCopyrightText: Copyright © 2003-2026 The Galette Team
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { defineConfig, devices } from '@playwright/test';
import { config } from 'dotenv' ;
// Load .env file so it is available everywhere.
config({path: './tests/e2e/.env.local', quiet: true});
config({path: './tests/e2e/.env', quiet: true});
/**
* Playwright configuration file
*
* See:
* - https://playwright.dev/docs/test-configuration.
* - https://playwright.dev/docs/api/class-testconfig
*/
export default defineConfig({
// Directory that will be recursively scanned for test files.
// See: https://playwright.dev/docs/api/class-testconfig#test-config-test-dir
// /!\ Playwright will fail with "no tests files" if a directory, like `galette/data/cache` is not readable /!/
testDir: '.',
// Run tests in files in parallel
// See: https://playwright.dev/docs/api/class-testconfig#test-config-fully-parallel
fullyParallel: true,
// Fail the build on CI if you accidentally left test.only in the source code.
// See: https://playwright.dev/docs/api/class-testconfig#test-config-forbid-only
forbidOnly: !!process.env.CI,
// Report: generated HTML in playwright-report/
reporter: process.env.CI ? [
['html', { open: 'never' }],
['list'],
[
"playwright-ctrf-json-reporter",
{ outputDir: "ctrf", outputFile: "galette.json" },
]
] : [
['html', { open: 'never' }],
['list']
],
use: {
// Priority: --base-url (CLI) > E2E_BASE_URL (env) > default value
baseURL: process.env.E2E_BASE_URL ?? 'http://127.0.0.1:8090',
// Screenshot and trace only on failure
screenshot: 'only-on-failure',
trace: 'retain-on-failure',
// Capture console logs for better debugging on CI
// video: 'on-first-retry',
// Browser lang aligned with default Galette lang
locale: 'fr-FR',
},
projects: [
// ── Core Galette A11y tests ──
{
name: 'a11y',
testMatch: 'tests/e2e/specs/a11y.spec.ts',
use: { ...devices['Desktop Chrome'] },
},
// ── Core Galette tests ──
{
name: 'chromium',
testMatch: 'tests/e2e/specs/**/*.spec.ts',
testIgnore: 'tests/e2e/specs/a11y.spec.ts',
use: { ...devices['Desktop Chrome'] },
},
// ── Plugin tests (discovered via testMatch glob) ──
{
name: 'plugins-chromium',
// Also match plugin specs in tests/plugins when present.
testMatch: [
'galette/plugins/*/tests/e2e/specs/**/*.spec.ts',
'tests/plugins/*/tests/e2e/specs/**/*.spec.ts',
],
use: { ...devices['Desktop Chrome'] },
},
],
});