@applitools/visual-grid-cli-utils 1.21.27 → 1.21.30
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/package.json +5 -2
- package/src/job-info.js +16 -1
- package/src/view-rendering.js +8 -2
- package/src/visual-grid-cli-utils.js +25 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/visual-grid-cli-utils",
|
|
3
|
-
"version": "1.21.
|
|
3
|
+
"version": "1.21.30",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "src/visual-grid-cli-utils.js",
|
|
6
6
|
"engines": {
|
|
@@ -21,7 +21,9 @@
|
|
|
21
21
|
"start": "scripts/run-visual-grid-cli-utils.js",
|
|
22
22
|
"test:mocha": "mocha --no-timeouts --exit 'test/unit/*.test.js' 'test/it/*.test.js' 'test/e2e/*.test.js'",
|
|
23
23
|
"test": "npm run eslint && npm run test:mocha",
|
|
24
|
-
"eslint": "eslint '**/*.js'"
|
|
24
|
+
"eslint": "eslint '**/*.js'",
|
|
25
|
+
"postinstall": "install-yargs-completion",
|
|
26
|
+
"uninstall": "uninstall-yargs-completion"
|
|
25
27
|
},
|
|
26
28
|
"keywords": [
|
|
27
29
|
"applitools",
|
|
@@ -43,6 +45,7 @@
|
|
|
43
45
|
"@applitools/screenshot-stitching-client": "^8.0.15",
|
|
44
46
|
"@applitools/url-commons": "^1.0.1",
|
|
45
47
|
"@applitools/visual-grid-client": "^15.8.21",
|
|
48
|
+
"completarr": "^0.2.2",
|
|
46
49
|
"debug": "^4.3.1",
|
|
47
50
|
"gunzip-file": "^0.1.1",
|
|
48
51
|
"jszip": "^3.7.1",
|
package/src/job-info.js
CHANGED
|
@@ -15,6 +15,10 @@ async function main({
|
|
|
15
15
|
deviceOrientation,
|
|
16
16
|
iosDeviceName,
|
|
17
17
|
iosDeviceOrientation,
|
|
18
|
+
androidDeviceName,
|
|
19
|
+
androidVersion,
|
|
20
|
+
androidDeviceOrientation,
|
|
21
|
+
androidVhsType,
|
|
18
22
|
serverUrl,
|
|
19
23
|
accountOverride,
|
|
20
24
|
canary,
|
|
@@ -44,6 +48,14 @@ async function main({
|
|
|
44
48
|
version: canary ? 'canary' : iosVersion,
|
|
45
49
|
}
|
|
46
50
|
: undefined,
|
|
51
|
+
androidDeviceInfo: androidDeviceName
|
|
52
|
+
? {
|
|
53
|
+
name: androidDeviceName,
|
|
54
|
+
version: canary ? 'canary' : androidVersion,
|
|
55
|
+
screenOrientation: androidDeviceOrientation,
|
|
56
|
+
}
|
|
57
|
+
: undefined,
|
|
58
|
+
vhsType: androidDeviceName ? androidVhsType : undefined,
|
|
47
59
|
width: deviceEmulation || iosDeviceName ? undefined : width,
|
|
48
60
|
height: deviceEmulation || iosDeviceName ? undefined : height,
|
|
49
61
|
target: 'full-page',
|
|
@@ -54,7 +66,10 @@ async function main({
|
|
|
54
66
|
: {
|
|
55
67
|
name: iosDeviceName ? 'safari' : canary ? convertBrowserNameToCanary(browser) : browser,
|
|
56
68
|
},
|
|
57
|
-
platform: {
|
|
69
|
+
platform: {
|
|
70
|
+
name: iosDeviceName ? 'ios' : androidDeviceName ? 'android' : undefined,
|
|
71
|
+
type: native ? 'native' : 'web',
|
|
72
|
+
},
|
|
58
73
|
options,
|
|
59
74
|
},
|
|
60
75
|
{
|
package/src/view-rendering.js
CHANGED
|
@@ -27,12 +27,18 @@ async function main({
|
|
|
27
27
|
const viewRenderingUrl = calculateViewRenderingUrl(renderId, finalAuthToken, accountOverride)
|
|
28
28
|
|
|
29
29
|
if (downloadVhsFolder) {
|
|
30
|
-
|
|
30
|
+
let response = await fetch(viewRenderingUrl)
|
|
31
31
|
if (!response.ok) await throwErrorFromBadStatus(viewRenderingUrl, response)
|
|
32
32
|
const contentType = response.headers.get('content-type')
|
|
33
|
-
if (
|
|
33
|
+
if (contentType.includes('json')) {
|
|
34
|
+
const body = await response.json()
|
|
35
|
+
|
|
36
|
+
response = await fetch(body.vhs)
|
|
37
|
+
if (!response.ok) await throwErrorFromBadStatus(viewRenderingUrl, response)
|
|
38
|
+
} else if (!contentType.includes('x-applitools-vhs')) {
|
|
34
39
|
throw new Error('Content type is not VHS, it is: ' + contentType)
|
|
35
40
|
}
|
|
41
|
+
|
|
36
42
|
const resource = await response.buffer()
|
|
37
43
|
const fname = `${downloadVhsFolder}/${renderId}.vhs`
|
|
38
44
|
fs.writeFileSync(fname, resource)
|
|
@@ -3,6 +3,9 @@ const yargs = require('yargs')
|
|
|
3
3
|
const {parseBrowser} = require('./commons/parse-browser')
|
|
4
4
|
const parseRegion = require('./commons/parse-region')
|
|
5
5
|
const splitApiKey = require('./commons/split-api-key')
|
|
6
|
+
require('completarr')({
|
|
7
|
+
name: 'vg-cli',
|
|
8
|
+
})
|
|
6
9
|
|
|
7
10
|
async function main(argv, {shouldExitOnError = false} = {}) {
|
|
8
11
|
const commandLineOptions = yargs(argv)
|
|
@@ -490,6 +493,28 @@ async function main(argv, {shouldExitOnError = false} = {}) {
|
|
|
490
493
|
choices: ['portrait', 'landscapeLeft', 'landscapeRight'],
|
|
491
494
|
default: 'portrait',
|
|
492
495
|
})
|
|
496
|
+
.option('android-device-name', {
|
|
497
|
+
describe: 'the name of the Android device to use',
|
|
498
|
+
type: 'string',
|
|
499
|
+
})
|
|
500
|
+
.option('android-version', {
|
|
501
|
+
describe:
|
|
502
|
+
'The Android version to use (latest, latest-1 or latest-2 - relative to the device)',
|
|
503
|
+
type: 'string',
|
|
504
|
+
default: 'latest',
|
|
505
|
+
})
|
|
506
|
+
.option('android-device-orientation', {
|
|
507
|
+
describe: 'screen orientation',
|
|
508
|
+
type: 'string',
|
|
509
|
+
choices: ['portrait', 'landscape'],
|
|
510
|
+
default: 'portrait',
|
|
511
|
+
})
|
|
512
|
+
.option('android-vhs-type', {
|
|
513
|
+
describe: 'vhs type',
|
|
514
|
+
type: 'string',
|
|
515
|
+
choices: ['android-x', 'android-support'],
|
|
516
|
+
default: 'android-x',
|
|
517
|
+
})
|
|
493
518
|
.option('browser', {
|
|
494
519
|
alias: 'b',
|
|
495
520
|
describe: 'the browser to render to',
|