@wdio/visual-service 9.1.4 → 9.1.5

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,25 @@
1
1
  # @wdio/visual-service
2
2
 
3
+ ## 9.1.5
4
+
5
+ ### Patch Changes
6
+
7
+ - 6ed0469: ## Fix: support `appium:options` nested capability format and `avd` fallback (#1118)
8
+
9
+ Appium caps need to be prefixed with `appium:`, but this can feel redundant when you have a lot of caps. So you can also put them inside the `appium:options`-object. This was not supported by the visual module and was reported in #1118. It is now supported.
10
+
11
+ The following capabilities are now correctly read from both `appium:`-prefixed top-level format and the nested `appium:options` format:
12
+
13
+ - `deviceName`
14
+ - `nativeWebScreenshot`
15
+ - `avd` (new, see below)
16
+
17
+ Second issue that is fixed is that for Android the `deviceName` could be left away and the `avd` could be provided. This is now also supported where `deviceName` takes priority over `avd` if both are provided.
18
+
19
+ # Committers: 1
20
+
21
+ - Wim Selles ([@wswebcreation](https://github.com/wswebcreation))
22
+
3
23
  ## 9.1.4
4
24
 
5
25
  ### 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,6BAA6B,CAAA;AACrF,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;A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uB5C"}
package/dist/utils.js CHANGED
@@ -115,6 +115,14 @@ export function getLtOptions(capabilities) {
115
115
  const key = Object.keys(capabilities).find((k) => k.toLowerCase() === 'lt:options');
116
116
  return key ? capabilities[key] : undefined;
117
117
  }
118
+ /**
119
+ * Get a requested Appium capability value by checking both the `appium:`-prefixed
120
+ * top-level format and the nested `appium:options` format.
121
+ */
122
+ function getRequestedAppiumCapability(requestedCapabilities, capName) {
123
+ return requestedCapabilities[`appium:${capName}`]
124
+ ?? requestedCapabilities['appium:options']?.[capName];
125
+ }
118
126
  /**
119
127
  * Get the device name
120
128
  */
@@ -140,7 +148,8 @@ function getDeviceName(browserInstance) {
140
148
  if (isLambdaTest && ltOptions && capName in ltOptions) {
141
149
  deviceName = ltOptions[capName];
142
150
  }
143
- const { 'appium:deviceName': requestedDeviceName } = requestedCapabilities;
151
+ const requestedDeviceName = (getRequestedAppiumCapability(requestedCapabilities, 'deviceName')
152
+ || getRequestedAppiumCapability(requestedCapabilities, 'avd'));
144
153
  return (deviceName !== NOT_KNOWN ? deviceName : requestedDeviceName || returnedDeviceName || NOT_KNOWN).toLowerCase();
145
154
  }
146
155
  /**
@@ -179,7 +188,7 @@ export async function getInstanceData({ browserInstance, initialDeviceRectangles
179
188
  const ltOptions = getLtOptions(requestedCapabilities);
180
189
  // @TODO: Figure this one out in the future when we know more about the Appium capabilities from LT
181
190
  // 20241216: LT doesn't have the option to take a ChromeDriver screenshot, so if it's Android it's always native
182
- const nativeWebScreenshot = isAndroid && ltOptions || !!(requestedCapabilities['appium:nativeWebScreenshot']);
191
+ const nativeWebScreenshot = isAndroid && ltOptions || !!getRequestedAppiumCapability(requestedCapabilities, 'nativeWebScreenshot');
183
192
  const platformVersion = (rawPlatformVersion === undefined || rawPlatformVersion === '') ? NOT_KNOWN : rawPlatformVersion.toLowerCase();
184
193
  const { devicePixelRatio: mobileDevicePixelRatio, deviceRectangles, } = await getMobileInstanceData({ browserInstance, initialDeviceRectangles, isNativeContext, nativeWebScreenshot });
185
194
  devicePixelRatio = isMobile ? mobileDevicePixelRatio : devicePixelRatio;
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.1.4",
5
+ "version": "9.1.5",
6
6
  "license": "MIT",
7
7
  "homepage": "https://webdriver.io/docs/visual-testing",
8
8
  "repository": {