@wdio/visual-service 8.0.2 → 8.0.3

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,42 @@
1
1
  # @wdio/visual-service
2
2
 
3
+ ## 8.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 2f9ec42: ## 🐛 Bug-fixes
8
+
9
+ ### #967: Emulated device crops with `enableLegacyScreenshotMethod` set to `true` are not correct
10
+
11
+ 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.
12
+
13
+ ## BiDi Fullpage screenshots for emulated device are broken
14
+
15
+ 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
16
+
17
+ ## 💅 Polish
18
+
19
+ - Updated the multiple interfaces to use JS-Doc for better docs
20
+ - 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
21
+
22
+ ```logs
23
+ [0-0] 2025-05-24T06:02:18.887Z INFO @wdio/visual-service:webdriver-image-comparison:pixelDiffProcessing: Processing diff pixels started
24
+ [0-0] 2025-05-24T06:02:18.888Z INFO @wdio/visual-service:webdriver-image-comparison:pixelDiffProcessing: Processing 20143900 diff pixels
25
+ [0-0] 2025-05-24T06:02:19.770Z INFO @wdio/visual-service:webdriver-image-comparison:pixelDiffProcessing: Total pixels in image: 52,184,160
26
+ [0-0] 2025-05-24T06:02:19.770Z INFO @wdio/visual-service:webdriver-image-comparison:pixelDiffProcessing: Number of diff pixels: 20,143,900
27
+ [0-0] 2025-05-24T06:02:19.770Z INFO @wdio/visual-service:webdriver-image-comparison:pixelDiffProcessing: Diff percentage: 38.60%
28
+ [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
29
+ [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.
30
+ [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.
31
+ ```
32
+
33
+ ## Committers: 1
34
+
35
+ - Wim Selles ([@wswebcreation](https://github.com/wswebcreation))
36
+
37
+ - Updated dependencies [2f9ec42]
38
+ - webdriver-image-comparison@9.0.3
39
+
3
40
  ## 8.0.2
4
41
 
5
42
  ### 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,wBAAg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/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.3",
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.3"
28
28
  },
29
29
  "scripts": {
30
30
  "build": "run-s clean build:*",