@applitools/visual-grid-cli-utils 1.21.37 → 1.21.39

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.37",
3
+ "version": "1.21.39",
4
4
  "description": "",
5
5
  "main": "src/visual-grid-cli-utils.js",
6
6
  "engines": {
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@applitools/dom-snapshot": "^4.5.7",
40
- "@applitools/eyes-images": "^4.21.0",
40
+ "@applitools/eyes-images": "4.21.0",
41
41
  "@applitools/functional-commons": "^1.6.0",
42
42
  "@applitools/http-commons": "^2.4.3",
43
43
  "@applitools/screenshot-stitching-client": "^8.0.15",
@@ -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": "^5.5.0",
52
+ "puppeteer": "^24.34.0",
53
53
  "throat": "^5.0.0",
54
54
  "uuid": "^8.3.2",
55
55
  "yargs": "^16.2.0"
package/src/compare.js CHANGED
@@ -13,10 +13,10 @@ async function main(args) {
13
13
  runRerender(args.browser1.browser),
14
14
  runRerender(args.browser2.browser),
15
15
  ])
16
- await compareWithEyes(results)
16
+ await compareWithEyes(results, args)
17
17
  }
18
18
 
19
- async function compareWithEyes(rerenderResults) {
19
+ async function compareWithEyes(rerenderResults, args) {
20
20
  const eyes = new Eyes()
21
21
  let batchUrl
22
22
  try {
@@ -32,7 +32,10 @@ async function compareWithEyes(rerenderResults) {
32
32
  const uuid = randomUUID()
33
33
  let i = 0
34
34
  for (const result of rerenderResults) {
35
- await eyes.open('VG-CLI compare', `Compare browsers ${uuid}`)
35
+ await eyes.open('VG-CLI compare', `Compare browsers ${uuid}`, {
36
+ width: args.width || 800,
37
+ height: args.height || 600,
38
+ })
36
39
  const {browser: name, image: file} = result
37
40
  const resp = await eyes.check(name, Target.image(file))
38
41
  batchUrl = batchUrl || eyes.getRunningSession().getUrl()
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(