@telefonica/acceptance-testing 3.0.0-beta8 → 3.0.0
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/README.md +27 -0
- package/dist/acceptance-testing.cjs.development.js +185 -275
- package/dist/acceptance-testing.cjs.development.js.map +1 -1
- package/dist/acceptance-testing.cjs.production.min.js +1 -1
- package/dist/acceptance-testing.cjs.production.min.js.map +1 -1
- package/dist/acceptance-testing.esm.js +185 -275
- package/dist/acceptance-testing.esm.js.map +1 -1
- package/dist/coverage.d.ts +8 -8
- package/dist/index.d.ts +91 -93
- package/dist/utils.d.ts +4 -4
- package/docker-compose.yaml +1 -1
- package/jest-puppeteer-config.js +24 -37
- package/package.json +13 -14
- package/dist/__tests__/utils.test.d.ts +0 -1
package/jest-puppeteer-config.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @ts-check
|
|
2
1
|
const path = require('path');
|
|
3
2
|
const fs = require('fs');
|
|
4
3
|
const findRoot = require('find-root');
|
|
@@ -18,25 +17,22 @@ const poll = async (url) => {
|
|
|
18
17
|
};
|
|
19
18
|
|
|
20
19
|
/**
|
|
21
|
-
* CI => everything runs inside a docker
|
|
20
|
+
* CI => everything runs inside a docker
|
|
22
21
|
* Local, headless => connects to a dockerized chromium at port 9223 (see docker-compose.yaml)
|
|
23
22
|
* Local, with UI => launches a local chromium installed by puppetteer
|
|
24
|
-
*
|
|
25
|
-
* @returns {Promise<import('jest-environment-puppeteer').JestPuppeteerConfig>}
|
|
26
23
|
*/
|
|
27
24
|
const getPuppeteerConfig = async () => {
|
|
28
25
|
const isCi = process.argv.includes('--ci') || process.env.CI;
|
|
29
26
|
const isLocal = !isCi;
|
|
30
|
-
const isHeadless =
|
|
31
|
-
!!process.env.HEADLESS && process.env.HEADLESS !== 'false' && process.env.HEADLESS !== '0';
|
|
27
|
+
const isHeadless = !!process.env.HEADLESS;
|
|
32
28
|
|
|
33
29
|
const rootDir = findRoot(process.cwd());
|
|
34
|
-
const
|
|
35
|
-
const projectConfig =
|
|
30
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(rootDir, 'package.json'), 'utf-8'));
|
|
31
|
+
const projectConfig = pkg.acceptanceTests || {};
|
|
36
32
|
|
|
37
33
|
const server = (isCi ? projectConfig.ciServer : projectConfig.devServer) || projectConfig.server || {};
|
|
38
34
|
|
|
39
|
-
const
|
|
35
|
+
const baseConfig = {
|
|
40
36
|
ignoreHTTPSErrors: true,
|
|
41
37
|
headless: isHeadless,
|
|
42
38
|
slowMo: isHeadless ? 0 : 50,
|
|
@@ -60,15 +56,17 @@ const getPuppeteerConfig = async () => {
|
|
|
60
56
|
execSync(`docker compose -f ${dockerComposeFile} stop -t 0`, {stdio: 'ignore'});
|
|
61
57
|
});
|
|
62
58
|
|
|
63
|
-
execSync(`docker compose -f ${dockerComposeFile}
|
|
59
|
+
execSync(`docker compose -f ${dockerComposeFile} up -d`, {stdio: 'inherit'});
|
|
64
60
|
console.log();
|
|
65
61
|
|
|
66
62
|
await poll(dockerChromiumUrl);
|
|
67
63
|
}
|
|
68
64
|
|
|
65
|
+
const {webSocketDebuggerUrl} = await fetch(`${dockerChromiumUrl}/json/version`).then((r) => r.json());
|
|
66
|
+
|
|
69
67
|
connect = {
|
|
70
|
-
...
|
|
71
|
-
|
|
68
|
+
...baseConfig,
|
|
69
|
+
browserWSEndpoint: webSocketDebuggerUrl,
|
|
72
70
|
};
|
|
73
71
|
}
|
|
74
72
|
|
|
@@ -81,16 +79,21 @@ const getPuppeteerConfig = async () => {
|
|
|
81
79
|
launchTimeout: 60000,
|
|
82
80
|
};
|
|
83
81
|
|
|
84
|
-
|
|
85
|
-
const config = {
|
|
82
|
+
return {
|
|
86
83
|
launch: {
|
|
87
|
-
...
|
|
88
|
-
//
|
|
84
|
+
...baseConfig,
|
|
85
|
+
// Launch chromium installed in docker in CI
|
|
89
86
|
...(isCi ? {executablePath: '/usr/bin/chromium'} : {}),
|
|
90
|
-
|
|
91
|
-
|
|
87
|
+
env: {
|
|
88
|
+
...process.env,
|
|
89
|
+
TZ: 'UTC',
|
|
90
|
+
LANG: 'es_ES',
|
|
91
|
+
LANGUAGE: 'es_ES',
|
|
92
|
+
},
|
|
92
93
|
args: [
|
|
93
|
-
|
|
94
|
+
// https://peter.sh/experiments/chromium-command-line-switches/
|
|
95
|
+
'--no-sandbox', // probably not needed in ubuntu
|
|
96
|
+
'--font-render-hinting=none', // this flag is important because we use it when launching dockerized chromium too
|
|
94
97
|
'--disable-background-networking',
|
|
95
98
|
'--disable-background-timer-throttling',
|
|
96
99
|
'--disable-breakpad',
|
|
@@ -104,25 +107,11 @@ const getPuppeteerConfig = async () => {
|
|
|
104
107
|
'--disable-prompt-on-repost',
|
|
105
108
|
'--disable-sync',
|
|
106
109
|
'--disable-translate',
|
|
107
|
-
'--disable-
|
|
108
|
-
'--metrics-recording-only',
|
|
109
|
-
'--no-first-run',
|
|
110
|
-
'--safebrowsing-disable-auto-update',
|
|
111
|
-
'--enable-automation',
|
|
112
|
-
'--password-store=basic',
|
|
113
|
-
'--use-mock-keychain',
|
|
114
|
-
'--headless=new',
|
|
115
|
-
'--hide-scrollbars',
|
|
116
|
-
'--no-sandbox',
|
|
117
|
-
'--disabled-setupid-sandbox',
|
|
118
|
-
'--font-render-hinting=none',
|
|
119
|
-
'--disable-font-subpixel-positioning',
|
|
120
|
-
'--ignore-certificate-errors',
|
|
110
|
+
'--disable-smooth-scrolling',
|
|
121
111
|
],
|
|
122
112
|
},
|
|
123
|
-
browserContext: 'incognito',
|
|
124
|
-
browserPerWorker: false,
|
|
125
113
|
connect,
|
|
114
|
+
browserContext: 'incognito',
|
|
126
115
|
server: server
|
|
127
116
|
? {
|
|
128
117
|
...defaultServerConfig,
|
|
@@ -130,8 +119,6 @@ const getPuppeteerConfig = async () => {
|
|
|
130
119
|
}
|
|
131
120
|
: undefined,
|
|
132
121
|
};
|
|
133
|
-
|
|
134
|
-
return config;
|
|
135
122
|
};
|
|
136
123
|
|
|
137
124
|
module.exports = getPuppeteerConfig();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telefonica/acceptance-testing",
|
|
3
|
-
"version": "3.0.0
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"author": "Telefonica",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"module": "dist/acceptance-testing.esm.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"jest-puppeteer-config.js"
|
|
17
17
|
],
|
|
18
18
|
"engines": {
|
|
19
|
-
"node": ">=
|
|
19
|
+
"node": ">=12"
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
22
|
"start": "tsdx watch",
|
|
@@ -27,15 +27,14 @@
|
|
|
27
27
|
"prepack": "yarn test && yarn build"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@types/find-root": "^1.1.
|
|
31
|
-
"@types/glob-to-regexp": "^0.4.
|
|
32
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
33
|
-
"@typescript-eslint/parser": "^
|
|
30
|
+
"@types/find-root": "^1.1.2",
|
|
31
|
+
"@types/glob-to-regexp": "^0.4.1",
|
|
32
|
+
"@typescript-eslint/eslint-plugin": "^6.10.0",
|
|
33
|
+
"@typescript-eslint/parser": "^6.10.0",
|
|
34
34
|
"babel-jest": "^29.7.0",
|
|
35
|
-
"jest-environment-puppeteer": "^10.0.1",
|
|
36
35
|
"tsdx": "^0.14.1",
|
|
37
|
-
"tslib": "^2.
|
|
38
|
-
"typescript": "^
|
|
36
|
+
"tslib": "^2.3.1",
|
|
37
|
+
"typescript": "^4.4.4"
|
|
39
38
|
},
|
|
40
39
|
"repository": "git@github.com:Telefonica/js-toolbox.git",
|
|
41
40
|
"publishConfig": {
|
|
@@ -43,16 +42,16 @@
|
|
|
43
42
|
"registry": "https://registry.npmjs.org"
|
|
44
43
|
},
|
|
45
44
|
"dependencies": {
|
|
46
|
-
"@types/jest-image-snapshot": "^
|
|
45
|
+
"@types/jest-image-snapshot": "^4.3.1",
|
|
47
46
|
"find-root": "^1.1.0",
|
|
48
47
|
"glob-to-regexp": "^0.4.1",
|
|
49
|
-
"jest-image-snapshot": "^
|
|
48
|
+
"jest-image-snapshot": "^4.5.1",
|
|
50
49
|
"node-fetch": "^2.6.5",
|
|
51
|
-
"pptr-testing-library": "^0.
|
|
52
|
-
"puppeteer": "^
|
|
50
|
+
"pptr-testing-library": "^0.6.5",
|
|
51
|
+
"puppeteer": "^10.4.0"
|
|
53
52
|
},
|
|
54
53
|
"peerDependencies": {
|
|
55
54
|
"jest": ">=26",
|
|
56
|
-
"jest-environment-puppeteer": ">=
|
|
55
|
+
"jest-environment-puppeteer": ">=4"
|
|
57
56
|
}
|
|
58
57
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|