@applitools/visual-grid-cli-utils 1.21.28 → 1.21.31
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/visual-grid-cli-utils",
|
|
3
|
-
"version": "1.21.
|
|
3
|
+
"version": "1.21.31",
|
|
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",
|
|
@@ -52,7 +54,7 @@
|
|
|
52
54
|
"puppeteer": "^5.5.0",
|
|
53
55
|
"throat": "^5.0.0",
|
|
54
56
|
"uuid": "^8.3.2",
|
|
55
|
-
"yargs": "^
|
|
57
|
+
"yargs": "^17.1.1-candidate.0"
|
|
56
58
|
},
|
|
57
59
|
"devDependencies": {
|
|
58
60
|
"@applitools/chai-sharp-assert": "^1.1.4",
|
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)
|
|
@@ -788,6 +791,7 @@ async function main(argv, {shouldExitOnError = false} = {}) {
|
|
|
788
791
|
type: 'string',
|
|
789
792
|
}),
|
|
790
793
|
)
|
|
794
|
+
.completion('completion')
|
|
791
795
|
.exitProcess(shouldExitOnError)
|
|
792
796
|
.wrap(Math.min(yargs.terminalWidth(), 120))
|
|
793
797
|
.strict()
|