-
-
Notifications
You must be signed in to change notification settings - Fork 96
/
Copy pathplaywright.config.ts
50 lines (44 loc) · 1.33 KB
/
playwright.config.ts
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
import { PlaywrightTestConfig, defineConfig, devices } from '@playwright/test';
import path from 'path';
import fs from 'fs';
// Ensure output directories exist
const outputFolder = path.join(process.cwd(), 'playwright-report');
const testResults = path.join(process.cwd(), 'test-results');
// Create directories if they don't exist
[outputFolder, testResults].forEach(dir => {
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir, { recursive: true });
}
});
export default defineConfig ({
testDir: './tests',
use: {
baseURL: 'http://localhost:1313',
screenshot: 'on',
trace: 'retain-on-failure',
video: 'on',
},
// Run all tests in parallel.
fullyParallel: true,
// Fail the build on CI if you accidentally left test.only in the source code.
forbidOnly: !!process.env.CI,
reporter:
process.env.CI ?
[
['github'],
['html', { outputFolder }],
['list']
] :
[
['html', { outputFolder }],
['list']
]
,
outputDir: testResults,
webServer: {
command: 'cd exampleSite && hugo server --themesDir ../.. --buildDrafts --buildFuture --bind 0.0.0.0',
url: 'http://localhost:1313',
reuseExistingServer: true,
},
preserveOutput: 'always',
});