-
Notifications
You must be signed in to change notification settings - Fork 134
/
cypress.config.ts
73 lines (68 loc) · 2.69 KB
/
cypress.config.ts
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
/* eslint-disable @typescript-eslint/no-var-requires */
import { defineConfig } from 'cypress';
const { addMatchImageSnapshotPlugin } = require('@simonsmith/cypress-image-snapshot/plugin');
export default defineConfig({
component: {
specPattern: 'cypress/component/**/*.cy.{js,jsx,ts,tsx}',
excludeSpecPattern: ['/snapshots/*', '/image_snapshots/*', '/src/*'],
setupNodeEvents(on, config) {
addMatchImageSnapshotPlugin(on, config);
on('before:browser:launch', (browser, launchOptions) => {
if (browser.name === 'chrome' && browser.isHeadless) {
launchOptions.args = launchOptions.args.map((arg) => {
if (arg === '--headless=new') {
return '--headless';
}
return arg;
});
// Needs the extra 139 because of the cypress toolbar, this is the size of the window! not size of the viewport
launchOptions.args.push(`--window-size=1280,${720 + 139}`);
// force screen to be non-retina
launchOptions.args.push('--force-device-scale-factor=1');
// force screen to be retina (2800x2400 size)
// launchOptions.args.push('--force-device-scale-factor=2')
}
if (browser.name === 'electron' && browser.isHeadless) {
launchOptions.preferences.width = 1280;
launchOptions.preferences.height = 720;
}
if (browser.name === 'firefox' && browser.isHeadless) {
launchOptions.args.push('--width=1280');
launchOptions.args.push('--height=720');
}
return launchOptions;
});
require('@cypress/code-coverage/task')(on, config);
return config;
},
video: false,
devServer: {
framework: 'react',
bundler: 'webpack',
webpackConfig: require('./config/webpack.cy.config.js'),
},
},
e2e: {
blockHosts: ['consent.trustarc.com'],
baseUrl: 'https://stage.foo.redhat.com:1337/',
env: {
E2E_USER: process.env.E2E_USER,
E2E_PASSWORD: process.env.E2E_PASSWORD,
},
// To avoid any flaky issues we set the timeouts to be extra gracious
// Slow tests are faster than rerunning flaky tests
defaultCommandTimeout: 60000,
requestTimeout: 60000,
// required for the redirects to work correctly due to a chromium issue
userAgent: 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36',
screenshotOnRunFailure: false,
// required for the SSO redirect
chromeWebSecurity: false,
video: false,
setupNodeEvents(on, config) {
require('cypress-localstorage-commands/plugin')(on, config);
return config;
// implement node event listeners here
},
},
});