-
Notifications
You must be signed in to change notification settings - Fork 0
/
cypress.config.js
37 lines (31 loc) · 1.21 KB
/
cypress.config.js
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
const { defineConfig } = require('cypress');
// match electron window size on Macbook Pro
const viewportWidth = 1680;
const viewportHeight = 997;
module.exports = defineConfig({
e2e: {
setupNodeEvents(on, config) { // eslint-disable-line no-unused-vars
// implement node event listeners here
// https://docs.cypress.io/api/plugins/browser-launch-api#Set-screen-size-when-running-headless
on('before:browser:launch', (browser, launchOptions) => {
if (browser.name === 'chrome' && browser.isHeadless) {
launchOptions.args.push(`--window-size=${viewportWidth},${viewportHeight}`);
launchOptions.args.push('--force-device-scale-factor=1');
}
if (browser.name === 'electron' && browser.isHeadless) {
launchOptions.preferences.width = viewportWidth;
launchOptions.preferences.height = viewportHeight;
}
if (browser.name === 'firefox' && browser.isHeadless) {
launchOptions.args.push(`--width=${viewportWidth}`);
launchOptions.args.push(`--height=${viewportHeight}`);
}
return launchOptions;
});
}
},
video: true,
viewportWidth,
viewportHeight,
watchForFileChanges: true
});