-
-
Notifications
You must be signed in to change notification settings - Fork 73
Expand file tree
/
Copy pathcypress.config.test.js
More file actions
60 lines (55 loc) · 2.3 KB
/
cypress.config.test.js
File metadata and controls
60 lines (55 loc) · 2.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
50
51
52
53
54
55
56
57
58
59
60
const { defineConfig } = require('cypress');
const baseConfig = require('./cypress.config');
const e2eOverride = {
baseUrl: 'http://localhost:8889',
defaultCommandTimeout: 30000, // Increased from 20s to 30s
requestTimeout: 45000, // Increased from 30s to 45s
responseTimeout: 45000, // Increased from 30s to 45s
pageLoadTimeout: 90000, // Increased from 60s to 90s
viewportWidth: 1280, // Larger viewport for better testing
viewportHeight: 720,
video: true, // Ensure video recording
screenshotOnRunFailure: true, // Screenshots on failure
trashAssetsBeforeRuns: true, // Clean up old assets
waitForAnimations: true, // Wait for animations
animationDistanceThreshold: 5,
retries: {
runMode: 2, // Retry failed tests 2 times in CI
openMode: 0 // No retries in dev mode
}
}
module.exports = defineConfig({
...baseConfig,
e2e: {
...baseConfig.e2e,
...e2eOverride,
setupNodeEvents(on, config) {
// Enhanced logging
on('task', {
log(message) {
console.log('🔍 CYPRESS TASK LOG:', message);
return null;
},
error(message) {
console.error('❌ CYPRESS ERROR:', message);
return null;
}
});
// Browser launch args for better stability
on('before:browser:launch', (browser = {}, launchOptions) => {
if (browser.family === 'chromium') {
launchOptions.args.push('--disable-dev-shm-usage');
launchOptions.args.push('--no-sandbox');
launchOptions.args.push('--disable-gpu');
launchOptions.args.push('--disable-web-security');
launchOptions.args.push('--allow-running-insecure-content');
}
return launchOptions;
});
// Forward Stripe test keys from process.env to Cypress.env
config.env.STRIPE_TEST_PK_KEY = process.env.STRIPE_TEST_PK_KEY || '';
config.env.STRIPE_TEST_SK_KEY = process.env.STRIPE_TEST_SK_KEY || '';
return config;
}
}
});