@wdio/visual-service 9.2.1 → 9.2.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 +89 -0
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,97 @@
|
|
|
1
1
|
# @wdio/visual-service
|
|
2
2
|
|
|
3
|
+
## 9.2.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- c56e1ae: ## #1146 Fix BiDi element screenshots missing composited layers (scrollbars, fixed/sticky overlays)
|
|
8
|
+
|
|
9
|
+
### Root cause
|
|
10
|
+
|
|
11
|
+
When `checkElement` / `saveElement` is used with the WebDriver BiDi protocol, the screenshot was taken with `browsingContext.captureScreenshot` using `origin: 'document'`. This renders the document layout independently of the browser's compositor, which means **composited layers are never included** — element-level scrollbars, `position: fixed` / `position: sticky` overlays, and elements with a `will-change` CSS property all render as invisible or without their correct visual state.
|
|
12
|
+
|
|
13
|
+
The switch to `origin: 'document'` was introduced in an earlier fix (commit `227f10a`) to avoid a `zero dimensions` error that occurred when `origin: 'viewport'` was used for elements that were outside the visible viewport. That fix was correct for out-of-viewport elements, but it also silently broke composited-layer capture for all elements.
|
|
14
|
+
|
|
15
|
+
### Fix: new `biDiOrigin` method option
|
|
16
|
+
|
|
17
|
+
A new **method-level** option `biDiOrigin` has been added to `saveElement` / `checkElement`. It is BiDi-only and ignored for the legacy WebDriver screenshot path.
|
|
18
|
+
|
|
19
|
+
| Value | Behaviour |
|
|
20
|
+
| ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
21
|
+
| `'document'` _(default)_ | Previous behaviour — works for any element position but composited layers (scrollbars, overlays, `will-change`) are not captured |
|
|
22
|
+
| `'viewport'` | Captures the composited frame as the browser painted it — scrollbars, fixed/sticky overlays and `will-change` layers are included. The element must be visible in the viewport; descriptive errors are thrown when it is not |
|
|
23
|
+
|
|
24
|
+
#### Usage
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
// Capture an element with its scrollbar / overlay visible:
|
|
28
|
+
await browser.checkElement(element, "myTag", { biDiOrigin: "viewport" });
|
|
29
|
+
await browser.saveElement(element, "myTag", { biDiOrigin: "viewport" });
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
#### Error messages when `biDiOrigin: 'viewport'` cannot produce a valid screenshot
|
|
33
|
+
|
|
34
|
+
**Element larger than the viewport** — must fall back to `'document'`:
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
[BiDi viewport screenshot] The element dimensions (1400x800px) exceed the viewport (1280x720px).
|
|
38
|
+
You must use the default `biDiOrigin: 'document'` for this element.
|
|
39
|
+
Note: with `'document'` origin, composited layers such as scrollbars, fixed/sticky overlays,
|
|
40
|
+
and elements using `will-change` may not appear in the screenshot.
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**Element not in the viewport at all** — needs scrolling:
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
[BiDi viewport screenshot] The element is not in the viewport
|
|
47
|
+
(element: x=0, y=900, 300x200px; viewport: 1280x720px).
|
|
48
|
+
Call `element.scrollIntoView()` before taking the screenshot, or set `autoElementScroll: true`.
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**Element partially outside the viewport but fits** — needs to be scrolled fully into view:
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
[BiDi viewport screenshot] The element is not fully visible in the viewport
|
|
55
|
+
(element: x=-20, y=100, 300x200px; viewport: 1280x720px).
|
|
56
|
+
The element fits within the viewport — scroll it fully into view by calling
|
|
57
|
+
`element.scrollIntoView()` or setting `autoElementScroll: true`.
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Committers: 1
|
|
61
|
+
|
|
62
|
+
- Wim Selles ([@wswebcreation](https://github.com/wswebcreation))
|
|
63
|
+
|
|
64
|
+
- Updated dependencies [c56e1ae]
|
|
65
|
+
- @wdio/image-comparison-core@1.2.3
|
|
66
|
+
|
|
67
|
+
## 9.2.2
|
|
68
|
+
|
|
69
|
+
### Patch Changes
|
|
70
|
+
|
|
71
|
+
- db33fa7: #### `@wdio/image-comparison-core` and `@wdio/ocr-service` Security: update jimp (CVE in `file-type` transitive dep)
|
|
72
|
+
|
|
73
|
+
Bumped `jimp` to the latest version to resolve a reported vulnerability in its `file-type` transitive dependency (see [#1130](https://github.com/webdriverio/visual-testing/issues/1130), raised by [@denis-sokolov](https://github.com/denis-sokolov), thank you!).
|
|
74
|
+
|
|
75
|
+
**Actual impact on these packages**
|
|
76
|
+
`file-type` is used by `@jimp/core` solely to detect image MIME types when reading a buffer. In both `@wdio/image-comparison-core` and `@wdio/ocr-service`, every image passed to jimp originates from either WebDriver screenshots (browser-controlled base64 data) or local files written by the framework itself. There is no code path where untrusted external input is fed directly into jimp, which removes the exploitability that the CVE describes.
|
|
77
|
+
|
|
78
|
+
That said, the reputational and compliance risk was real, security scanners flag the package as vulnerable, enterprise users hit audit failures, and some organisations block installation of packages with known CVEs. The update addresses all of that.
|
|
79
|
+
|
|
80
|
+
#### `@wdio/visual-reporter` and `@wdio/visual-service`
|
|
81
|
+
|
|
82
|
+
Updated internal dependencies to pick up the jimp bump in `@wdio/image-comparison-core`.
|
|
83
|
+
|
|
84
|
+
### Committers: 1
|
|
85
|
+
|
|
86
|
+
- Wim Selles ([@wswebcreation](https://github.com/wswebcreation))
|
|
87
|
+
|
|
88
|
+
- Updated dependencies [db33fa7]
|
|
89
|
+
- @wdio/image-comparison-core@1.2.2
|
|
90
|
+
|
|
3
91
|
## 9.2.1
|
|
4
92
|
|
|
5
93
|
### Patch Changes
|
|
94
|
+
|
|
6
95
|
- d5afb54: ## #1129 Fix `TypeError: element.getBoundingClientRect is not a function` when a `ChainablePromiseElement` is passed to `checkElement`
|
|
7
96
|
|
|
8
97
|
When `checkElement` (or `saveElement`) was called with a `ChainablePromiseElement`, the lazy promise-based element reference that WebdriverIO's `$()` returns, the element was passed directly as an argument to `browser.execute()` without being awaited first. `browser.execute()` serializes its arguments for transfer to the browser context and cannot handle a pending Promise, so it arrived in the browser as a plain empty object `{}` instead of a WebElement reference. This caused `element.getBoundingClientRect is not a function` because the browser-side `scrollElementIntoView` script received `{}` rather than a DOM element.
|
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": "9.2.
|
|
5
|
+
"version": "9.2.3",
|
|
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.27.0",
|
|
24
24
|
"@wdio/logger": "^9.18.0",
|
|
25
|
-
"@wdio/types": "^9.
|
|
26
|
-
"expect-webdriverio": "^5.6.
|
|
27
|
-
"@wdio/image-comparison-core": "1.2.
|
|
25
|
+
"@wdio/types": "^9.27.0",
|
|
26
|
+
"expect-webdriverio": "^5.6.5",
|
|
27
|
+
"@wdio/image-comparison-core": "1.2.3"
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
30
|
"build": "run-s clean build:*",
|