@applitools/visual-grid-cli-utils 1.21.38 → 1.21.40-FLD-3978.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/package.json +2 -2
- package/src/commons/parse-browser.js +1 -1
- package/src/rerender.js +84 -64
- package/src/visual-grid-cli-utils.js +10 -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.40-FLD-3978.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "src/visual-grid-cli-utils.js",
|
|
6
6
|
"engines": {
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"mime-types": "^2.1.32",
|
|
50
50
|
"nursery": "^4.0.3",
|
|
51
51
|
"p-retry": "^4.6.1",
|
|
52
|
-
"puppeteer": "^
|
|
52
|
+
"puppeteer": "^24.34.0",
|
|
53
53
|
"throat": "^5.0.0",
|
|
54
54
|
"uuid": "^8.3.2",
|
|
55
55
|
"yargs": "^16.2.0"
|
|
@@ -3,7 +3,7 @@ const {filterValues} = require('@applitools/functional-commons')
|
|
|
3
3
|
|
|
4
4
|
function parseBrowser(arg) {
|
|
5
5
|
const match =
|
|
6
|
-
/^(chrome|chrome-1|chrome-2|chrome-canary|edgechromium-poc-canary|edgechromium-canary|firefox|firefox-1|firefox-2|firefox-canary|ie11|ie10|edge|safari|safari-1|safari-2|safari-canary|webkit|safari-earlyaccess|ie-vmware|edgechromium|edgechromium-1|edgechromium-2|edgechromium-canary|edgelegacy)(\( *(\d+) *(x|,) *(\d+) *\))?$/.exec(
|
|
6
|
+
/^(chrome|chrome-1|chrome-2|chrome-canary|edgechromium-poc-canary|edgechromium-canary|firefox|firefox-1|firefox-2|firefox-canary|ie11|ie10|edge|safari|safari-1|safari-2|safari-canary|iossafari|iossafari-1|iossafari-2|iossafari-canary|webkit|safari-earlyaccess|ie-vmware|edgechromium|edgechromium-1|edgechromium-2|edgechromium-canary|edgelegacy)(\( *(\d+) *(x|,) *(\d+) *\))?$/.exec(
|
|
7
7
|
arg,
|
|
8
8
|
)
|
|
9
9
|
|
package/src/rerender.js
CHANGED
|
@@ -47,7 +47,17 @@ async function main({
|
|
|
47
47
|
options: optionsAsString,
|
|
48
48
|
selectorsToFindRegionsFor,
|
|
49
49
|
vhsCompatibilityParams,
|
|
50
|
+
globalResourceMapPath,
|
|
51
|
+
originUrl,
|
|
50
52
|
}) {
|
|
53
|
+
// Validate rdvsMetadata parameters
|
|
54
|
+
const hasGlobalResourceMapPath = !!globalResourceMapPath
|
|
55
|
+
const hasOriginUrl = !!originUrl
|
|
56
|
+
|
|
57
|
+
if (hasGlobalResourceMapPath !== hasOriginUrl) {
|
|
58
|
+
throw new Error('Both --global-resource-map-path and --origin-url must be provided together')
|
|
59
|
+
}
|
|
60
|
+
|
|
51
61
|
const options = parseJson(optionsAsString, 'options')
|
|
52
62
|
options.chromeHeadless = headless
|
|
53
63
|
const vgUrl = process.env.VG_URL || 'https://render-wus.applitools.com'
|
|
@@ -58,73 +68,83 @@ async function main({
|
|
|
58
68
|
const {webhook, authToken} = await createSession(apiKey, serverUrl)
|
|
59
69
|
|
|
60
70
|
const renderUrl = new URL('./render', vgUrl)
|
|
71
|
+
const requestBody = {
|
|
72
|
+
reRenderId: renderId,
|
|
73
|
+
accountOverride,
|
|
74
|
+
webhook,
|
|
75
|
+
renderInfo: {
|
|
76
|
+
emulationInfo: deviceEmulation
|
|
77
|
+
? {deviceName: deviceEmulation, screenOrientation: deviceOrientation}
|
|
78
|
+
: undefined,
|
|
79
|
+
iosDeviceInfo: iosDeviceName
|
|
80
|
+
? {
|
|
81
|
+
name: iosDeviceName,
|
|
82
|
+
screenOrientation: iosDeviceOrientation,
|
|
83
|
+
version: canary ? 'canary' : iosVersion,
|
|
84
|
+
}
|
|
85
|
+
: undefined,
|
|
86
|
+
vhsCompatibilityParams: vhsCompatibilityParams
|
|
87
|
+
? {
|
|
88
|
+
UIKitLinkTimeVersionNumber: vhsCompatibilityParams[0],
|
|
89
|
+
UIKitRunTimeVersionNumber: vhsCompatibilityParams[1],
|
|
90
|
+
}
|
|
91
|
+
: undefined,
|
|
92
|
+
androidDeviceInfo: androidDeviceName
|
|
93
|
+
? {
|
|
94
|
+
name: androidDeviceName,
|
|
95
|
+
screenOrientation: androidDeviceOrientation,
|
|
96
|
+
version: canary ? 'canary' : androidVersion,
|
|
97
|
+
}
|
|
98
|
+
: undefined,
|
|
99
|
+
vhsType: androidDeviceName ? androidVhsType : undefined,
|
|
100
|
+
width: deviceEmulation || iosDeviceName ? undefined : width,
|
|
101
|
+
height: deviceEmulation || iosDeviceName ? undefined : height,
|
|
102
|
+
target,
|
|
103
|
+
selector: selector
|
|
104
|
+
? {selector, type: selector.startsWith('//') ? 'xpath' : 'css'}
|
|
105
|
+
: chainedSelectors
|
|
106
|
+
? normalizeChainedSelectorsArray(chainedSelectors)
|
|
107
|
+
: undefined,
|
|
108
|
+
region: region,
|
|
109
|
+
},
|
|
110
|
+
selectorsToFindRegionsFor: selectorsToFindRegionsFor
|
|
111
|
+
? normalizeSelectorsToFindRegionsForArray(selectorsToFindRegionsFor)
|
|
112
|
+
: undefined,
|
|
113
|
+
enableMultipleResultsPerSelector: true,
|
|
114
|
+
includeFullPageSize,
|
|
115
|
+
sendDom: rca,
|
|
116
|
+
agentId: `visual-grid-cli-utils/${require('../package.json').version}`,
|
|
117
|
+
// browser: {
|
|
118
|
+
// name: iosDeviceName ? 'safari' : canary ? convertBrowserNameToCanary(browser) : browser,
|
|
119
|
+
// },
|
|
120
|
+
// platform: {name: iosDeviceName ? 'ios' : undefined},
|
|
121
|
+
browser: native
|
|
122
|
+
? undefined
|
|
123
|
+
: {
|
|
124
|
+
name: iosDeviceName ? 'safari' : canary ? convertBrowserNameToCanary(browser) : browser,
|
|
125
|
+
},
|
|
126
|
+
platform: {
|
|
127
|
+
name: iosDeviceName ? 'ios' : androidDeviceName ? 'android' : undefined,
|
|
128
|
+
type: native ? 'native' : undefined,
|
|
129
|
+
},
|
|
130
|
+
scriptHooks: {
|
|
131
|
+
beforeCaptureScreenshot: bcsHook,
|
|
132
|
+
},
|
|
133
|
+
options,
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// Add rdvsMetadata if both parameters are provided
|
|
137
|
+
if (hasGlobalResourceMapPath && hasOriginUrl) {
|
|
138
|
+
requestBody.rdvsMetadata = {
|
|
139
|
+
globalResourceMapPath,
|
|
140
|
+
originUrl,
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
61
144
|
const response = await fetch(renderUrl, {
|
|
62
145
|
method: 'POST',
|
|
63
146
|
headers: {'content-type': 'application/json', 'X-Auth-Token': authToken},
|
|
64
|
-
body: JSON.stringify(
|
|
65
|
-
reRenderId: renderId,
|
|
66
|
-
accountOverride,
|
|
67
|
-
webhook,
|
|
68
|
-
renderInfo: {
|
|
69
|
-
emulationInfo: deviceEmulation
|
|
70
|
-
? {deviceName: deviceEmulation, screenOrientation: deviceOrientation}
|
|
71
|
-
: undefined,
|
|
72
|
-
iosDeviceInfo: iosDeviceName
|
|
73
|
-
? {
|
|
74
|
-
name: iosDeviceName,
|
|
75
|
-
screenOrientation: iosDeviceOrientation,
|
|
76
|
-
version: canary ? 'canary' : iosVersion,
|
|
77
|
-
}
|
|
78
|
-
: undefined,
|
|
79
|
-
vhsCompatibilityParams: vhsCompatibilityParams
|
|
80
|
-
? {
|
|
81
|
-
UIKitLinkTimeVersionNumber: vhsCompatibilityParams[0],
|
|
82
|
-
UIKitRunTimeVersionNumber: vhsCompatibilityParams[1],
|
|
83
|
-
}
|
|
84
|
-
: undefined,
|
|
85
|
-
androidDeviceInfo: androidDeviceName
|
|
86
|
-
? {
|
|
87
|
-
name: androidDeviceName,
|
|
88
|
-
screenOrientation: androidDeviceOrientation,
|
|
89
|
-
version: canary ? 'canary' : androidVersion,
|
|
90
|
-
}
|
|
91
|
-
: undefined,
|
|
92
|
-
vhsType: androidDeviceName ? androidVhsType : undefined,
|
|
93
|
-
width: deviceEmulation || iosDeviceName ? undefined : width,
|
|
94
|
-
height: deviceEmulation || iosDeviceName ? undefined : height,
|
|
95
|
-
target,
|
|
96
|
-
selector: selector
|
|
97
|
-
? {selector, type: selector.startsWith('//') ? 'xpath' : 'css'}
|
|
98
|
-
: chainedSelectors
|
|
99
|
-
? normalizeChainedSelectorsArray(chainedSelectors)
|
|
100
|
-
: undefined,
|
|
101
|
-
region: region,
|
|
102
|
-
},
|
|
103
|
-
selectorsToFindRegionsFor: selectorsToFindRegionsFor
|
|
104
|
-
? normalizeSelectorsToFindRegionsForArray(selectorsToFindRegionsFor)
|
|
105
|
-
: undefined,
|
|
106
|
-
enableMultipleResultsPerSelector: true,
|
|
107
|
-
includeFullPageSize,
|
|
108
|
-
sendDom: rca,
|
|
109
|
-
agentId: `visual-grid-cli-utils/${require('../package.json').version}`,
|
|
110
|
-
// browser: {
|
|
111
|
-
// name: iosDeviceName ? 'safari' : canary ? convertBrowserNameToCanary(browser) : browser,
|
|
112
|
-
// },
|
|
113
|
-
// platform: {name: iosDeviceName ? 'ios' : undefined},
|
|
114
|
-
browser: native
|
|
115
|
-
? undefined
|
|
116
|
-
: {
|
|
117
|
-
name: iosDeviceName ? 'safari' : canary ? convertBrowserNameToCanary(browser) : browser,
|
|
118
|
-
},
|
|
119
|
-
platform: {
|
|
120
|
-
name: iosDeviceName ? 'ios' : androidDeviceName ? 'android' : undefined,
|
|
121
|
-
type: native ? 'native' : undefined,
|
|
122
|
-
},
|
|
123
|
-
scriptHooks: {
|
|
124
|
-
beforeCaptureScreenshot: bcsHook,
|
|
125
|
-
},
|
|
126
|
-
options,
|
|
127
|
-
}),
|
|
147
|
+
body: JSON.stringify(requestBody),
|
|
128
148
|
})
|
|
129
149
|
if (!response.ok) await throwErrorFromBadStatus(renderUrl, response)
|
|
130
150
|
|
|
@@ -239,6 +239,16 @@ async function main(argv, {shouldExitOnError = false} = {}) {
|
|
|
239
239
|
.option('options', {
|
|
240
240
|
describe: 'send visual grid options to rendering (json)',
|
|
241
241
|
type: 'string',
|
|
242
|
+
})
|
|
243
|
+
.option('global-resource-map-path', {
|
|
244
|
+
alias: 'grm',
|
|
245
|
+
describe: 'global resource map path for rdvsMetadata',
|
|
246
|
+
type: 'string',
|
|
247
|
+
})
|
|
248
|
+
.option('origin-url', {
|
|
249
|
+
alias: 'ou',
|
|
250
|
+
describe: 'origin URL for rdvsMetadata',
|
|
251
|
+
type: 'string',
|
|
242
252
|
}),
|
|
243
253
|
)
|
|
244
254
|
.command(
|