@applitools/visual-grid-cli-utils 1.21.18 → 1.21.19
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/rerender.js +24 -8
- package/src/test-url.js +16 -0
- package/src/visual-grid-cli-utils.js +10 -0
package/package.json
CHANGED
package/src/rerender.js
CHANGED
|
@@ -43,6 +43,7 @@ async function main({
|
|
|
43
43
|
iosVersion,
|
|
44
44
|
timeout,
|
|
45
45
|
options: optionsAsString,
|
|
46
|
+
selectorsToFindRegionsFor,
|
|
46
47
|
}) {
|
|
47
48
|
const options = parseJson(optionsAsString, 'options')
|
|
48
49
|
options.chromeHeadless = headless
|
|
@@ -90,7 +91,9 @@ async function main({
|
|
|
90
91
|
: undefined,
|
|
91
92
|
region: region,
|
|
92
93
|
},
|
|
93
|
-
selectorsToFindRegionsFor:
|
|
94
|
+
selectorsToFindRegionsFor: selectorsToFindRegionsFor
|
|
95
|
+
? normalizeSelectorsToFindRegionsForArray(selectorsToFindRegionsFor)
|
|
96
|
+
: undefined,
|
|
94
97
|
enableMultipleResultsPerSelector: true,
|
|
95
98
|
sendDom: rca,
|
|
96
99
|
agentId: `visual-grid-cli-utils/${require('../package.json').version}`,
|
|
@@ -153,15 +156,16 @@ async function main({
|
|
|
153
156
|
outputFile: domSnapshotHtml,
|
|
154
157
|
})
|
|
155
158
|
|
|
156
|
-
console.log(
|
|
157
|
-
`\n${domSnapshotOutputFile}: dom capture json${
|
|
158
|
-
selectorRegions && selectorRegions.length > 0 && selectorRegions[0].length > 0
|
|
159
|
-
? `, at offset ${selectorRegions[0][0].x},${selectorRegions[0][0].y}`
|
|
160
|
-
: ''
|
|
161
|
-
}`,
|
|
162
|
-
)
|
|
159
|
+
console.log(`\n${domSnapshotOutputFile}: dom capture json`)
|
|
163
160
|
console.log(domSnapshotHtml + ': dom capture rectangles')
|
|
164
161
|
}
|
|
162
|
+
|
|
163
|
+
if (selectorRegions) {
|
|
164
|
+
console.log('-----')
|
|
165
|
+
console.log(`selector regions output:`)
|
|
166
|
+
console.log(JSON.stringify(selectorRegions, null, 2))
|
|
167
|
+
console.log('-----')
|
|
168
|
+
}
|
|
165
169
|
}
|
|
166
170
|
|
|
167
171
|
if (viewRendering) {
|
|
@@ -184,4 +188,16 @@ function normalizeChainedSelectorsArray(chainedSelectors) {
|
|
|
184
188
|
return cs
|
|
185
189
|
}
|
|
186
190
|
|
|
191
|
+
function normalizeSelectorsToFindRegionsForArray(selectorsToFindRegionsFor) {
|
|
192
|
+
const arr = []
|
|
193
|
+
for (let i = 0; i < selectorsToFindRegionsFor.length; i += 2) {
|
|
194
|
+
arr.push({
|
|
195
|
+
selector: selectorsToFindRegionsFor[i],
|
|
196
|
+
type: selectorsToFindRegionsFor[i + 1],
|
|
197
|
+
})
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
return arr
|
|
201
|
+
}
|
|
202
|
+
|
|
187
203
|
module.exports = main
|
package/src/test-url.js
CHANGED
|
@@ -32,6 +32,7 @@ async function main({
|
|
|
32
32
|
pns,
|
|
33
33
|
canary,
|
|
34
34
|
options: optionsAsString,
|
|
35
|
+
selectorsToFindRegionsFor,
|
|
35
36
|
}) {
|
|
36
37
|
debug('open done')
|
|
37
38
|
const options = parseJson(optionsAsString, 'options')
|
|
@@ -117,6 +118,9 @@ async function main({
|
|
|
117
118
|
selector: selector ? {selector, type: selector.startsWith('//') ? 'xpath' : 'css'} : undefined,
|
|
118
119
|
sendDom: rca,
|
|
119
120
|
visualGridOptions: options,
|
|
121
|
+
...(selectorsToFindRegionsFor && {
|
|
122
|
+
ignore: normalizeSelectorsToFindRegionsForArray(selectorsToFindRegionsFor),
|
|
123
|
+
}),
|
|
120
124
|
})
|
|
121
125
|
const results = await close(false)
|
|
122
126
|
const result = results[0]
|
|
@@ -141,4 +145,16 @@ async function main({
|
|
|
141
145
|
debug('browser closed')
|
|
142
146
|
}
|
|
143
147
|
|
|
148
|
+
function normalizeSelectorsToFindRegionsForArray(selectorsToFindRegionsFor) {
|
|
149
|
+
const arr = []
|
|
150
|
+
for (let i = 0; i < selectorsToFindRegionsFor.length; i += 2) {
|
|
151
|
+
arr.push({
|
|
152
|
+
selector: selectorsToFindRegionsFor[i],
|
|
153
|
+
type: selectorsToFindRegionsFor[i + 1],
|
|
154
|
+
})
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return arr
|
|
158
|
+
}
|
|
159
|
+
|
|
144
160
|
module.exports = main
|
|
@@ -179,6 +179,11 @@ async function main(argv, {shouldExitOnError = false} = {}) {
|
|
|
179
179
|
'target an element inside a shadow-root or an iframe. Specify selectors in the following format: --chained-selectors "<selector1>" "<nodeType(iframe | shadow-root | element)>" "<selector2>" "<nodeType>"',
|
|
180
180
|
type: 'array',
|
|
181
181
|
})
|
|
182
|
+
.option('selectors-to-find-regions-for', {
|
|
183
|
+
describe:
|
|
184
|
+
'selectors to find regions for - Specify selectors in the following format: "<selector1>" "xpath || css" <selector2>" "xpath || css"...',
|
|
185
|
+
type: 'array',
|
|
186
|
+
})
|
|
182
187
|
.option('region', {
|
|
183
188
|
describe: 'target a specific region',
|
|
184
189
|
type: 'string',
|
|
@@ -388,6 +393,11 @@ async function main(argv, {shouldExitOnError = false} = {}) {
|
|
|
388
393
|
choices: ['viewport', 'full-page', 'selector', 'full-selector'],
|
|
389
394
|
default: 'full-page',
|
|
390
395
|
})
|
|
396
|
+
.option('selectors-to-find-regions-for', {
|
|
397
|
+
describe:
|
|
398
|
+
'selectors to find regions for - Specify selectors in the following format: "<selector1>" "xpath || css" <selector2>" "xpath || css"...',
|
|
399
|
+
type: 'array',
|
|
400
|
+
})
|
|
391
401
|
.option('selector', {
|
|
392
402
|
describe: 'target a specific element (via CSS selector)',
|
|
393
403
|
type: 'string',
|