@wdio/visual-service 7.0.0 β 8.0.1
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 +101 -0
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +4 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,106 @@
|
|
|
1
1
|
# @wdio/visual-service
|
|
2
2
|
|
|
3
|
+
## 8.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 5c6c6e2: Fix capturing element screenshots with BiDi
|
|
8
|
+
|
|
9
|
+
This release fixes #919 where an element screenshot, that was for example from an overlay, dropdown, popover, tooltip, modal, was returning an incorrect screenshot
|
|
10
|
+
|
|
11
|
+
## Committers: 1
|
|
12
|
+
|
|
13
|
+
- Wim Selles ([@wswebcreation](https://github.com/wswebcreation))
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [5c6c6e2]
|
|
16
|
+
- webdriver-image-comparison@9.0.1
|
|
17
|
+
|
|
18
|
+
## 8.0.0
|
|
19
|
+
|
|
20
|
+
### Major Changes
|
|
21
|
+
|
|
22
|
+
- bfe6aca: ## π₯ BREAKING CHANGES
|
|
23
|
+
|
|
24
|
+
### π§ͺ Web Screenshot Strategy Now Uses BiDi by Default
|
|
25
|
+
|
|
26
|
+
#### What was the problem?
|
|
27
|
+
|
|
28
|
+
Screenshots taken via WebDriver's traditional protocol often lacked precision:
|
|
29
|
+
|
|
30
|
+
- Emulated devices didn't reflect true resolutions
|
|
31
|
+
- Device Pixel Ratio (DPR) was often lost
|
|
32
|
+
- Images were cropped or downscaled
|
|
33
|
+
|
|
34
|
+
#### What changed?
|
|
35
|
+
|
|
36
|
+
All screenshot-related methods now use the **WebDriver BiDi protocol** by default (if supported by the browser), enabling:
|
|
37
|
+
|
|
38
|
+
β
Native support for emulated and high-DPR devices
|
|
39
|
+
β
Better fidelity in screenshot size and clarity
|
|
40
|
+
β
Faster, browser-native screenshots via [`browsingContext.captureScreenshot`](https://w3c.github.io/webdriver-bidi/#command-browsingContext-captureScreenshot)
|
|
41
|
+
|
|
42
|
+
The following methods now use BiDi:
|
|
43
|
+
|
|
44
|
+
- `saveScreen` / `checkScreen`
|
|
45
|
+
- `saveElement` / `checkElement`
|
|
46
|
+
- `saveFullPageScreen` / `checkFullPageScreen`
|
|
47
|
+
|
|
48
|
+
#### Whatβs the impact?
|
|
49
|
+
|
|
50
|
+
β οΈ **Existing baselines may no longer match.**
|
|
51
|
+
Because BiDi screenshots are **sharper** and **match device settings more accurately**, even a small difference in resolution or DPR can cause mismatches.
|
|
52
|
+
|
|
53
|
+
> If you rely on existing baseline images, you'll need to regenerate them to avoid false positives.
|
|
54
|
+
|
|
55
|
+
#### Want to keep using the legacy method?
|
|
56
|
+
|
|
57
|
+
You can disable BiDi screenshots globally or per test using the `enableLegacyScreenshotMethod` flag:
|
|
58
|
+
|
|
59
|
+
**Globally in `wdio.conf.ts`:**
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
import { join } from "node:path";
|
|
63
|
+
|
|
64
|
+
export const config = {
|
|
65
|
+
services: [
|
|
66
|
+
[
|
|
67
|
+
"visual",
|
|
68
|
+
{
|
|
69
|
+
baselineFolder: join(process.cwd(), "./localBaseline/"),
|
|
70
|
+
debug: true,
|
|
71
|
+
formatImageName: "{tag}-{logName}-{width}x{height}",
|
|
72
|
+
screenshotPath: join(process.cwd(), ".tmp/"),
|
|
73
|
+
enableLegacyScreenshotMethod: true, // π fallback to W3C-based screenshots
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
],
|
|
77
|
+
};
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**Or per test:**
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
it("should compare an element successfully using legacy screenshots", async function () {
|
|
84
|
+
await expect($(".hero__title-logo")).toMatchElementSnapshot(
|
|
85
|
+
"legacyScreenshotLogo",
|
|
86
|
+
{ enableLegacyScreenshotMethod: true } // π fallback to W3C-based screenshots
|
|
87
|
+
);
|
|
88
|
+
});
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## π Bug Fixes
|
|
92
|
+
|
|
93
|
+
- β
[#916](https://github.com/webdriverio/visual-testing/issues/916): Visual Testing Screenshot Behavior Changed in Emulated Devices
|
|
94
|
+
|
|
95
|
+
## Committers: 1
|
|
96
|
+
|
|
97
|
+
- Wim Selles ([@wswebcreation](https://github.com/wswebcreation))
|
|
98
|
+
|
|
99
|
+
### Patch Changes
|
|
100
|
+
|
|
101
|
+
- Updated dependencies [bfe6aca]
|
|
102
|
+
- webdriver-image-comparison@9.0.0
|
|
103
|
+
|
|
3
104
|
## 7.0.0
|
|
4
105
|
|
|
5
106
|
### Major Changes
|
package/dist/service.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAgB,UAAU,EAAE,MAAM,aAAa,CAAA;AAC3D,OAAO,EACH,SAAS,EAWZ,MAAM,4BAA4B,CAAA;AAkBnC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAEtD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAepD,MAAM,CAAC,OAAO,OAAO,0BAA2B,SAAQ,SAAS;;IAM7D,OAAO,CAAC,eAAe,CAAC,CAAgB;IACxC,OAAO,CAAC,gBAAgB,CAAC,CAAyC;gBAEtD,OAAO,EAAE,oBAAoB,EAAE,CAAC,EAAE,WAAW,CAAC,YAAY,EAAE,MAAM,EAAE,WAAW,CAAC,MAAM;IAMlG;;OAEG;IACG,WAAW,CAAC,OAAO,EAAE,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,kBAAkB;IAIzE,MAAM,CACR,YAAY,EAAE,WAAW,CAAC,YAAY,EACtC,MAAM,EAAE,MAAM,EAAE,EAChB,OAAO,EAAE,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,kBAAkB;IA2B3D,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI;IAOtC,cAAc,CAAC,KAAK,EAAE,UAAU,CAAC,KAAK;
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAgB,UAAU,EAAE,MAAM,aAAa,CAAA;AAC3D,OAAO,EACH,SAAS,EAWZ,MAAM,4BAA4B,CAAA;AAkBnC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAEtD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAepD,MAAM,CAAC,OAAO,OAAO,0BAA2B,SAAQ,SAAS;;IAM7D,OAAO,CAAC,eAAe,CAAC,CAAgB;IACxC,OAAO,CAAC,gBAAgB,CAAC,CAAyC;gBAEtD,OAAO,EAAE,oBAAoB,EAAE,CAAC,EAAE,WAAW,CAAC,YAAY,EAAE,MAAM,EAAE,WAAW,CAAC,MAAM;IAMlG;;OAEG;IACG,WAAW,CAAC,OAAO,EAAE,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,kBAAkB;IAIzE,MAAM,CACR,YAAY,EAAE,WAAW,CAAC,YAAY,EACtC,MAAM,EAAE,MAAM,EAAE,EAChB,OAAO,EAAE,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,kBAAkB;IA2B3D,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI;IAOtC,cAAc,CAAC,KAAK,EAAE,UAAU,CAAC,KAAK;IAqctC,IAAI,cAAc,IAAI,cAAc,CAKnC;CACJ"}
|
package/dist/service.js
CHANGED
|
@@ -159,10 +159,12 @@ export default class WdioImageComparisonService extends BaseClass {
|
|
|
159
159
|
const isCurrentContextNative = self.contextManager.isNativeContext;
|
|
160
160
|
return [{
|
|
161
161
|
methods: {
|
|
162
|
+
bidiScreenshot: isBiDiScreenshotSupported(browser) ? this.browsingContextCaptureScreenshot.bind(browser) : undefined,
|
|
162
163
|
executor: (fn, ...args) => {
|
|
163
164
|
return this.execute(fn, ...args);
|
|
164
165
|
},
|
|
165
166
|
getElementRect: this.getElementRect.bind(this),
|
|
167
|
+
getWindowHandle: this.getWindowHandle.bind(browser),
|
|
166
168
|
screenShot: this.takeScreenshot.bind(this),
|
|
167
169
|
takeElementScreenshot: this.takeElementScreenshot.bind(this),
|
|
168
170
|
},
|
|
@@ -337,10 +339,12 @@ export default class WdioImageComparisonService extends BaseClass {
|
|
|
337
339
|
const isCurrentContextNative = contextManager.isNativeContext;
|
|
338
340
|
return [{
|
|
339
341
|
methods: {
|
|
342
|
+
bidiScreenshot: isBiDiScreenshotSupported(browserInstance) ? browserInstance.browsingContextCaptureScreenshot.bind(browserInstance) : undefined,
|
|
340
343
|
executor: (fn, ...args) => {
|
|
341
344
|
return browserInstance.execute(fn, ...args);
|
|
342
345
|
},
|
|
343
346
|
getElementRect: browserInstance.getElementRect.bind(browserInstance),
|
|
347
|
+
getWindowHandle: browserInstance.getWindowHandle.bind(browserInstance),
|
|
344
348
|
screenShot: browserInstance.takeScreenshot.bind(browserInstance),
|
|
345
349
|
},
|
|
346
350
|
instanceData: updatedInstanceData,
|
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": "
|
|
5
|
+
"version": "8.0.1",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://webdriver.io/docs/visual-testing",
|
|
8
8
|
"repository": {
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
"type": "module",
|
|
21
21
|
"types": "./dist/index.d.ts",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@wdio/globals": "^9.
|
|
23
|
+
"@wdio/globals": "^9.13.0",
|
|
24
24
|
"@wdio/logger": "^9.4.4",
|
|
25
25
|
"@wdio/types": "^9.12.6",
|
|
26
26
|
"expect-webdriverio": "^5.1.0",
|
|
27
|
-
"webdriver-image-comparison": "
|
|
27
|
+
"webdriver-image-comparison": "9.0.1"
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
30
|
"build": "run-s clean build:*",
|