@wdio/visual-service 3.0.1 → 3.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 +7 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +24 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACR,OAAO,EACP,YAAY,EACZ,wBAAwB,EACxB,uBAAuB,EACvB,0BAA0B,EAC1B,yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,EAC3B,MAAM,4BAA4B,CAAA;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACR,OAAO,EACP,YAAY,EACZ,wBAAwB,EACxB,uBAAuB,EACvB,0BAA0B,EAC1B,yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,EAC3B,MAAM,4BAA4B,CAAA;AAQnC;;;;;GAKG;AACH,KAAK,sBAAsB,GACrB,yBAAyB,GACzB,0BAA0B,GAC1B,wBAAwB,GACxB,wBAAwB,GACxB,yBAAyB,GACzB,uBAAuB,CAAC;AAE9B,wBAAgB,UAAU,CACtB,aAAa,EAAE,sBAAsB,EACrC,OAAO,EAAE,OAAO,EAChB,eAAe,EAAE,MAAM,GACxB,OAAO,CAMT;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,iBAAiB,SAAI,GAAG;IAC1E,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;AA4GD;;GAEG;AACH,wBAAsB,eAAe,CAAC,cAAc,EAAE,WAAW,CAAC,OAAO,GAAG,OAAO,CAAC,YAAY,CAAC,CA4DhG;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAE,IAAI,EAAE,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,CAGtG;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAClC,MAAM,EAAE,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,kBAAkB,GAC7D,OAAO,CAQT"}
|
package/dist/utils.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IOS_OFFSETS } from 'webdriver-image-comparison';
|
|
2
|
+
import { NOT_KNOWN } from 'webdriver-image-comparison/dist/helpers/constants.js';
|
|
2
3
|
export function getFolders(methodOptions, folders, currentTestPath) {
|
|
3
4
|
return {
|
|
4
5
|
actualFolder: methodOptions.actualFolder ?? folders.actualFolder,
|
|
@@ -86,6 +87,28 @@ async function getMobileInstanceData({ currentBrowser, isAndroid, isMobile }) {
|
|
|
86
87
|
deviceScreenSize,
|
|
87
88
|
};
|
|
88
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* Get the device name
|
|
92
|
+
*/
|
|
93
|
+
function getDeviceName(currentBrowser) {
|
|
94
|
+
const { capabilities: {
|
|
95
|
+
// We use a few `@ts-ignore` here because this is returned by the driver
|
|
96
|
+
// and not recognized by the types because they are not requested
|
|
97
|
+
// @ts-ignore
|
|
98
|
+
deviceName: returnedDeviceName = NOT_KNOWN, }, requestedCapabilities } = currentBrowser;
|
|
99
|
+
let deviceName = NOT_KNOWN;
|
|
100
|
+
// First check if it's a BrowserStack session, they don't:
|
|
101
|
+
// - return the "requested" deviceName in the session capabilities
|
|
102
|
+
// - don't use the `appium:deviceName` capability
|
|
103
|
+
const isBrowserStack = 'bstack:options' in requestedCapabilities;
|
|
104
|
+
const bsOptions = requestedCapabilities['bstack:options'];
|
|
105
|
+
const capName = 'deviceName';
|
|
106
|
+
if (isBrowserStack && bsOptions && capName in bsOptions) {
|
|
107
|
+
deviceName = bsOptions[capName];
|
|
108
|
+
}
|
|
109
|
+
const { 'appium:deviceName': requestedDeviceName } = requestedCapabilities;
|
|
110
|
+
return (deviceName !== NOT_KNOWN ? deviceName : requestedDeviceName || returnedDeviceName || NOT_KNOWN).toLowerCase();
|
|
111
|
+
}
|
|
89
112
|
/**
|
|
90
113
|
* Get the instance data
|
|
91
114
|
*/
|
|
@@ -112,14 +135,11 @@ export async function getInstanceData(currentBrowser) {
|
|
|
112
135
|
// @ts-ignore
|
|
113
136
|
app: rawApp = NOT_KNOWN,
|
|
114
137
|
// @ts-ignore
|
|
115
|
-
deviceName: rawDeviceName = NOT_KNOWN,
|
|
116
|
-
// @ts-ignore
|
|
117
138
|
platformVersion: rawPlatformVersion = NOT_KNOWN, } = currentCapabilities;
|
|
118
|
-
const { 'appium:deviceName': requestedDeviceName } = requestedCapabilities;
|
|
119
139
|
const appName = rawApp !== NOT_KNOWN
|
|
120
140
|
? rawApp.replace(/\\/g, '/').split('/').pop().replace(/[^a-zA-Z0-9]/g, '_')
|
|
121
141
|
: NOT_KNOWN;
|
|
122
|
-
const deviceName = (
|
|
142
|
+
const deviceName = getDeviceName(currentBrowser);
|
|
123
143
|
const nativeWebScreenshot = !!(requestedCapabilities['appium:nativeWebScreenshot']);
|
|
124
144
|
const platformVersion = (rawPlatformVersion === undefined || rawPlatformVersion === '') ? NOT_KNOWN : rawPlatformVersion.toLowerCase();
|
|
125
145
|
const { devicePixelRatio: mobileDevicePixelRatio, devicePlatformRect, deviceScreenSize, } = await getMobileInstanceData({ currentBrowser, isAndroid, 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": "3.0.
|
|
5
|
+
"version": "3.0.2",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://webdriver.io/docs/visual-testing",
|
|
8
8
|
"repository": {
|