appium-xcuitest-driver 10.4.0 → 10.4.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.
@@ -1,6 +1,6 @@
1
1
  import _ from 'lodash';
2
2
  import {buildSafariPreferences} from './app-utils';
3
- import {utilities} from 'appium-ios-device';
3
+ import { getConnectedDevices } from './real-device';
4
4
 
5
5
  const DEFAULT_APP_INSTALLATION_TIMEOUT_MS = 8 * 60 * 1000;
6
6
 
@@ -114,11 +114,11 @@ export function applySafariStartupArgs() {
114
114
  */
115
115
  export async function detectUdid() {
116
116
  this.log.debug('Auto-detecting real device udid...');
117
- const udids = await utilities.getConnectedDevices();
117
+ const udids = await getConnectedDevices();
118
118
  if (_.isEmpty(udids)) {
119
119
  throw new Error('No real devices are connected to the host');
120
120
  }
121
- const udid = _.last(udids);
121
+ const udid = udids[udids.length - 1];
122
122
  if (udids.length > 1) {
123
123
  this.log.info(`Multiple devices found: ${udids.join(', ')}`);
124
124
  this.log.info(`Choosing '${udid}'. Consider settings the 'udid' capability if another device must be selected`);
@@ -16,6 +16,11 @@ const INSTALLATION_STAGING_DIR = 'PublicStaging';
16
16
  * @returns {Promise<string[]>}
17
17
  */
18
18
  export async function getConnectedDevices() {
19
+ if (['yes', 'true', '1'].includes(_.toLower(process.env.APPIUM_XCUITEST_PREFER_DEVICECTL))) {
20
+ return (await new Devicectl('').listDevices())
21
+ .map(({hardwareProperties}) => hardwareProperties?.udid)
22
+ .filter(Boolean);
23
+ }
19
24
  return await utilities.getConnectedDevices();
20
25
  }
21
26
 
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "appium-xcuitest-driver",
3
- "version": "10.4.0",
3
+ "version": "10.4.2",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "appium-xcuitest-driver",
9
- "version": "10.4.0",
9
+ "version": "10.4.2",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "@appium/strongbox": "^1.0.0-rc.1",
@@ -27,7 +27,7 @@
27
27
  "lru-cache": "^11.1.0",
28
28
  "moment": "^2.29.4",
29
29
  "moment-timezone": "^0.x",
30
- "node-devicectl": "^1.0.1",
30
+ "node-devicectl": "^1.1.0",
31
31
  "node-simctl": "^8.0.0",
32
32
  "portscanner": "^2.2.0",
33
33
  "semver": "^7.5.4",
@@ -666,9 +666,9 @@
666
666
  }
667
667
  },
668
668
  "node_modules/appium-ios-remotexpc": {
669
- "version": "0.10.0",
670
- "resolved": "https://registry.npmjs.org/appium-ios-remotexpc/-/appium-ios-remotexpc-0.10.0.tgz",
671
- "integrity": "sha512-dSLG+TecmCUhy6wkr5H/rXgB3q1k52MsTKffAh6EKtLqe3PxoXJoXFkirLQYA4BH+kmq96aE60522cjHmhuRYg==",
669
+ "version": "0.10.1",
670
+ "resolved": "https://registry.npmjs.org/appium-ios-remotexpc/-/appium-ios-remotexpc-0.10.1.tgz",
671
+ "integrity": "sha512-SK1ttF2j/EuEqtJwMBxUYQIUyAqLJEDyZPrXW7t5EXsc0b88buCcBcakBvpl5gXf1SVnGmO3upQRwu2/blU6/g==",
672
672
  "license": "Apache-2.0",
673
673
  "optional": true,
674
674
  "dependencies": {
@@ -2985,9 +2985,9 @@
2985
2985
  }
2986
2986
  },
2987
2987
  "node_modules/node-devicectl": {
2988
- "version": "1.0.1",
2989
- "resolved": "https://registry.npmjs.org/node-devicectl/-/node-devicectl-1.0.1.tgz",
2990
- "integrity": "sha512-x1h3FBgiCI6bhUWvUKWhPfEajc36+2NmHJU1X1l648MZCFDnyMrwHvvI1/zLmRN8MTpheyjshovL2cKX/sBxmA==",
2988
+ "version": "1.1.0",
2989
+ "resolved": "https://registry.npmjs.org/node-devicectl/-/node-devicectl-1.1.0.tgz",
2990
+ "integrity": "sha512-dK+ZNyPchi+hTUmSKJv1YlcJ9czzVNWFd+/mzCtmU/xzum2DWOmPI09hhNuAqF/ZUR83pjh4S8iLfzxYsVLb9g==",
2991
2991
  "license": "Apache-2.0",
2992
2992
  "dependencies": {
2993
2993
  "@appium/logger": "^2.0.0-rc.1",
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "xcuitest",
9
9
  "xctest"
10
10
  ],
11
- "version": "10.4.0",
11
+ "version": "10.4.2",
12
12
  "author": "Appium Contributors",
13
13
  "license": "Apache-2.0",
14
14
  "repository": {
@@ -98,7 +98,7 @@
98
98
  "lru-cache": "^11.1.0",
99
99
  "moment": "^2.29.4",
100
100
  "moment-timezone": "^0.x",
101
- "node-devicectl": "^1.0.1",
101
+ "node-devicectl": "^1.1.0",
102
102
  "node-simctl": "^8.0.0",
103
103
  "portscanner": "^2.2.0",
104
104
  "semver": "^7.5.4",
@@ -1,15 +0,0 @@
1
- declare namespace _default {
2
- export { createJSCookie };
3
- export { createJWPCookie };
4
- export { getValue };
5
- export { expireCookie };
6
- }
7
- export default _default;
8
- export function createJSCookie(key: any, value: any, options?: {}): string;
9
- export function createJWPCookie(key: any, cookieString: any, converter?: null): {
10
- name: any;
11
- value: any;
12
- };
13
- export function getValue(key: any, cookieString: any, converter?: null): any;
14
- export function expireCookie(key: any, options: any): string;
15
- //# sourceMappingURL=cookies.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cookies.d.ts","sourceRoot":"","sources":["../../lib/cookies.js"],"names":[],"mappings":";;;;;;;AAiCA,2EAUC;AAGD;;;EAoBC;AAGD,6EAKC;AAID,6DASC"}
@@ -1,84 +0,0 @@
1
- "use strict";
2
- /*
3
- * derived from jQuery Cookie Plugin v1.4.1
4
- * https://github.com/carhartl/jquery-cookie
5
- */
6
- var __importDefault = (this && this.__importDefault) || function (mod) {
7
- return (mod && mod.__esModule) ? mod : { "default": mod };
8
- };
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.createJSCookie = createJSCookie;
11
- exports.createJWPCookie = createJWPCookie;
12
- exports.getValue = getValue;
13
- exports.expireCookie = expireCookie;
14
- // needed to communicate/translate between JSONWire cookies and regular JavaScript cookies
15
- const lodash_1 = __importDefault(require("lodash"));
16
- const support_1 = require("appium/support");
17
- const log = support_1.logger.getLogger('Cookie');
18
- // parses the value if needed and converts the value if a converter is provided
19
- // internal function, not exported
20
- function convertCookie(value, converter) {
21
- if (value.indexOf('"') === 0) {
22
- // this is a quoted cookied according to RFC2068
23
- // remove enclosing quotes and internal quotes and backslashes
24
- value = value.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
25
- }
26
- let parsedValue;
27
- try {
28
- parsedValue = decodeURIComponent(value.replace(/\+/g, ' '));
29
- }
30
- catch (e) {
31
- // no need to fail if we can't decode
32
- log.warn(e);
33
- }
34
- return converter ? converter(parsedValue) : parsedValue;
35
- }
36
- // takes arguments given and creates a JavaScript Cookie
37
- function createJSCookie(key, value, options = {}) {
38
- return [
39
- encodeURIComponent(key),
40
- '=',
41
- value,
42
- options.expires ? `; expires=${options.expires}` : '',
43
- options.path ? `; path=${options.path}` : '',
44
- options.domain ? `; domain=${options.domain}` : '',
45
- options.secure ? '; secure' : '',
46
- ].join('');
47
- }
48
- // takes the JavaScript cookieString and translates it into a JSONWire formatted cookie
49
- function createJWPCookie(key, cookieString, converter = null) {
50
- let result = {};
51
- let cookies = cookieString ? cookieString.split('; ') : [];
52
- for (let cookie of cookies) {
53
- let parts = cookie.split('=');
54
- // get the first and second element as name and value
55
- let name = decodeURIComponent(parts.shift());
56
- let val = parts[0];
57
- // if name is key, this is the central element of the cookie, so add as `name`
58
- // otherwise it is an optional element
59
- if (key && key === name) {
60
- result.name = key;
61
- result.value = convertCookie(val, converter);
62
- }
63
- else {
64
- result[name] = convertCookie(val, converter);
65
- }
66
- }
67
- return result;
68
- }
69
- // takes a JavaScript cookiestring and parses it for the value given the key
70
- function getValue(key, cookieString, converter = null) {
71
- let result = createJWPCookie(key, cookieString, converter);
72
- // if `key` is undefined we want the entire cookie
73
- return lodash_1.default.isUndefined(key) ? result : result.value;
74
- }
75
- // returns a cookie that expires on 01 Jan 1970
76
- // assign the returned cookie to an existing cookie to delete that cookie
77
- function expireCookie(key, options) {
78
- // override `expires` in `options`, and then make the cookie
79
- return createJSCookie(key, '', lodash_1.default.assign({}, options, {
80
- expires: 'Thu, 01 Jan 1970 00:00:00 GMT',
81
- }));
82
- }
83
- exports.default = { createJSCookie, createJWPCookie, getValue, expireCookie };
84
- //# sourceMappingURL=cookies.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cookies.js","sourceRoot":"","sources":["../../lib/cookies.js"],"names":[],"mappings":";AAAA;;;GAGG;;;;;AAuFK,wCAAc;AAAE,0CAAe;AAAE,4BAAQ;AAAE,oCAAY;AArF/D,0FAA0F;AAE1F,oDAAuB;AACvB,4CAAsC;AAEtC,MAAM,GAAG,GAAG,gBAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;AAEvC,+EAA+E;AAC/E,kCAAkC;AAClC,SAAS,aAAa,CAAC,KAAK,EAAE,SAAS;IACrC,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;QAC7B,gDAAgD;QAChD,8DAA8D;QAC9D,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACzE,CAAC;IAED,IAAI,WAAW,CAAC;IAChB,IAAI,CAAC;QACH,WAAW,GAAG,kBAAkB,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;IAC9D,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,qCAAqC;QACrC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACd,CAAC;IAED,OAAO,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC;AAC1D,CAAC;AAED,wDAAwD;AACxD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AC;QAC/C,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,4EAA4E;AAC5E,SAAS,QAAQ,CAAC,GAAG,EAAE,YAAY,EAAE,SAAS,GAAG,IAAI;IACnD,IAAI,MAAM,GAAG,eAAe,CAAC,GAAG,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;IAE3D,kDAAkD;IAClD,OAAO,gBAAC,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;AACpD,CAAC;AAED,+CAA+C;AAC/C,yEAAyE;AACzE,SAAS,YAAY,CAAC,GAAG,EAAE,OAAO;IAChC,4DAA4D;IAC5D,OAAO,cAAc,CACnB,GAAG,EACH,EAAE,EACF,gBAAC,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,EAAE;QACpB,OAAO,EAAE,+BAA+B;KACzC,CAAC,CACH,CAAC;AACJ,CAAC;AAID,kBAAe,EAAC,cAAc,EAAE,eAAe,EAAE,QAAQ,EAAE,YAAY,EAAC,CAAC"}
package/lib/cookies.js DELETED
@@ -1,92 +0,0 @@
1
- /*
2
- * derived from jQuery Cookie Plugin v1.4.1
3
- * https://github.com/carhartl/jquery-cookie
4
- */
5
-
6
- // needed to communicate/translate between JSONWire cookies and regular JavaScript cookies
7
-
8
- import _ from 'lodash';
9
- import {logger} from 'appium/support';
10
-
11
- const log = logger.getLogger('Cookie');
12
-
13
- // parses the value if needed and converts the value if a converter is provided
14
- // internal function, not exported
15
- function convertCookie(value, converter) {
16
- if (value.indexOf('"') === 0) {
17
- // this is a quoted cookied according to RFC2068
18
- // remove enclosing quotes and internal quotes and backslashes
19
- value = value.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
20
- }
21
-
22
- let parsedValue;
23
- try {
24
- parsedValue = decodeURIComponent(value.replace(/\+/g, ' '));
25
- } catch (e) {
26
- // no need to fail if we can't decode
27
- log.warn(e);
28
- }
29
-
30
- return converter ? converter(parsedValue) : parsedValue;
31
- }
32
-
33
- // takes arguments given and creates a JavaScript Cookie
34
- function createJSCookie(key, value, options = {}) {
35
- return [
36
- encodeURIComponent(key),
37
- '=',
38
- value,
39
- options.expires ? `; expires=${options.expires}` : '',
40
- options.path ? `; path=${options.path}` : '',
41
- options.domain ? `; domain=${options.domain}` : '',
42
- options.secure ? '; secure' : '',
43
- ].join('');
44
- }
45
-
46
- // takes the JavaScript cookieString and translates it into a JSONWire formatted cookie
47
- function createJWPCookie(key, cookieString, converter = null) {
48
- let result = {};
49
- let cookies = cookieString ? cookieString.split('; ') : [];
50
- for (let cookie of cookies) {
51
- let parts = cookie.split('=');
52
-
53
- // get the first and second element as name and value
54
- let name = decodeURIComponent(parts.shift());
55
- let val = parts[0];
56
-
57
- // if name is key, this is the central element of the cookie, so add as `name`
58
- // otherwise it is an optional element
59
- if (key && key === name) {
60
- result.name = key;
61
- result.value = convertCookie(val, converter);
62
- } else {
63
- result[name] = convertCookie(val, converter);
64
- }
65
- }
66
- return result;
67
- }
68
-
69
- // takes a JavaScript cookiestring and parses it for the value given the key
70
- function getValue(key, cookieString, converter = null) {
71
- let result = createJWPCookie(key, cookieString, converter);
72
-
73
- // if `key` is undefined we want the entire cookie
74
- return _.isUndefined(key) ? result : result.value;
75
- }
76
-
77
- // returns a cookie that expires on 01 Jan 1970
78
- // assign the returned cookie to an existing cookie to delete that cookie
79
- function expireCookie(key, options) {
80
- // override `expires` in `options`, and then make the cookie
81
- return createJSCookie(
82
- key,
83
- '',
84
- _.assign({}, options, {
85
- expires: 'Thu, 01 Jan 1970 00:00:00 GMT',
86
- }),
87
- );
88
- }
89
-
90
- // export individually and also (as default) as an object
91
- export {createJSCookie, createJWPCookie, getValue, expireCookie};
92
- export default {createJSCookie, createJWPCookie, getValue, expireCookie};