-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcypress.config.js
More file actions
83 lines (67 loc) · 2.5 KB
/
cypress.config.js
File metadata and controls
83 lines (67 loc) · 2.5 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
/**
* Cypress E2E Testing Configuration for Riksdagsmonitor
*
* End-to-end testing for dashboard functionality and user interactions
*
* @author Hack23 AB
* @license Apache-2.0
*/
import { defineConfig } from 'cypress';
export default defineConfig({
e2e: {
// Base URL for tests
baseUrl: 'http://localhost:4173',
// Spec pattern
specPattern: 'cypress/e2e/**/*.cy.{js,jsx,ts,tsx}',
// Support file
supportFile: 'cypress/support/e2e.js',
// Fixtures folder
fixturesFolder: 'cypress/fixtures',
// Screenshots and videos (optimized for performance)
screenshotsFolder: 'cypress/screenshots',
videosFolder: 'cypress/videos',
video: false, // Disable by default, enable via CLI flag for debugging
videoCompression: 32,
// Viewport settings
viewportWidth: 1280,
viewportHeight: 720,
// Timeouts (optimized for faster feedback)
defaultCommandTimeout: 5000, // Reduced from 10s to 5s
// Cypress default is 60s. 30s gives Vite-preview enough head-room to
// cold-transform the CIA module graph (cia-entry → dashboard-init →
// data-loader → 13 sub-modules) on the first visit while still keeping
// the suite responsive after warm-up.
pageLoadTimeout: 30000,
requestTimeout: 5000, // Reduced from 10s to 5s
responseTimeout: 20000, // Reduced from 30s to 20s
// Retry configuration (FAIL-FAST: No retries in CI)
retries: {
runMode: 0, // Changed from 2 to 0 for fail-fast
openMode: 0
},
// Watch for file changes
watchForFileChanges: true,
// Browser configuration
chromeWebSecurity: true,
// Test isolation (keep enabled for reliability)
testIsolation: true,
// Experimental features for performance
experimentalMemoryManagement: true,
numTestsKeptInMemory: 10, // Reduced from default 50
setupNodeEvents(on, config) {
// Log failures after each spec (use --bail in CI for true fail-fast runs)
on('after:spec', (spec, results) => {
if (results && results.stats.failures > 0) {
console.log('❌ Test failures detected in spec. Use the --bail flag to stop the run on first failing spec.');
// Note: The individual spec fails, but the runner continues to the next spec
// To stop the entire run on first failure, configure Cypress with the --bail flag
}
});
return config;
}
},
// Environment variables
env: {
coverage: false
}
});