forked from Cookie-Jar-DAO/cookie-jar-v3
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
68 lines (59 loc) · 2.06 KB
/
playwright.config.ts
File metadata and controls
68 lines (59 loc) · 2.06 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 { defineConfig, devices } from '@playwright/test'
export default defineConfig({
testDir: './e2e',
fullyParallel: false, // Sequential for blockchain state consistency
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: 1, // Single worker for blockchain state consistency
reporter: [
['html', { outputFolder: 'e2e/playwright-report' }],
['json', { outputFile: 'e2e/test-results/results.json' }],
['list']
].concat(process.env.CI ? [['github']] : []) as any[],
use: {
baseURL: 'http://localhost:3000',
trace: 'retain-on-failure',
screenshot: 'only-on-failure',
video: 'retain-on-failure',
// Increase timeouts for blockchain operations
actionTimeout: 30000,
navigationTimeout: 30000
},
projects: [
{
name: 'Desktop Chrome',
use: { ...devices['Desktop Chrome'] },
},
{
name: 'Mobile Chrome',
use: { ...devices['Pixel 5'] },
}
],
// Global setup for blockchain - uses your existing dev setup
// Only use global setup if explicitly requested (for full integration tests)
globalSetup: process.env.E2E_FULL_SETUP ? require.resolve('./e2e/global-setup.ts') : undefined,
globalTeardown: process.env.E2E_FULL_SETUP ? require.resolve('./e2e/global-teardown.ts') : undefined,
// Start services before tests - leverages your existing infrastructure
// Only start webServer if explicitly requested via E2E_START_SERVER env var
webServer: process.env.E2E_START_SERVER ? [
{
// Use your existing dev command that starts Anvil + Next.js
command: 'bun dev',
port: 3000,
reuseExistingServer: true,
timeout: 120000, // 2 minutes for full startup (Anvil + deployment + Next.js)
env: {
NODE_ENV: 'test'
}
}
] : [],
// Test output configuration
outputDir: 'e2e/test-results',
// Test matching
testMatch: '**/*.{test,spec}.{js,ts}',
// Global test timeout
timeout: 60000, // 1 minute per test (blockchain operations can be slow)
expect: {
timeout: 10000 // 10 seconds for assertions
}
})