-
Notifications
You must be signed in to change notification settings - Fork 981
Expand file tree
/
Copy pathcypress.config.sample.js
More file actions
51 lines (48 loc) · 1.93 KB
/
Copy pathcypress.config.sample.js
File metadata and controls
51 lines (48 loc) · 1.93 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
const { defineConfig } = require("cypress");
const fs = require('fs');
module.exports = defineConfig({
e2e: {
baseUrl: "http://localhost",
defaultCommandTimeout: 30000,
viewportWidth: 2000,
viewportHeight: 1100,
numTestsKeptInMemory: 0,
experimentalMemoryManagement: true,
projectId: "000000",
chromeWebSecurity: false,
watchForFileChanges: true,
testReplay: {
enabled: false,
},
video: true,
setupNodeEvents(on, config) {
on('after:spec', (spec, results) => {
if (results && results.video) {
const failures = results.tests.some((test) =>
test.attempts.some((attempt) => attempt.state === 'failed')
);
if (!failures) {
// delete the video if the spec passed and no tests retried
const videoPath = results.video;
if (fs.existsSync(videoPath)) {
fs.unlinkSync(videoPath);
}
}
}
});
on("before:browser:launch", (browser, launchOptions) => {
if (["chrome", "edge", "electron"].includes(browser.name)) {
if (browser.isHeadless) {
launchOptions.args.push("--no-sandbox");
launchOptions.args.push("--disable-gl-drawing-for-tests");
launchOptions.args.push("--disable-gpu");
launchOptions.args.push("--disable-dev-shm-usage");
}
launchOptions.args.push('--js-flags="--max_old_space_size=4096 --max_semi_space_size=1024"');
launchOptions.args.push("--disable-software-rasterizer");
}
return launchOptions;
});
},
},
});