appium-xcuitest-driver 11.17.2 → 11.17.3
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 +6 -0
- package/build/lib/commands/general.d.ts +3 -1
- package/build/lib/commands/general.d.ts.map +1 -1
- package/build/lib/commands/general.js +16 -10
- package/build/lib/commands/general.js.map +1 -1
- package/lib/commands/general.ts +18 -10
- package/npm-shrinkwrap.json +9 -25
- package/package.json +2 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## [11.17.3](https://github.com/appium/appium-xcuitest-driver/compare/v11.17.2...v11.17.3) (2026-07-08)
|
|
2
|
+
|
|
3
|
+
### Miscellaneous Chores
|
|
4
|
+
|
|
5
|
+
* Migrate moment to dayjs ([#2902](https://github.com/appium/appium-xcuitest-driver/issues/2902)) ([58d573e](https://github.com/appium/appium-xcuitest-driver/commit/58d573e9697f5af91153c8708a4fd0f59de35fbd))
|
|
6
|
+
|
|
1
7
|
## [11.17.2](https://github.com/appium/appium-xcuitest-driver/compare/v11.17.1...v11.17.2) (2026-07-08)
|
|
2
8
|
|
|
3
9
|
### Miscellaneous Chores
|
|
@@ -31,7 +31,9 @@ export declare function getWindowSize(this: XCUITestDriver): Promise<Size>;
|
|
|
31
31
|
/**
|
|
32
32
|
* Retrieves the actual device time.
|
|
33
33
|
*
|
|
34
|
-
* @param format - The format specifier string. Read the [
|
|
34
|
+
* @param format - The format specifier string. Read the [DayJS documentation](https://day.js.org/docs/en/display/format)
|
|
35
|
+
* to get the full list of supported datetime format
|
|
36
|
+
* specifiers. The default format is `YYYY-MM-DDTHH:mm:ssZ`, which complies to ISO-8601.
|
|
35
37
|
* @returns Formatted datetime string or the raw command output (if formatting fails)
|
|
36
38
|
*/
|
|
37
39
|
export declare function getDeviceTime(this: XCUITestDriver, format?: string): Promise<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../../../lib/commands/general.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,IAAI,EAAE,IAAI,EAAC,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../../../lib/commands/general.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,IAAI,EAAE,IAAI,EAAC,MAAM,eAAe,CAAC;AAS9C,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EAAC,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAC,MAAM,SAAS,CAAC;AAI9D;;;;;;;GAOG;AACH,wBAAsB,MAAM,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,CAK/D;AAED;;;;GAIG;AACH,wBAAsB,OAAO,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,UAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAE/E;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,cAAc,EAAE,SAAS,UAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAE/F;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAGvE;AAED;;;;;;;GAOG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,cAAc,EAAE,MAAM,SAA0B,GAAG,OAAO,CAAC,MAAM,CAAC,CA+B3G;AAED;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,cAAc,EAAE,MAAM,SAA0B,GAAG,OAAO,CAAC,MAAM,CAAC,CAEjH;AAED;;;;;;;GAOG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAavE;AAED;;;;;;;GAOG;AACH,wBAAsB,SAAS,CAAC,IAAI,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAExF;AAED;;;;;;GAMG;AACH,wBAAsB,SAAS,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAKnE;AAED;;;;;;GAMG;AACH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAKlE;AAED;;;;;;;;GAQG;AACH,wBAAsB,MAAM,CAAC,IAAI,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAgB7E;AAED;;;;;;GAMG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC,CAc7E;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC,CAE7E;AAED;;;;GAIG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAG9E;AAED;;;;;GAKG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAG/E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,UAAU,EAChB,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,IAAI,CAAC,CAQf;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAKzF"}
|
|
@@ -21,9 +21,11 @@ exports.getDevicePixelRatio = getDevicePixelRatio;
|
|
|
21
21
|
exports.mobilePressButton = mobilePressButton;
|
|
22
22
|
exports.mobileSiriCommand = mobileSiriCommand;
|
|
23
23
|
const driver_1 = require("appium/driver");
|
|
24
|
-
const
|
|
24
|
+
const dayjs_1 = __importDefault(require("dayjs"));
|
|
25
|
+
const utc_1 = __importDefault(require("dayjs/plugin/utc"));
|
|
26
|
+
dayjs_1.default.extend(utc_1.default);
|
|
25
27
|
const lockdown_client_1 = require("../device/lockdown-client");
|
|
26
|
-
const
|
|
28
|
+
const DATETIME_FORMAT_ISO8601 = 'YYYY-MM-DDTHH:mm:ssZ';
|
|
27
29
|
/**
|
|
28
30
|
* Gets the currently active element.
|
|
29
31
|
*
|
|
@@ -66,16 +68,21 @@ async function getWindowSize() {
|
|
|
66
68
|
/**
|
|
67
69
|
* Retrieves the actual device time.
|
|
68
70
|
*
|
|
69
|
-
* @param format - The format specifier string. Read the [
|
|
71
|
+
* @param format - The format specifier string. Read the [DayJS documentation](https://day.js.org/docs/en/display/format)
|
|
72
|
+
* to get the full list of supported datetime format
|
|
73
|
+
* specifiers. The default format is `YYYY-MM-DDTHH:mm:ssZ`, which complies to ISO-8601.
|
|
70
74
|
* @returns Formatted datetime string or the raw command output (if formatting fails)
|
|
71
75
|
*/
|
|
72
|
-
async function getDeviceTime(format =
|
|
76
|
+
async function getDeviceTime(format = DATETIME_FORMAT_ISO8601) {
|
|
77
|
+
const formatDateTime = (utcTimestamp, utcOffset) => {
|
|
78
|
+
const utcDateTime = dayjs_1.default.unix(utcTimestamp).utc();
|
|
79
|
+
return utcDateTime.utcOffset(utcOffset).format(format);
|
|
80
|
+
};
|
|
73
81
|
this.log.debug('Attempting to capture iOS device date and time');
|
|
74
82
|
if (!this.isRealDevice()) {
|
|
75
83
|
this.log.debug('On simulator. Assuming device time is the same as host time');
|
|
76
|
-
const hostNow = (0,
|
|
77
|
-
|
|
78
|
-
return utc.utcOffset(hostNow.utcOffset()).format(format);
|
|
84
|
+
const hostNow = (0, dayjs_1.default)();
|
|
85
|
+
return formatDateTime(hostNow.unix(), hostNow.utcOffset());
|
|
79
86
|
}
|
|
80
87
|
const udid = this.opts.udid;
|
|
81
88
|
if (!udid) {
|
|
@@ -94,8 +101,7 @@ async function getDeviceTime(format = MOMENT_FORMAT_ISO8601) {
|
|
|
94
101
|
await lockdown.close();
|
|
95
102
|
}
|
|
96
103
|
this.log.debug(`timestamp: ${timestamp}, utcOffset: ${utcOffset}`);
|
|
97
|
-
|
|
98
|
-
return utc.utcOffset(utcOffset).format(format);
|
|
104
|
+
return formatDateTime(timestamp, utcOffset);
|
|
99
105
|
}
|
|
100
106
|
/**
|
|
101
107
|
* Retrieves the current device time.
|
|
@@ -105,7 +111,7 @@ async function getDeviceTime(format = MOMENT_FORMAT_ISO8601) {
|
|
|
105
111
|
* @param format - See {@linkcode getDeviceTime.format}
|
|
106
112
|
* @returns Formatted datetime string or the raw command output if formatting fails
|
|
107
113
|
*/
|
|
108
|
-
async function mobileGetDeviceTime(format =
|
|
114
|
+
async function mobileGetDeviceTime(format = DATETIME_FORMAT_ISO8601) {
|
|
109
115
|
return await this.getDeviceTime(format);
|
|
110
116
|
}
|
|
111
117
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"general.js","sourceRoot":"","sources":["../../../lib/commands/general.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"general.js","sourceRoot":"","sources":["../../../lib/commands/general.ts"],"names":[],"mappings":";;;;;AAsBA,wBAKC;AAOD,0BAEC;AAOD,kDAEC;AAOD,sCAGC;AAUD,sCA+BC;AAUD,kDAEC;AAUD,sCAaC;AAUD,8BAEC;AASD,8BAKC;AASD,4BAKC;AAWD,wBAgBC;AASD,0CAcC;AAQD,sCAEC;AAOD,gDAGC;AAQD,kDAGC;AAeD,8CAYC;AASD,8CAKC;AAnSD,0CAAqC;AACrC,kDAA0B;AAC1B,2DAAmC;AAEnC,eAAK,CAAC,MAAM,CAAC,aAAG,CAAC,CAAC;AAElB,+DAAyD;AAIzD,MAAM,uBAAuB,GAAG,sBAAsB,CAAC;AAEvD;;;;;;;GAOG;AACI,KAAK,UAAU,MAAM;IAC1B,IAAI,IAAI,CAAC,YAAY,EAAE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AC,CAAC;IAC9E,CAAC;IACD,OAAO,MAAM,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE,MAAM,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,eAAe,EAAC,CAAC,CAAC;AAChG,CAAC;AAED;;;;;;GAMG;AACI,KAAK,UAAU,iBAAiB,CAAuB,IAAY;IACxE,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,eAAM,CAAC,oBAAoB,CAAC,8BAA8B,CAAC,CAAC;IACxE,CAAC;IACD,MAAM,IAAI,CAAC,YAAY,CAAC,oBAAoB,EAAE,MAAM,EAAE,EAAC,IAAI,EAAC,CAAC,CAAC;AAChE,CAAC"}
|
package/lib/commands/general.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import type {Size, Rect} from '@appium/types';
|
|
2
2
|
import type {Simulator} from 'appium-ios-simulator';
|
|
3
3
|
import {errors} from 'appium/driver';
|
|
4
|
-
import
|
|
4
|
+
import dayjs from 'dayjs';
|
|
5
|
+
import utc from 'dayjs/plugin/utc';
|
|
6
|
+
|
|
7
|
+
dayjs.extend(utc);
|
|
5
8
|
|
|
6
9
|
import {LockdownClient} from '../device/lockdown-client';
|
|
7
10
|
import type {XCUITestDriver} from '../driver';
|
|
8
11
|
import type {Viewport, ScreenInfo, ButtonName} from './types';
|
|
9
12
|
|
|
10
|
-
const
|
|
13
|
+
const DATETIME_FORMAT_ISO8601 = 'YYYY-MM-DDTHH:mm:ssZ';
|
|
11
14
|
|
|
12
15
|
/**
|
|
13
16
|
* Gets the currently active element.
|
|
@@ -55,16 +58,22 @@ export async function getWindowSize(this: XCUITestDriver): Promise<Size> {
|
|
|
55
58
|
/**
|
|
56
59
|
* Retrieves the actual device time.
|
|
57
60
|
*
|
|
58
|
-
* @param format - The format specifier string. Read the [
|
|
61
|
+
* @param format - The format specifier string. Read the [DayJS documentation](https://day.js.org/docs/en/display/format)
|
|
62
|
+
* to get the full list of supported datetime format
|
|
63
|
+
* specifiers. The default format is `YYYY-MM-DDTHH:mm:ssZ`, which complies to ISO-8601.
|
|
59
64
|
* @returns Formatted datetime string or the raw command output (if formatting fails)
|
|
60
65
|
*/
|
|
61
|
-
export async function getDeviceTime(this: XCUITestDriver, format =
|
|
66
|
+
export async function getDeviceTime(this: XCUITestDriver, format = DATETIME_FORMAT_ISO8601): Promise<string> {
|
|
67
|
+
const formatDateTime = (utcTimestamp: number, utcOffset: number): string => {
|
|
68
|
+
const utcDateTime = dayjs.unix(utcTimestamp).utc();
|
|
69
|
+
return utcDateTime.utcOffset(utcOffset).format(format);
|
|
70
|
+
};
|
|
71
|
+
|
|
62
72
|
this.log.debug('Attempting to capture iOS device date and time');
|
|
63
73
|
if (!this.isRealDevice()) {
|
|
64
74
|
this.log.debug('On simulator. Assuming device time is the same as host time');
|
|
65
|
-
const hostNow =
|
|
66
|
-
|
|
67
|
-
return utc.utcOffset(hostNow.utcOffset()).format(format);
|
|
75
|
+
const hostNow = dayjs();
|
|
76
|
+
return formatDateTime(hostNow.unix(), hostNow.utcOffset());
|
|
68
77
|
}
|
|
69
78
|
|
|
70
79
|
const udid = this.opts.udid;
|
|
@@ -84,8 +93,7 @@ export async function getDeviceTime(this: XCUITestDriver, format = MOMENT_FORMAT
|
|
|
84
93
|
await lockdown.close();
|
|
85
94
|
}
|
|
86
95
|
this.log.debug(`timestamp: ${timestamp}, utcOffset: ${utcOffset}`);
|
|
87
|
-
|
|
88
|
-
return utc.utcOffset(utcOffset).format(format);
|
|
96
|
+
return formatDateTime(timestamp, utcOffset);
|
|
89
97
|
}
|
|
90
98
|
|
|
91
99
|
/**
|
|
@@ -96,7 +104,7 @@ export async function getDeviceTime(this: XCUITestDriver, format = MOMENT_FORMAT
|
|
|
96
104
|
* @param format - See {@linkcode getDeviceTime.format}
|
|
97
105
|
* @returns Formatted datetime string or the raw command output if formatting fails
|
|
98
106
|
*/
|
|
99
|
-
export async function mobileGetDeviceTime(this: XCUITestDriver, format =
|
|
107
|
+
export async function mobileGetDeviceTime(this: XCUITestDriver, format = DATETIME_FORMAT_ISO8601): Promise<string> {
|
|
100
108
|
return await this.getDeviceTime(format);
|
|
101
109
|
}
|
|
102
110
|
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "appium-xcuitest-driver",
|
|
3
|
-
"version": "11.17.
|
|
3
|
+
"version": "11.17.3",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "appium-xcuitest-driver",
|
|
9
|
-
"version": "11.17.
|
|
9
|
+
"version": "11.17.3",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@appium/css-locator-to-native": "^1.0.1",
|
|
@@ -21,10 +21,9 @@
|
|
|
21
21
|
"asyncbox": "^6.3.0",
|
|
22
22
|
"axios": "^1.4.0",
|
|
23
23
|
"commander": "^14.0.1",
|
|
24
|
+
"dayjs": "^1.11.21",
|
|
24
25
|
"js2xmlparser2": "^0.x",
|
|
25
26
|
"lru-cache": "^11.1.0",
|
|
26
|
-
"moment": "^2.29.4",
|
|
27
|
-
"moment-timezone": "^0.x",
|
|
28
27
|
"node-devicectl": "^1.1.0",
|
|
29
28
|
"node-simctl": "^8.1.1",
|
|
30
29
|
"portscanner": "^2.2.0",
|
|
@@ -1363,6 +1362,12 @@
|
|
|
1363
1362
|
],
|
|
1364
1363
|
"license": "MIT"
|
|
1365
1364
|
},
|
|
1365
|
+
"node_modules/dayjs": {
|
|
1366
|
+
"version": "1.11.21",
|
|
1367
|
+
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.21.tgz",
|
|
1368
|
+
"integrity": "sha512-98IT+HOahAisibz/yjKbzuOBwYcjJ7BCLPzARyHiyEBmRz4fatF+KPJszEHXsGYjUG234aH/cOjW1wwTbKUZlA==",
|
|
1369
|
+
"license": "MIT"
|
|
1370
|
+
},
|
|
1366
1371
|
"node_modules/debug": {
|
|
1367
1372
|
"version": "4.4.3",
|
|
1368
1373
|
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
|
|
@@ -2463,27 +2468,6 @@
|
|
|
2463
2468
|
"node": ">=16 || 14 >=14.17"
|
|
2464
2469
|
}
|
|
2465
2470
|
},
|
|
2466
|
-
"node_modules/moment": {
|
|
2467
|
-
"version": "2.30.1",
|
|
2468
|
-
"resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz",
|
|
2469
|
-
"integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==",
|
|
2470
|
-
"license": "MIT",
|
|
2471
|
-
"engines": {
|
|
2472
|
-
"node": "*"
|
|
2473
|
-
}
|
|
2474
|
-
},
|
|
2475
|
-
"node_modules/moment-timezone": {
|
|
2476
|
-
"version": "0.6.2",
|
|
2477
|
-
"resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.6.2.tgz",
|
|
2478
|
-
"integrity": "sha512-lDsQv8FoGdBUdf0+TjGsq2orxKuXdwFlQ6Zw6TX3xIcTwTfEpCLyKqvEauvCHJ8iu3KBV8+uPhlv70YsNGdUBQ==",
|
|
2479
|
-
"license": "MIT",
|
|
2480
|
-
"dependencies": {
|
|
2481
|
-
"moment": "^2.29.4"
|
|
2482
|
-
},
|
|
2483
|
-
"engines": {
|
|
2484
|
-
"node": "*"
|
|
2485
|
-
}
|
|
2486
|
-
},
|
|
2487
2471
|
"node_modules/morgan": {
|
|
2488
2472
|
"version": "1.11.0",
|
|
2489
2473
|
"resolved": "https://registry.npmjs.org/morgan/-/morgan-1.11.0.tgz",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "appium-xcuitest-driver",
|
|
3
|
-
"version": "11.17.
|
|
3
|
+
"version": "11.17.3",
|
|
4
4
|
"description": "Appium driver for iOS using XCUITest for backend",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"appium",
|
|
@@ -72,10 +72,9 @@
|
|
|
72
72
|
"asyncbox": "^6.3.0",
|
|
73
73
|
"axios": "^1.4.0",
|
|
74
74
|
"commander": "^14.0.1",
|
|
75
|
+
"dayjs": "^1.11.21",
|
|
75
76
|
"js2xmlparser2": "^0.x",
|
|
76
77
|
"lru-cache": "^11.1.0",
|
|
77
|
-
"moment": "^2.29.4",
|
|
78
|
-
"moment-timezone": "^0.x",
|
|
79
78
|
"node-devicectl": "^1.1.0",
|
|
80
79
|
"node-simctl": "^8.1.1",
|
|
81
80
|
"portscanner": "^2.2.0",
|