@wdio/visual-service 8.0.1 → 8.0.2
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 +18 -0
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +37 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @wdio/visual-service
|
|
2
2
|
|
|
3
|
+
## 8.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 9363467: ## 🐛 Bug-fixes
|
|
8
|
+
|
|
9
|
+
- #946: Visual Regression Changes in WDIO v9
|
|
10
|
+
- Fixed screen size detection in emulated mode for filenames. Previously used incorrect browser window size.
|
|
11
|
+
- Fixed screenshot behavior when `enableLegacyScreenshotMethod: true`, now correctly captures emulated screen instead of complete screen.
|
|
12
|
+
- Fixed emulated device handling for Chrome and Edge browsers, now properly sets device metrics based on `deviceMetrics` or `deviceName` capabilities.
|
|
13
|
+
|
|
14
|
+
## Committers: 1
|
|
15
|
+
|
|
16
|
+
- Wim Selles ([@wswebcreation](https://github.com/wswebcreation))
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [9363467]
|
|
19
|
+
- webdriver-image-comparison@9.0.2
|
|
20
|
+
|
|
3
21
|
## 8.0.1
|
|
4
22
|
|
|
5
23
|
### Patch 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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C,IAAI;IAOtC,cAAc,CAAC,KAAK,EAAE,UAAU,CAAC,KAAK;IAqctC,IAAI,cAAc,IAAI,cAAc,CAKnC;CAyCJ"}
|
package/dist/service.js
CHANGED
|
@@ -48,6 +48,11 @@ export default class WdioImageComparisonService extends BaseClass {
|
|
|
48
48
|
else {
|
|
49
49
|
await this.#extendMultiremoteBrowser(capabilities);
|
|
50
50
|
}
|
|
51
|
+
// There is an issue with the emulation mode for Chrome or Edge with WebdriverIO v9
|
|
52
|
+
// It doesn't set the correct emulation mode for the browser based on the capabilities
|
|
53
|
+
// So we need to set the emulation mode manually
|
|
54
|
+
// this is a temporary fix until the issue is fixed in WebdriverIO v9 and enough users have upgraded to the latest version
|
|
55
|
+
await this.#setEmulation(this.#browser, capabilities);
|
|
51
56
|
/**
|
|
52
57
|
* add custom matcher for visual comparison when expect has been added.
|
|
53
58
|
* this is not the case in standalone mode
|
|
@@ -424,4 +429,36 @@ export default class WdioImageComparisonService extends BaseClass {
|
|
|
424
429
|
}
|
|
425
430
|
return this._contextManager;
|
|
426
431
|
}
|
|
432
|
+
async #setEmulationForBrowser(browserInstance, capabilities) {
|
|
433
|
+
if (!browserInstance.isBidi) {
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
436
|
+
const chromeMobileEmulation = capabilities['goog:chromeOptions']?.mobileEmulation;
|
|
437
|
+
const edgeMobileEmulation = capabilities['ms:edgeOptions']?.mobileEmulation;
|
|
438
|
+
const mobileEmulation = chromeMobileEmulation || edgeMobileEmulation;
|
|
439
|
+
if (!mobileEmulation) {
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
const { deviceName, deviceMetrics } = mobileEmulation;
|
|
443
|
+
if (deviceName) {
|
|
444
|
+
await browserInstance.emulate('device', deviceName);
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
const { pixelRatio: devicePixelRatio = 1, width = 320, height = 658 } = deviceMetrics || {};
|
|
448
|
+
await browserInstance.browsingContextSetViewport({
|
|
449
|
+
context: await browserInstance.getWindowHandle(),
|
|
450
|
+
devicePixelRatio,
|
|
451
|
+
viewport: { width, height }
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
async #setEmulation(browser, capabilities) {
|
|
455
|
+
if (browser.isMultiremote) {
|
|
456
|
+
const multiremoteBrowser = browser;
|
|
457
|
+
for (const browserInstance of Object.values(multiremoteBrowser)) {
|
|
458
|
+
await this.#setEmulationForBrowser(browserInstance, browserInstance.capabilities);
|
|
459
|
+
}
|
|
460
|
+
return;
|
|
461
|
+
}
|
|
462
|
+
await this.#setEmulationForBrowser(browser, capabilities);
|
|
463
|
+
}
|
|
427
464
|
}
|
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.
|
|
5
|
+
"version": "8.0.2",
|
|
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.
|
|
25
|
+
"@wdio/types": "^9.13.0",
|
|
26
26
|
"expect-webdriverio": "^5.1.0",
|
|
27
|
-
"webdriver-image-comparison": "9.0.
|
|
27
|
+
"webdriver-image-comparison": "9.0.2"
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
30
|
"build": "run-s clean build:*",
|