@wdio/visual-service 8.0.2 → 8.0.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,94 @@
1
1
  # @wdio/visual-service
2
2
 
3
+ ## 8.0.4
4
+
5
+ ### Patch Changes
6
+
7
+ - d88d8dd: Optimize Mobile and Emulated device support
8
+
9
+ ## 🐛 Bugfixes
10
+
11
+ ### #969 Fix layer injection on mobile devices
12
+
13
+ On some devices the layer injection, to determine the exact position of the webview, was failing. It exceeded the appium timeout and returned an error like
14
+
15
+ ```logs
16
+ [1] [0-0] 2025-05-23T08:04:11.788Z INFO webdriver: COMMAND getUrl()
17
+ [1] [0-0] 2025-05-23T08:04:11.789Z INFO webdriver: [GET] https://hub-cloud.browserstack.com/wd/hub/session/xxxxx/url
18
+ [1] [0-0] 2025-05-23T08:04:12.036Z INFO webdriver: RESULT about:blank
19
+ [1] [0-0] 2025-05-23T08:04:12.038Z INFO webdriver: COMMAND navigateTo("data:text/html;base64,CiAgICAgICAgPG .... LONG LIST OF CHARACTERS=")
20
+ [1] [0-0] 2025-05-23T08:04:12.038Z INFO webdriver: [POST] https://hub-cloud.browserstack.com/wd/hub/session/xxxx/url
21
+ [1] [0-0] 2025-05-23T08:04:12.038Z INFO webdriver: DATA {
22
+ [1] [0-0] url: 'data:text/html;base64,CiAgICAgICAgPGh0bWw.... LONG LIST OF CHARACTERS='
23
+ [1] [0-0] }
24
+ [1] [0-0] 2025-05-23T08:05:42.132Z ERROR @wdio/utils:shim: Error: WebDriverError: The operation was aborted due to timeout when running "url" with method "POST" and args "{"url":"data:text/html;base64,CiAgICAgICAgPGh0b.... LONG LIST OF CHARACTERS="}"
25
+ [1] [0-0] at FetchRequest._libRequest (file:///xxxxxxx/node_modules/webdriver/build/node.js:1836:13)
26
+ [1] [0-0] 2025-05-23T08:05:42.132Z DEBUG @wdio/utils:shim: Finished to run "before" hook in 91147ms
27
+ [1] [0-0] at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
28
+ [1] [0-0] at async FetchRequest._request (file:///C:/xxxxxx/node_modules/webdriver/build/node.js:1846:20)
29
+ [1] [0-0] at Browser.wrapCommandFn (c:/Projects/xxxxxx/node_modules/@wdio/utils/build/index.js:907:23)
30
+ [1] [0-0] at Browser.url (c:/Projects/xxxxxxx/node_modules/webdriverio/build/node.js:5682:3)
31
+ [1] [0-0] at Browser.wrapCommandFn (c:/Projects/xxxxxx/node_modules/@wdio/utils/build/index.js:907:23)
32
+ [1] [0-0] at async loadBase64Html (file:///C:/Projects/xxxxxx/node_modules/webdriver-image-comparison/dist/helpers/utils.js:377:5)
33
+ [1] [0-0] at async getMobileViewPortPosition (file:///C:/Projects/xxxxxx/node_modules/webdriver-image-comparison/dist/helpers/utils.js:417:9)
34
+ [1] [0-0] at async getMobileInstanceData (file:///C:/Projects/xxxxxx/node_modules/@wdio/visual-service/dist/utils.js:58:28)
35
+ [1] [0-0] at async getInstanceData (file:///C:/Projects/xxxxxxx/node_modules/@wdio/visual-service/dist/utils.js:189:77)
36
+ [1] [0-0] 2025-05-23T08:05:42.144Z INFO @wdio/browserstack-service: Update job with sessionId xxxxx
37
+ ```
38
+
39
+ This was caused by the `await url(`data:text/html;base64,${base64Html}`)` that injected the layer. Some browsers couldn't handle the `data:text/html;base64`.
40
+
41
+ We now fixed that with a different injection. It was tested on Android/iOS and on Sims/Emus/Real Devices and it worked
42
+
43
+ ### Improve determining if a device is emulated
44
+
45
+ In a previous release we added a function to determine if a device was emulated. This resulted in incorrect screen sizes that were used for the files names for devices. This caused or failing baselines, or new files to be created because the screen sizes were not available
46
+ We now improved the check and the correct screen sizes are added again to the file names and made sure that the previous generated base line could be used again.
47
+
48
+ ## Committers: 1
49
+
50
+ - Wim Selles ([@wswebcreation](https://github.com/wswebcreation))
51
+
52
+ - Updated dependencies [d88d8dd]
53
+ - webdriver-image-comparison@9.0.4
54
+
55
+ ## 8.0.3
56
+
57
+ ### Patch Changes
58
+
59
+ - 2f9ec42: ## 🐛 Bug-fixes
60
+
61
+ ### #967: Emulated device crops with `enableLegacyScreenshotMethod` set to `true` are not correct
62
+
63
+ When a screenshot of an emulated device is taken, but the browser was initially started as a "desktop" session, so not with emulated caps, and the `enableLegacyScreenshotMethod` property is set to `true`, the DPR of the emulated device is taken. This resulted in incorrect crop. We now store the original dpr and use that for the crop when it's an emulated device and started as a desktop browser session.
64
+
65
+ ## BiDi Fullpage screenshots for emulated device are broken
66
+
67
+ The BiDi fullpage screenshot for an emulated device is broken in the driver. We now fallback to the legacy screenshot method for BiDi and emulated devices
68
+
69
+ ## 💅 Polish
70
+
71
+ - Updated the multiple interfaces to use JS-Doc for better docs
72
+ - When `createJsonReportFiles` is set to `true` and there are a lot of differences we kept waiting. We now limited that to check a max of 5M diff-pixels or a diff threshold of 20%. If it's bigger the report will show a full coverage and extra logs are shown in the WDIO logs, something like this
73
+
74
+ ```logs
75
+ [0-0] 2025-05-24T06:02:18.887Z INFO @wdio/visual-service:webdriver-image-comparison:pixelDiffProcessing: Processing diff pixels started
76
+ [0-0] 2025-05-24T06:02:18.888Z INFO @wdio/visual-service:webdriver-image-comparison:pixelDiffProcessing: Processing 20143900 diff pixels
77
+ [0-0] 2025-05-24T06:02:19.770Z INFO @wdio/visual-service:webdriver-image-comparison:pixelDiffProcessing: Total pixels in image: 52,184,160
78
+ [0-0] 2025-05-24T06:02:19.770Z INFO @wdio/visual-service:webdriver-image-comparison:pixelDiffProcessing: Number of diff pixels: 20,143,900
79
+ [0-0] 2025-05-24T06:02:19.770Z INFO @wdio/visual-service:webdriver-image-comparison:pixelDiffProcessing: Diff percentage: 38.60%
80
+ [0-0] 2025-05-24T06:02:19.770Z ERROR @wdio/visual-service:webdriver-image-comparison:pixelDiffProcessing: Too many differences detected! Diff percentage: 38.60%, Diff pixels: 20,143,900
81
+ [0-0] 2025-05-24T06:02:19.771Z ERROR @wdio/visual-service:webdriver-image-comparison:pixelDiffProcessing: This likely indicates a major visual difference or an issue with the comparison.
82
+ [0-0] 2025-05-24T06:02:19.771Z ERROR @wdio/visual-service:webdriver-image-comparison:pixelDiffProcessing: Consider checking if the baseline image is correct or if there are major UI changes.
83
+ ```
84
+
85
+ ## Committers: 1
86
+
87
+ - Wim Selles ([@wswebcreation](https://github.com/wswebcreation))
88
+
89
+ - Updated dependencies [2f9ec42]
90
+ - webdriver-image-comparison@9.0.3
91
+
3
92
  ## 8.0.2
4
93
 
5
94
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AACpF,OAAO,KAAK,EACR,wBAAwB,EACxB,sBAAsB,EACtB,sBAAsB,EAIzB,MAAM,YAAY,CAAA;AAEnB;;;;;GAKG;AAEH,wBAAgB,UAAU,CACtB,aAAa,EAAE,sBAAsB,EACrC,OAAO,EAAE,OAAO,EAChB,eAAe,EAAE,MAAM,GACxB,OAAO,CAMT;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,MAAM,EAAE,iBAAiB,SAAI,GAAG;IAChF,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACjB,CAKA;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,gBAAgB,EAAE;IAAC,MAAM,EAAC,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAC,GAAG,MAAM,CAOhH;AAiGD;;GAEG;AACH,wBAAgB,YAAY,CAAC,YAAY,EAAE,WAAW,CAAC,YAAY,GAAG,GAAG,GAAG,SAAS,CAMpF;AAmCD;;GAEG;AACH,wBAAsB,eAAe,CAAC,EAClC,cAAc,EACd,uBAAuB,EACvB,eAAe,EAClB,EAAE,sBAAsB,GAAG,OAAO,CAAC,YAAY,CAAC,C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UAAU,EAAE,MAAM,EAAE,gBAAgB,EAAE;IAAC,MAAM,EAAC,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAC,GAAG,MAAM,CAOhH;AAiGD;;GAEG;AACH,wBAAgB,YAAY,CAAC,YAAY,EAAE,WAAW,CAAC,YAAY,GAAG,GAAG,GAAG,SAAS,CAMpF;AAmCD;;GAEG;AACH,wBAAsB,eAAe,CAAC,EAClC,cAAc,EACd,uBAAuB,EACvB,eAAe,EAClB,EAAE,sBAAsB,GAAG,OAAO,CAAC,YAAY,CAAC,CAoEhD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAE,IAAI,EAAE,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,CAGtG;AAOD,wBAAgB,gBAAgB,CAAC,EAAE,YAAY,EAAE,QAAQ,EAAE,EACvD;IAAE,YAAY,EAAE,WAAW,CAAC,YAAY,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,GAC9D,OAAO,CAuBT;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC7B,EACI,WAAW,EACX,kBAAkB,EAAE,EAChB,SAAS,EACT,MAAM,EACN,KAAK,GACR,EACD,YAAY,EAAE,EACV,OAAO,EACP,WAAW,EACX,cAAc,EACd,UAAU,EACV,SAAS,EACT,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,eAAe,GAClB,EACD,GAAG,GACN,EAAE,wBAAwB,GAAG,WAAW,CAuB5C;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,WAAW,CAAC,OAAO,GAAG,OAAO,CAK9E"}
package/dist/utils.js CHANGED
@@ -160,7 +160,10 @@ export async function getInstanceData({ currentBrowser, initialDeviceRectangles,
160
160
  // Generic data
161
161
  const browserName = rawBrowserName === '' ? NOT_KNOWN : rawBrowserName.toLowerCase();
162
162
  const browserVersion = rawBrowserVersion === '' ? NOT_KNOWN : rawBrowserVersion.toLowerCase();
163
- let devicePixelRatio = 1;
163
+ // For #967: When a screenshot of an emulated device is taken, but the browser was initially
164
+ // started as a "desktop" session, so not with emulated caps, we need to store the initial
165
+ // devicePixelRatio when we take a screenshot and enableLegacyScreenshotMethod is enabled
166
+ let devicePixelRatio = !currentBrowser.isMobile ? (await currentBrowser.execute('return window.devicePixelRatio')) : 1;
164
167
  const platformName = rawPlatformName === '' ? NOT_KNOWN : rawPlatformName.toLowerCase();
165
168
  const logName = 'wdio-ics:options' in requestedCapabilities
166
169
  ? requestedCapabilities['wdio-ics:options']?.logName ?? ''
@@ -195,6 +198,7 @@ export async function getInstanceData({ currentBrowser, initialDeviceRectangles,
195
198
  deviceName,
196
199
  devicePixelRatio,
197
200
  deviceRectangles,
201
+ initialDevicePixelRatio: devicePixelRatio,
198
202
  isAndroid,
199
203
  isIOS,
200
204
  isMobile,
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@wdio/visual-service",
3
3
  "author": "Wim Selles - wswebcreation",
4
4
  "description": "Image comparison / visual regression testing for WebdriverIO",
5
- "version": "8.0.2",
5
+ "version": "8.0.4",
6
6
  "license": "MIT",
7
7
  "homepage": "https://webdriver.io/docs/visual-testing",
8
8
  "repository": {
@@ -22,9 +22,9 @@
22
22
  "dependencies": {
23
23
  "@wdio/globals": "^9.13.0",
24
24
  "@wdio/logger": "^9.4.4",
25
- "@wdio/types": "^9.13.0",
25
+ "@wdio/types": "^9.14.0",
26
26
  "expect-webdriverio": "^5.1.0",
27
- "webdriver-image-comparison": "9.0.2"
27
+ "webdriver-image-comparison": "9.0.4"
28
28
  },
29
29
  "scripts": {
30
30
  "build": "run-s clean build:*",