@applitools/visual-grid-cli-utils 1.21.19 → 1.21.20
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
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
function normalizeChainedSelectorsArray(chainedSelectors) {
|
|
3
|
+
const cs = []
|
|
4
|
+
for (let i = 0; i < chainedSelectors.length; i += 2) {
|
|
5
|
+
cs.push({
|
|
6
|
+
selector: chainedSelectors[i],
|
|
7
|
+
type: chainedSelectors[i].startsWith('//') ? 'xpath' : 'css',
|
|
8
|
+
nodeType: i + 1 < chainedSelectors.length ? chainedSelectors[i + 1] : 'element',
|
|
9
|
+
})
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return cs
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
module.exports = normalizeChainedSelectorsArray
|
package/src/rerender.js
CHANGED
|
@@ -10,6 +10,7 @@ const {writeImageLocationToFile, writeDomLocationToFile} = require('./write-imag
|
|
|
10
10
|
const {plotDomCaptureToHtml} = require('./plot-dom-capture-to-html')
|
|
11
11
|
const {convertBrowserNameToCanary} = require('./commons/parse-browser')
|
|
12
12
|
const parseJson = require('./commons/parse-json.js')
|
|
13
|
+
const normalizeChainedSelectorsArray = require('./commons/normalizeChainedSelectorsArray')
|
|
13
14
|
|
|
14
15
|
async function main({
|
|
15
16
|
apiKey,
|
|
@@ -175,19 +176,6 @@ async function main({
|
|
|
175
176
|
return {reRenderId}
|
|
176
177
|
}
|
|
177
178
|
|
|
178
|
-
function normalizeChainedSelectorsArray(chainedSelectors) {
|
|
179
|
-
const cs = []
|
|
180
|
-
for (let i = 0; i < chainedSelectors.length; i += 2) {
|
|
181
|
-
cs.push({
|
|
182
|
-
selector: chainedSelectors[i],
|
|
183
|
-
type: chainedSelectors[i].startsWith('//') ? 'xpath' : 'css',
|
|
184
|
-
nodeType: i + 1 < chainedSelectors.length ? chainedSelectors[i + 1] : 'element',
|
|
185
|
-
})
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
return cs
|
|
189
|
-
}
|
|
190
|
-
|
|
191
179
|
function normalizeSelectorsToFindRegionsForArray(selectorsToFindRegionsFor) {
|
|
192
180
|
const arr = []
|
|
193
181
|
for (let i = 0; i < selectorsToFindRegionsFor.length; i += 2) {
|
package/src/test-url.js
CHANGED
|
@@ -8,6 +8,7 @@ const createSession = require('./commons/create-session')
|
|
|
8
8
|
const calculateViewRenderingUrl = require('./commons/view-rendering-url')
|
|
9
9
|
const {convertBrowserNameToCanary} = require('./commons/parse-browser')
|
|
10
10
|
const parseJson = require('./commons/parse-json.js')
|
|
11
|
+
const normalizeChainedSelectorsArray = require('./commons/normalizeChainedSelectorsArray')
|
|
11
12
|
|
|
12
13
|
async function main({
|
|
13
14
|
apiKey,
|
|
@@ -16,6 +17,7 @@ async function main({
|
|
|
16
17
|
height,
|
|
17
18
|
target,
|
|
18
19
|
selector,
|
|
20
|
+
chainedSelectors,
|
|
19
21
|
rca,
|
|
20
22
|
iosDeviceName,
|
|
21
23
|
iosDeviceOrientation,
|
|
@@ -114,8 +116,13 @@ async function main({
|
|
|
114
116
|
checkWindow({
|
|
115
117
|
snapshot: frame,
|
|
116
118
|
url: frame.url,
|
|
117
|
-
target: selector ? 'region' : target,
|
|
118
|
-
|
|
119
|
+
// target: selector ? 'region' : target,
|
|
120
|
+
sizeMode: selector ? 'region' : target,
|
|
121
|
+
selector: selector
|
|
122
|
+
? {selector, type: selector.startsWith('//') ? 'xpath' : 'css'}
|
|
123
|
+
: chainedSelectors
|
|
124
|
+
? normalizeChainedSelectorsArray(chainedSelectors)
|
|
125
|
+
: undefined,
|
|
119
126
|
sendDom: rca,
|
|
120
127
|
visualGridOptions: options,
|
|
121
128
|
...(selectorsToFindRegionsFor && {
|
|
@@ -402,6 +402,11 @@ async function main(argv, {shouldExitOnError = false} = {}) {
|
|
|
402
402
|
describe: 'target a specific element (via CSS selector)',
|
|
403
403
|
type: 'string',
|
|
404
404
|
})
|
|
405
|
+
.option('chained-selectors', {
|
|
406
|
+
describe:
|
|
407
|
+
'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>"',
|
|
408
|
+
type: 'array',
|
|
409
|
+
})
|
|
405
410
|
.option('width', {
|
|
406
411
|
describe: 'width of viewport',
|
|
407
412
|
type: 'number',
|