appium-xcuitest-driver 5.5.0 → 5.6.0

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,3 +1,10 @@
1
+ ## [5.6.0](https://github.com/appium/appium-xcuitest-driver/compare/v5.5.0...v5.6.0) (2023-10-03)
2
+
3
+
4
+ ### Features
5
+
6
+ * use mobile:setSimulatedLocation in setGeoLocation for ios 17 ([#2062](https://github.com/appium/appium-xcuitest-driver/issues/2062)) ([69dfab9](https://github.com/appium/appium-xcuitest-driver/commit/69dfab95dc7ba1506e2c1fe2a59e4e4be6f7b113))
7
+
1
8
  ## [5.5.0](https://github.com/appium/appium-xcuitest-driver/compare/v5.4.1...v5.5.0) (2023-10-02)
2
9
 
3
10
 
@@ -19,6 +19,11 @@ declare namespace _default {
19
19
  altitude: number;
20
20
  }>;
21
21
  /**
22
+ * Set location of the device under test.
23
+ *
24
+ * iOS 17+ real device environment will be via "mobile:setSimulatedLocation" as
25
+ * setting simulated location for XCTest session.
26
+ *
22
27
  * @param {Partial<Location>} location
23
28
  * @this {XCUITestDriver}
24
29
  */
@@ -1 +1 @@
1
- {"version":3,"file":"location.d.ts","sourceRoot":"","sources":["../../../lib/commands/location.js"],"names":[],"mappings":";IAME;;;;;;;;;;;;;OAaG;IACH;;;;OAgBC;IACD;;;OAGG;IACH,2JAyBC;IAED;;;;;OAKG;IACH,sFAgBC;;;6BAIU,OAAO,WAAW,EAAE,cAAc;8BAClC,OAAO,SAAS,EAAE,eAAe;uBACjC,OAAO,eAAe,EAAE,QAAQ"}
1
+ {"version":3,"file":"location.d.ts","sourceRoot":"","sources":["../../../lib/commands/location.js"],"names":[],"mappings":";IAME;;;;;;;;;;;;;OAaG;IACH;;;;OAqBC;IAED;;;;;;;;OAQG;IACH,2JA+BC;IAED;;;;;OAKG;IACH,sFAgBC;;;6BAIU,OAAO,WAAW,EAAE,cAAc;8BAClC,OAAO,SAAS,EAAE,eAAe;uBACjC,OAAO,eAAe,EAAE,QAAQ"}
@@ -20,6 +20,11 @@ exports.default = {
20
20
  * @this {XCUITestDriver}
21
21
  */
22
22
  async getGeoLocation() {
23
+ // Please do not change the way to get the location here with '/wda/simulatedLocation'
24
+ // endpoint because they could return different value before setting the simulated location.
25
+ // '/wda/device/location' returns current device location information,
26
+ // but '/wda/simulatedLocation' returns `null` values until the WDA process
27
+ // sets a simulated location. After setting the value, both returns the same values.
23
28
  const { authorizationStatus, latitude, longitude, altitude } = /** @type {WDALocationInfo} */ (await this.proxyCommand('/wda/device/location', 'GET'));
24
29
  // '3' is 'Always' in the privacy
25
30
  // https://developer.apple.com/documentation/corelocation/clauthorizationstatus
@@ -31,6 +36,11 @@ exports.default = {
31
36
  return { latitude, longitude, altitude };
32
37
  },
33
38
  /**
39
+ * Set location of the device under test.
40
+ *
41
+ * iOS 17+ real device environment will be via "mobile:setSimulatedLocation" as
42
+ * setting simulated location for XCTest session.
43
+ *
34
44
  * @param {Partial<Location>} location
35
45
  * @this {XCUITestDriver}
36
46
  */
@@ -44,16 +54,22 @@ exports.default = {
44
54
  await this.opts.device.setGeolocation(`${latitude}`, `${longitude}`);
45
55
  return /** @type {Location} */ ({ latitude, longitude, altitude: 0 });
46
56
  }
47
- const service = await appium_ios_device_1.services.startSimulateLocationService(this.opts.udid);
48
- try {
49
- service.setLocation(latitude, longitude);
57
+ if (this.opts.platformVersion && support_1.util.compareVersions(this.opts.platformVersion, '>=', '17.0')) {
58
+ this.log.debug(`Proxy mobile:setSimulatedLocation method as iOS 17+ platform version`);
59
+ await this.mobileSetSimulatedLocation(latitude, longitude);
50
60
  }
51
- catch (e) {
52
- this.log.errorAndThrow(`Can't set the location on device '${this.opts.udid}'. Original error: ${e.message}`);
53
- throw new Error(); // unreachable
54
- }
55
- finally {
56
- service.close();
61
+ else {
62
+ const service = await appium_ios_device_1.services.startSimulateLocationService(this.opts.udid);
63
+ try {
64
+ service.setLocation(latitude, longitude);
65
+ }
66
+ catch (e) {
67
+ this.log.errorAndThrow(`Can't set the location on device '${this.opts.udid}'. Original error: ${e.message}`);
68
+ throw new Error(); // unreachable
69
+ }
70
+ finally {
71
+ service.close();
72
+ }
57
73
  }
58
74
  return /** @type {Location} */ ({ latitude, longitude, altitude: 0 });
59
75
  },
@@ -1 +1 @@
1
- {"version":3,"file":"location.js","sourceRoot":"","sources":["../../../lib/commands/location.js"],"names":[],"mappings":";;AAAA,yDAA2C;AAC3C,0CAAqC;AACrC,4CAAoC;AACpC,iCAA2C;AAE3C,kBAAe;IACb;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,cAAc;QAClB,MAAM,EAAC,mBAAmB,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAC,GAAG,8BAA8B,CAAC,CAC1F,MAAM,IAAI,CAAC,YAAY,CAAC,sBAAsB,EAAE,KAAK,CAAC,CACvD,CAAC;QAEF,iCAAiC;QACjC,+EAA+E;QAC/E,IAAI,mBAAmB,KAAK,0BAAmB,CAAC,gBAAgB,EAAE;YAChE,IAAI,CAAC,GAAG,CAAC,aAAa,CACpB,uDAAuD;gBACrD,sEAAsE;gBACtE,yEAAyE,CAC5E,CAAC;SACH;QAED,OAAO,EAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAC,CAAC;IACzC,CAAC;IACD;;;OAGG;IACH,KAAK,CAAC,cAAc,CAAC,QAAQ;QAC3B,IAAI,EAAC,QAAQ,EAAE,SAAS,EAAC,GAAG,QAAQ,CAAC;QAErC,IAAI,CAAC,cAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,cAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE;YACzD,MAAM,IAAI,eAAM,CAAC,oBAAoB,CAAC,2CAA2C,CAAC,CAAC;SACpF;QAED,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE;YACtB,uEAAuE;YACvE,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,GAAG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G,CAAC,aAAa,CACpB,yDAAyD,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK;gBAC1E,mBAAmB,GAAG,CAAC,OAAO,EAAE,CACnC,CAAC;SACH;gBAAS;YACR,OAAO,CAAC,KAAK,EAAE,CAAC;SACjB;IACH,CAAC;CACF,CAAC;AAEF;;;;GAIG"}
@@ -19,6 +19,11 @@ export default {
19
19
  * @this {XCUITestDriver}
20
20
  */
21
21
  async getGeoLocation() {
22
+ // Please do not change the way to get the location here with '/wda/simulatedLocation'
23
+ // endpoint because they could return different value before setting the simulated location.
24
+ // '/wda/device/location' returns current device location information,
25
+ // but '/wda/simulatedLocation' returns `null` values until the WDA process
26
+ // sets a simulated location. After setting the value, both returns the same values.
22
27
  const {authorizationStatus, latitude, longitude, altitude} = /** @type {WDALocationInfo} */ (
23
28
  await this.proxyCommand('/wda/device/location', 'GET')
24
29
  );
@@ -35,7 +40,13 @@ export default {
35
40
 
36
41
  return {latitude, longitude, altitude};
37
42
  },
43
+
38
44
  /**
45
+ * Set location of the device under test.
46
+ *
47
+ * iOS 17+ real device environment will be via "mobile:setSimulatedLocation" as
48
+ * setting simulated location for XCTest session.
49
+ *
39
50
  * @param {Partial<Location>} location
40
51
  * @this {XCUITestDriver}
41
52
  */
@@ -52,17 +63,23 @@ export default {
52
63
  return /** @type {Location} */ ({latitude, longitude, altitude: 0});
53
64
  }
54
65
 
55
- const service = await services.startSimulateLocationService(this.opts.udid);
56
- try {
57
- service.setLocation(latitude, longitude);
58
- } catch (e) {
59
- this.log.errorAndThrow(
60
- `Can't set the location on device '${this.opts.udid}'. Original error: ${e.message}`,
61
- );
62
- throw new Error(); // unreachable
63
- } finally {
64
- service.close();
66
+ if (this.opts.platformVersion && util.compareVersions(this.opts.platformVersion, '>=', '17.0')) {
67
+ this.log.debug(`Proxy mobile:setSimulatedLocation method as iOS 17+ platform version`);
68
+ await this.mobileSetSimulatedLocation(latitude, longitude);
69
+ } else {
70
+ const service = await services.startSimulateLocationService(this.opts.udid);
71
+ try {
72
+ service.setLocation(latitude, longitude);
73
+ } catch (e) {
74
+ this.log.errorAndThrow(
75
+ `Can't set the location on device '${this.opts.udid}'. Original error: ${e.message}`,
76
+ );
77
+ throw new Error(); // unreachable
78
+ } finally {
79
+ service.close();
80
+ }
65
81
  }
82
+
66
83
  return /** @type {Location} */ ({latitude, longitude, altitude: 0});
67
84
  },
68
85
 
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "appium-xcuitest-driver",
3
- "version": "5.5.0",
3
+ "version": "5.6.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "appium-xcuitest-driver",
9
- "version": "5.5.0",
9
+ "version": "5.6.0",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "appium-idb": "^1.6.13",
13
13
  "appium-ios-device": "^2.5.4",
14
- "appium-ios-simulator": "^5.3.2",
14
+ "appium-ios-simulator": "^5.3.3",
15
15
  "appium-remote-debugger": "^10.0.0",
16
16
  "appium-webdriveragent": "^5.9.1",
17
17
  "appium-xcode": "^5.1.4",
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "xcuitest",
9
9
  "xctest"
10
10
  ],
11
- "version": "5.5.0",
11
+ "version": "5.6.0",
12
12
  "author": "Appium Contributors",
13
13
  "license": "Apache-2.0",
14
14
  "repository": {
@@ -71,7 +71,7 @@
71
71
  "dependencies": {
72
72
  "appium-idb": "^1.6.13",
73
73
  "appium-ios-device": "^2.5.4",
74
- "appium-ios-simulator": "^5.3.2",
74
+ "appium-ios-simulator": "^5.3.3",
75
75
  "appium-remote-debugger": "^10.0.0",
76
76
  "appium-webdriveragent": "^5.9.1",
77
77
  "appium-xcode": "^5.1.4",