-
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
49 lines (45 loc) · 1.3 KB
/
playwright.config.ts
File metadata and controls
49 lines (45 loc) · 1.3 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
import type { PlaywrightTestConfig } from '@playwright/test';
import { randomBytes } from 'crypto';
const signingSecret = randomBytes(32).toString('hex');
if (!process.env.AUTH0_SECRET) {
process.env.AUTH0_SECRET = signingSecret;
}
const config: PlaywrightTestConfig = {
webServer: {
// With more elaborate tests stg-tunnel could also be started
// In CI, the docker compose stack should be started before the tests
// and the web server should already be running
command: process.env.CI
? 'sleep 1d'
: 'npm run build && ./run dc up -d db valkey ; npm run preview',
port: 6173,
reuseExistingServer: true,
env: {
NODE_ENV: 'development',
// Generate a random secret for local testing
AUTH0_SECRET: signingSecret
}
},
use: {
baseURL: 'http://localhost:6173',
trace: 'on-first-retry',
screenshot: 'only-on-failure'
},
testDir: 'tests',
outputDir: 'playwright/test-results',
projects: [
// Setup Project
{ name: 'setup', testMatch: /.*\.setup.ts/ },
{
name: 'scriptoria',
use: { storageState: 'playwright/.auth/user.json' },
testMatch: /(.+\.)?(test|spec)\.[jt]s/,
dependencies: ['setup']
}
],
expect: {
timeout: 15_000 // 15s
},
retries: process.env.CI ? 2 : 0
};
export default config;