@telefonica/acceptance-testing 2.11.1 → 2.12.0-chromium
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/jest-puppeteer-config.js +18 -5
- package/package.json +1 -1
package/jest-puppeteer-config.js
CHANGED
|
@@ -17,13 +17,14 @@ const poll = async (url) => {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
* CI => everything runs inside a docker
|
|
20
|
+
* CI => everything runs inside a docker
|
|
21
21
|
* Local, headless => connects to a dockerized chromium at port 9223 (see docker-compose.yaml)
|
|
22
22
|
* Local, with UI => launches a local chromium installed by puppetteer
|
|
23
23
|
*/
|
|
24
24
|
const getPuppeteerConfig = async () => {
|
|
25
25
|
const isCi = process.argv.includes('--ci') || process.env.CI;
|
|
26
26
|
const isLocal = !isCi;
|
|
27
|
+
const isHeadless = !!process.env.HEADLESS;
|
|
27
28
|
|
|
28
29
|
const rootDir = findRoot(process.cwd());
|
|
29
30
|
const pkg = JSON.parse(fs.readFileSync(path.join(rootDir, 'package.json'), 'utf-8'));
|
|
@@ -31,8 +32,6 @@ const getPuppeteerConfig = async () => {
|
|
|
31
32
|
|
|
32
33
|
const server = (isCi ? projectConfig.ciServer : projectConfig.devServer) || projectConfig.server;
|
|
33
34
|
|
|
34
|
-
const isHeadless = !!process.env.HEADLESS;
|
|
35
|
-
|
|
36
35
|
const baseConfig = {
|
|
37
36
|
ignoreHTTPSErrors: true,
|
|
38
37
|
headless: isHeadless,
|
|
@@ -42,8 +41,7 @@ const getPuppeteerConfig = async () => {
|
|
|
42
41
|
let connect;
|
|
43
42
|
|
|
44
43
|
if (isLocal && isHeadless) {
|
|
45
|
-
const
|
|
46
|
-
const dockerChromiumUrl = `http://localhost:${debugPort}`;
|
|
44
|
+
const dockerChromiumUrl = 'http://localhost:9223';
|
|
47
45
|
|
|
48
46
|
try {
|
|
49
47
|
await fetch(dockerChromiumUrl);
|
|
@@ -75,6 +73,8 @@ const getPuppeteerConfig = async () => {
|
|
|
75
73
|
return {
|
|
76
74
|
launch: {
|
|
77
75
|
...baseConfig,
|
|
76
|
+
// Launch chromium installed in docker in CI
|
|
77
|
+
...(isCi ? {executablePath: '/usr/bin/chromium'} : {}),
|
|
78
78
|
env: {
|
|
79
79
|
...process.env,
|
|
80
80
|
TZ: 'UTC',
|
|
@@ -84,6 +84,19 @@ const getPuppeteerConfig = async () => {
|
|
|
84
84
|
args: [
|
|
85
85
|
'--no-sandbox', // probably not needed in ubuntu
|
|
86
86
|
'--font-render-hinting=none', // this flag is important because we use it when launching dockerized chromium too
|
|
87
|
+
'--disable-background-networking',
|
|
88
|
+
'--disable-background-timer-throttling',
|
|
89
|
+
'--disable-breakpad',
|
|
90
|
+
'--disable-client-side-phishing-detection',
|
|
91
|
+
'--disable-default-apps',
|
|
92
|
+
'--disable-dev-shm-usage',
|
|
93
|
+
'--disable-extensions',
|
|
94
|
+
'--disable-features=site-per-process',
|
|
95
|
+
'--disable-hang-monitor',
|
|
96
|
+
'--disable-popup-blocking',
|
|
97
|
+
'--disable-prompt-on-repost',
|
|
98
|
+
'--disable-sync',
|
|
99
|
+
'--disable-translate',
|
|
87
100
|
],
|
|
88
101
|
},
|
|
89
102
|
connect,
|