@applitools/visual-grid-cli-utils 1.21.26 → 1.21.29
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 +1 -1
- package/src/compare.js +4 -2
- package/src/job-info.js +16 -1
- package/src/view-rendering.js +8 -2
- package/src/visual-grid-cli-utils.js +22 -0
package/package.json
CHANGED
package/src/compare.js
CHANGED
|
@@ -18,6 +18,7 @@ async function main(args) {
|
|
|
18
18
|
|
|
19
19
|
async function compareWithEyes(rerenderResults) {
|
|
20
20
|
const eyes = new Eyes()
|
|
21
|
+
let batchUrl
|
|
21
22
|
try {
|
|
22
23
|
// Initialize the eyes configuration
|
|
23
24
|
const configuration = new Configuration()
|
|
@@ -29,7 +30,6 @@ async function compareWithEyes(rerenderResults) {
|
|
|
29
30
|
eyes.setConfiguration(configuration)
|
|
30
31
|
|
|
31
32
|
const uuid = randomUUID()
|
|
32
|
-
let batchUrl
|
|
33
33
|
let i = 0
|
|
34
34
|
for (const result of rerenderResults) {
|
|
35
35
|
await eyes.open('VG-CLI compare', `Compare browsers ${uuid}`)
|
|
@@ -39,9 +39,11 @@ async function compareWithEyes(rerenderResults) {
|
|
|
39
39
|
console.log(`${++i}. ${name} check result: ${resp}`)
|
|
40
40
|
await eyes.close()
|
|
41
41
|
}
|
|
42
|
-
|
|
42
|
+
} catch (err) {
|
|
43
|
+
console.error(err)
|
|
43
44
|
} finally {
|
|
44
45
|
await eyes.abortIfNotClosed()
|
|
46
|
+
console.log('\nBatch results: \n', batchUrl)
|
|
45
47
|
}
|
|
46
48
|
}
|
|
47
49
|
|
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)
|
|
@@ -490,6 +490,28 @@ async function main(argv, {shouldExitOnError = false} = {}) {
|
|
|
490
490
|
choices: ['portrait', 'landscapeLeft', 'landscapeRight'],
|
|
491
491
|
default: 'portrait',
|
|
492
492
|
})
|
|
493
|
+
.option('android-device-name', {
|
|
494
|
+
describe: 'the name of the Android device to use',
|
|
495
|
+
type: 'string',
|
|
496
|
+
})
|
|
497
|
+
.option('android-version', {
|
|
498
|
+
describe:
|
|
499
|
+
'The Android version to use (latest, latest-1 or latest-2 - relative to the device)',
|
|
500
|
+
type: 'string',
|
|
501
|
+
default: 'latest',
|
|
502
|
+
})
|
|
503
|
+
.option('android-device-orientation', {
|
|
504
|
+
describe: 'screen orientation',
|
|
505
|
+
type: 'string',
|
|
506
|
+
choices: ['portrait', 'landscape'],
|
|
507
|
+
default: 'portrait',
|
|
508
|
+
})
|
|
509
|
+
.option('android-vhs-type', {
|
|
510
|
+
describe: 'vhs type',
|
|
511
|
+
type: 'string',
|
|
512
|
+
choices: ['android-x', 'android-support'],
|
|
513
|
+
default: 'android-x',
|
|
514
|
+
})
|
|
493
515
|
.option('browser', {
|
|
494
516
|
alias: 'b',
|
|
495
517
|
describe: 'the browser to render to',
|