appium-xcuitest-driver 10.14.4 → 10.14.6
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 +12 -0
- package/build/lib/commands/active-app-info.d.ts +4 -3
- package/build/lib/commands/active-app-info.d.ts.map +1 -1
- package/build/lib/commands/active-app-info.js +2 -3
- package/build/lib/commands/active-app-info.js.map +1 -1
- package/build/lib/commands/app-strings.d.ts +6 -7
- package/build/lib/commands/app-strings.d.ts.map +1 -1
- package/build/lib/commands/app-strings.js +3 -8
- package/build/lib/commands/app-strings.js.map +1 -1
- package/build/lib/commands/audit.d.ts +5 -33
- package/build/lib/commands/audit.d.ts.map +1 -1
- package/build/lib/commands/audit.js +3 -16
- package/build/lib/commands/audit.js.map +1 -1
- package/build/lib/commands/battery.d.ts +4 -4
- package/build/lib/commands/battery.d.ts.map +1 -1
- package/build/lib/commands/battery.js +3 -7
- package/build/lib/commands/battery.js.map +1 -1
- package/build/lib/commands/clipboard.d.ts +9 -11
- package/build/lib/commands/clipboard.d.ts.map +1 -1
- package/build/lib/commands/clipboard.js +8 -13
- package/build/lib/commands/clipboard.js.map +1 -1
- package/build/lib/commands/device-info.d.ts +13 -0
- package/build/lib/commands/device-info.d.ts.map +1 -0
- package/build/lib/commands/{deviceInfo.js → device-info.js} +3 -8
- package/build/lib/commands/device-info.js.map +1 -0
- package/build/lib/commands/increase-contrast.d.ts +10 -13
- package/build/lib/commands/increase-contrast.d.ts.map +1 -1
- package/build/lib/commands/increase-contrast.js +8 -16
- package/build/lib/commands/increase-contrast.js.map +1 -1
- package/build/lib/commands/keychains.d.ts +2 -2
- package/build/lib/commands/keychains.d.ts.map +1 -1
- package/build/lib/commands/keychains.js +1 -4
- package/build/lib/commands/keychains.js.map +1 -1
- package/build/lib/commands/localization.d.ts +7 -6
- package/build/lib/commands/localization.d.ts.map +1 -1
- package/build/lib/commands/localization.js +7 -8
- package/build/lib/commands/localization.js.map +1 -1
- package/build/lib/commands/lock.d.ts +6 -10
- package/build/lib/commands/lock.d.ts.map +1 -1
- package/build/lib/commands/lock.js +3 -10
- package/build/lib/commands/lock.js.map +1 -1
- package/build/lib/commands/memory.d.ts +4 -5
- package/build/lib/commands/memory.d.ts.map +1 -1
- package/build/lib/commands/memory.js +3 -8
- package/build/lib/commands/memory.js.map +1 -1
- package/build/lib/commands/pasteboard.d.ts +9 -10
- package/build/lib/commands/pasteboard.d.ts.map +1 -1
- package/build/lib/commands/pasteboard.js +8 -13
- package/build/lib/commands/pasteboard.js.map +1 -1
- package/build/lib/commands/types.d.ts +22 -0
- package/build/lib/commands/types.d.ts.map +1 -1
- package/build/lib/driver.d.ts +1 -1
- package/build/lib/driver.d.ts.map +1 -1
- package/build/lib/driver.js +1 -1
- package/build/lib/driver.js.map +1 -1
- package/lib/commands/active-app-info.ts +15 -0
- package/lib/commands/{app-strings.js → app-strings.ts} +10 -9
- package/lib/commands/audit.ts +25 -0
- package/lib/commands/{battery.js → battery.ts} +10 -12
- package/lib/commands/clipboard.ts +37 -0
- package/lib/commands/device-info.ts +24 -0
- package/lib/commands/increase-contrast.ts +49 -0
- package/lib/commands/keychains.ts +16 -0
- package/lib/commands/{localization.js → localization.ts} +22 -12
- package/lib/commands/lock.ts +43 -0
- package/lib/commands/{memory.js → memory.ts} +9 -9
- package/lib/commands/pasteboard.ts +44 -0
- package/lib/commands/types.ts +23 -0
- package/lib/driver.ts +1 -1
- package/npm-shrinkwrap.json +29 -8
- package/package.json +1 -1
- package/build/lib/commands/deviceInfo.d.ts +0 -12
- package/build/lib/commands/deviceInfo.d.ts.map +0 -1
- package/build/lib/commands/deviceInfo.js.map +0 -1
- package/lib/commands/active-app-info.js +0 -12
- package/lib/commands/audit.js +0 -31
- package/lib/commands/clipboard.js +0 -35
- package/lib/commands/deviceInfo.js +0 -27
- package/lib/commands/increase-contrast.js +0 -50
- package/lib/commands/keychains.js +0 -17
- package/lib/commands/lock.js +0 -46
- package/lib/commands/pasteboard.js +0 -43
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import B from 'bluebird';
|
|
2
|
+
import type {XCUITestDriver} from '../driver';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Lock the device (and optionally unlock the device after a certain amount of time)
|
|
6
|
+
*
|
|
7
|
+
* @param seconds - The number of seconds after which to unlock the device. Set to `0` or leave empty to require manual unlock (do not automatically unlock).
|
|
8
|
+
* @defaultValue 0
|
|
9
|
+
*/
|
|
10
|
+
export async function lock(
|
|
11
|
+
this: XCUITestDriver,
|
|
12
|
+
seconds?: number | string,
|
|
13
|
+
): Promise<void> {
|
|
14
|
+
await this.proxyCommand('/wda/lock', 'POST');
|
|
15
|
+
if (isNaN(Number(seconds))) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const floatSeconds = parseFloat(String(seconds));
|
|
20
|
+
if (floatSeconds <= 0) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
await B.delay(floatSeconds * 1000);
|
|
25
|
+
await this.proxyCommand('/wda/unlock', 'POST');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Unlock the device
|
|
30
|
+
*/
|
|
31
|
+
export async function unlock(this: XCUITestDriver): Promise<void> {
|
|
32
|
+
await this.proxyCommand('/wda/unlock', 'POST');
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Determine whether the device is locked
|
|
37
|
+
*
|
|
38
|
+
* @returns `true` if the device is locked, `false` otherwise
|
|
39
|
+
*/
|
|
40
|
+
export async function isLocked(this: XCUITestDriver): Promise<boolean> {
|
|
41
|
+
return await this.proxyCommand<any, boolean>('/wda/locked', 'GET');
|
|
42
|
+
}
|
|
43
|
+
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
2
|
import { errors } from 'appium/driver';
|
|
3
|
+
import type {XCUITestDriver} from '../driver';
|
|
4
|
+
import type {RealDevice} from '../device/real-device-management';
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* Simulates Low Memory warning on the given application
|
|
6
8
|
*
|
|
7
9
|
* @since Xcode 15
|
|
8
|
-
* @param
|
|
9
|
-
* @
|
|
10
|
-
* @throws {Error} if the app is not running or is not installed
|
|
10
|
+
* @param bundleId - The bundle identifier of the target app. The app must be running
|
|
11
|
+
* @throws If the app is not running or is not installed
|
|
11
12
|
*/
|
|
12
|
-
export async function mobileSendMemoryWarning(
|
|
13
|
+
export async function mobileSendMemoryWarning(
|
|
14
|
+
this: XCUITestDriver,
|
|
15
|
+
bundleId: string,
|
|
16
|
+
): Promise<void> {
|
|
13
17
|
if (!this.isRealDevice()) {
|
|
14
18
|
throw new Error('Memory warning simulation is only supported on real devices');
|
|
15
19
|
}
|
|
16
20
|
|
|
17
|
-
const device =
|
|
21
|
+
const device = this.device as RealDevice;
|
|
18
22
|
|
|
19
23
|
const appInfos = await device.devicectl.listApps(bundleId);
|
|
20
24
|
if (_.isEmpty(appInfos)) {
|
|
@@ -33,7 +37,6 @@ export async function mobileSendMemoryWarning(bundleId) {
|
|
|
33
37
|
// Unfortunately devicectl does not provide more info which would
|
|
34
38
|
// allow to connect a bundle id to a process id.
|
|
35
39
|
const pattern = new RegExp(`^${_.escapeRegExp(appInfos[0].url)}[^/]+$`);
|
|
36
|
-
/** @type {number[]} */
|
|
37
40
|
const pids = (await device.devicectl.listProcesses())
|
|
38
41
|
.filter(({executable}) => pattern.test(executable))
|
|
39
42
|
.map(({processIdentifier}) => processIdentifier);
|
|
@@ -46,6 +49,3 @@ export async function mobileSendMemoryWarning(bundleId) {
|
|
|
46
49
|
await device.devicectl.sendMemoryWarning(pids[0]);
|
|
47
50
|
}
|
|
48
51
|
|
|
49
|
-
/**
|
|
50
|
-
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
51
|
-
*/
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
import { assertSimulator } from '../utils';
|
|
3
|
+
import type {XCUITestDriver} from '../driver';
|
|
4
|
+
import type {Simulator} from 'appium-ios-simulator';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Sets the Simulator's pasteboard content to the given value.
|
|
8
|
+
*
|
|
9
|
+
* Does not work for real devices.
|
|
10
|
+
*
|
|
11
|
+
* @param content - The content to set
|
|
12
|
+
* @param encoding - The content's encoding
|
|
13
|
+
* @group Simulator Only
|
|
14
|
+
*/
|
|
15
|
+
export async function mobileSetPasteboard(
|
|
16
|
+
this: XCUITestDriver,
|
|
17
|
+
content: string,
|
|
18
|
+
encoding: BufferEncoding = 'utf8',
|
|
19
|
+
): Promise<void> {
|
|
20
|
+
assertSimulator.call(this, 'Setting pasteboard content');
|
|
21
|
+
if (!_.isString(content)) {
|
|
22
|
+
// can be empty string
|
|
23
|
+
throw new Error('Pasteboard content is mandatory to set');
|
|
24
|
+
}
|
|
25
|
+
await (this.device as Simulator).simctl.setPasteboard(content, encoding);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Gets the Simulator's pasteboard content.
|
|
30
|
+
*
|
|
31
|
+
* Does not work for real devices.
|
|
32
|
+
*
|
|
33
|
+
* @param encoding - Expected encoding of returned string
|
|
34
|
+
* @group Simulator Only
|
|
35
|
+
* @returns The pasteboard content string
|
|
36
|
+
*/
|
|
37
|
+
export async function mobileGetPasteboard(
|
|
38
|
+
this: XCUITestDriver,
|
|
39
|
+
encoding: BufferEncoding = 'utf8',
|
|
40
|
+
): Promise<string> {
|
|
41
|
+
assertSimulator.call(this, 'Getting pasteboard content');
|
|
42
|
+
return await (this.device as Simulator).simctl.getPasteboard(encoding);
|
|
43
|
+
}
|
|
44
|
+
|
package/lib/commands/types.ts
CHANGED
|
@@ -334,6 +334,29 @@ export interface ProcessArguments {
|
|
|
334
334
|
args: string[];
|
|
335
335
|
}
|
|
336
336
|
|
|
337
|
+
/**
|
|
338
|
+
* Accessibility audit item returned by the audit command.
|
|
339
|
+
*/
|
|
340
|
+
export interface AccessibilityAuditItem {
|
|
341
|
+
/**
|
|
342
|
+
* The detailed description of the found accessibility issue.
|
|
343
|
+
*/
|
|
344
|
+
detailedDescription: string;
|
|
345
|
+
/**
|
|
346
|
+
* The compact description of the found accessibility issue.
|
|
347
|
+
*/
|
|
348
|
+
compactDescription: string;
|
|
349
|
+
/**
|
|
350
|
+
* The name of the audit type this issue belongs to. Could be
|
|
351
|
+
* a number if the type name is unknown.
|
|
352
|
+
*/
|
|
353
|
+
auditType: string | number;
|
|
354
|
+
/**
|
|
355
|
+
* The description of the element this issue was found for.
|
|
356
|
+
*/
|
|
357
|
+
element: string;
|
|
358
|
+
}
|
|
359
|
+
|
|
337
360
|
/**
|
|
338
361
|
* Pressable button names; used by the {@linkcode XCUITest.mobilePressButton mobile: pressButton} command.
|
|
339
362
|
*/
|
package/lib/driver.ts
CHANGED
|
@@ -41,7 +41,7 @@ import * as clipboardCommands from './commands/clipboard';
|
|
|
41
41
|
import * as conditionCommands from './commands/condition';
|
|
42
42
|
import * as contentSizeCommands from './commands/content-size';
|
|
43
43
|
import * as contextCommands from './commands/context';
|
|
44
|
-
import * as deviceInfoCommands from './commands/
|
|
44
|
+
import * as deviceInfoCommands from './commands/device-info';
|
|
45
45
|
import * as elementCommands from './commands/element';
|
|
46
46
|
import * as executeCommands from './commands/execute';
|
|
47
47
|
import * as fileMovementCommands from './commands/file-movement';
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "appium-xcuitest-driver",
|
|
3
|
-
"version": "10.14.
|
|
3
|
+
"version": "10.14.6",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "appium-xcuitest-driver",
|
|
9
|
-
"version": "10.14.
|
|
9
|
+
"version": "10.14.6",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@appium/strongbox": "^1.0.0-rc.1",
|
|
@@ -692,9 +692,9 @@
|
|
|
692
692
|
}
|
|
693
693
|
},
|
|
694
694
|
"node_modules/appium-ios-remotexpc": {
|
|
695
|
-
"version": "0.24.
|
|
696
|
-
"resolved": "https://registry.npmjs.org/appium-ios-remotexpc/-/appium-ios-remotexpc-0.24.
|
|
697
|
-
"integrity": "sha512-
|
|
695
|
+
"version": "0.24.3",
|
|
696
|
+
"resolved": "https://registry.npmjs.org/appium-ios-remotexpc/-/appium-ios-remotexpc-0.24.3.tgz",
|
|
697
|
+
"integrity": "sha512-x76WZpWMLZ2p6coPwmfdqs9dSniAbb8wAAYe0QFD+b9jJtC1QmZjyXB2uEXD1dR871dEwJXUZbB5qKMWYQWNeg==",
|
|
698
698
|
"license": "Apache-2.0",
|
|
699
699
|
"optional": true,
|
|
700
700
|
"dependencies": {
|
|
@@ -880,6 +880,27 @@
|
|
|
880
880
|
"node": ">= 12.0.0"
|
|
881
881
|
}
|
|
882
882
|
},
|
|
883
|
+
"node_modules/appium/node_modules/ws": {
|
|
884
|
+
"version": "8.18.3",
|
|
885
|
+
"resolved": "https://registry.npmjs.org/ws/-/ws-8.18.3.tgz",
|
|
886
|
+
"integrity": "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==",
|
|
887
|
+
"license": "MIT",
|
|
888
|
+
"engines": {
|
|
889
|
+
"node": ">=10.0.0"
|
|
890
|
+
},
|
|
891
|
+
"peerDependencies": {
|
|
892
|
+
"bufferutil": "^4.0.1",
|
|
893
|
+
"utf-8-validate": ">=5.0.2"
|
|
894
|
+
},
|
|
895
|
+
"peerDependenciesMeta": {
|
|
896
|
+
"bufferutil": {
|
|
897
|
+
"optional": true
|
|
898
|
+
},
|
|
899
|
+
"utf-8-validate": {
|
|
900
|
+
"optional": true
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
},
|
|
883
904
|
"node_modules/archiver": {
|
|
884
905
|
"version": "7.0.1",
|
|
885
906
|
"resolved": "https://registry.npmjs.org/archiver/-/archiver-7.0.1.tgz",
|
|
@@ -4697,9 +4718,9 @@
|
|
|
4697
4718
|
"license": "ISC"
|
|
4698
4719
|
},
|
|
4699
4720
|
"node_modules/ws": {
|
|
4700
|
-
"version": "8.
|
|
4701
|
-
"resolved": "https://registry.npmjs.org/ws/-/ws-8.
|
|
4702
|
-
"integrity": "sha512-
|
|
4721
|
+
"version": "8.19.0",
|
|
4722
|
+
"resolved": "https://registry.npmjs.org/ws/-/ws-8.19.0.tgz",
|
|
4723
|
+
"integrity": "sha512-blAT2mjOEIi0ZzruJfIhb3nps74PRWTCz1IjglWEEpQl5XS/UNama6u2/rjFkDDouqr4L67ry+1aGIALViWjDg==",
|
|
4703
4724
|
"license": "MIT",
|
|
4704
4725
|
"engines": {
|
|
4705
4726
|
"node": ">=10.0.0"
|
package/package.json
CHANGED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns the miscellaneous information about the device under test.
|
|
3
|
-
*
|
|
4
|
-
* Since XCUITest driver v4.2.0, this includes device information via lockdown in a real device.
|
|
5
|
-
*
|
|
6
|
-
* @returns {Promise<DeviceInfo | (DeviceInfo & LockdownInfo)>} The response of `/wda/device/info'`
|
|
7
|
-
* @this {import('../driver').XCUITestDriver}
|
|
8
|
-
*/
|
|
9
|
-
export function mobileGetDeviceInfo(this: import("../driver").XCUITestDriver): Promise<DeviceInfo | (DeviceInfo & LockdownInfo)>;
|
|
10
|
-
export type DeviceInfo = import("./types").DeviceInfo;
|
|
11
|
-
export type LockdownInfo = import("./types").LockdownInfo;
|
|
12
|
-
//# sourceMappingURL=deviceInfo.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deviceInfo.d.ts","sourceRoot":"","sources":["../../../lib/commands/deviceInfo.js"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,+EAHa,OAAO,CAAC,UAAU,GAAG,CAAC,UAAU,GAAG,YAAY,CAAC,CAAC,CAc7D;yBAGY,OAAO,SAAS,EAAE,UAAU;2BAC5B,OAAO,SAAS,EAAE,YAAY"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deviceInfo.js","sourceRoot":"","sources":["../../../lib/commands/deviceInfo.js"],"names":[],"mappings":";;AAUA,kDAWC;AArBD,yDAA4C;AAE5C;;;;;;;GAOG;AACI,KAAK,UAAU,mBAAmB;IACvC,MAAM,SAAS,GAAG,2CAA2C,CAAC,CAC5D,MAAM,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE,KAAK,CAAC,CACnD,CAAC;IAEF,IAAI,IAAI,CAAC,YAAY,EAAE,EAAE,CAAC;QACxB,MAAM,YAAY,GAAG,MAAM,6BAAS,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACrE,OAAO,EAAC,GAAG,SAAS,EAAE,GAAG,EAAC,YAAY,EAAC,EAAC,CAAC;IAC3C,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;GAGG"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns information about the active application.
|
|
3
|
-
*
|
|
4
|
-
* @returns {Promise<import('./types').ActiveAppInfo>} Active app information
|
|
5
|
-
* @throws {Error} if an error raised by command
|
|
6
|
-
* @this {import('../driver').XCUITestDriver}
|
|
7
|
-
*/
|
|
8
|
-
export async function mobileGetActiveAppInfo() {
|
|
9
|
-
return /** @type {import('./types').ActiveAppInfo} */ (
|
|
10
|
-
await this.proxyCommand('/wda/activeAppInfo', 'GET')
|
|
11
|
-
);
|
|
12
|
-
}
|
package/lib/commands/audit.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @typedef {Object} AccessibilityAuditItem
|
|
3
|
-
* @property {string} detailedDescription The detailed description of the found accessibility issue.
|
|
4
|
-
* @property {string} compactDescription The compact description of the found accessibility issue.
|
|
5
|
-
* @property {string|number} auditType The name of the audit type this issue belongs to. Could be
|
|
6
|
-
* a number if the type name is unknown.
|
|
7
|
-
* @property {string} element The description of the element this issue was found for.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Performs accessibility audit of the current application according to the given type or multiple types.
|
|
12
|
-
*
|
|
13
|
-
* @since Xcode 15/iOS 17
|
|
14
|
-
* @param {string[]?} auditTypes - One or more type names to perform the audit for.
|
|
15
|
-
* The full list of available names could be found at
|
|
16
|
-
* https://developer.apple.com/documentation/xctest/xcuiaccessibilityaudittype?language=objc
|
|
17
|
-
* If no type if provided explicitly then XCUIAccessibilityAuditTypeAll is assumed.
|
|
18
|
-
*
|
|
19
|
-
* @returns {Promise<AccessibilityAuditItem[]>} List of found issues or an empty list
|
|
20
|
-
*
|
|
21
|
-
* @this {XCUITestDriver}
|
|
22
|
-
*/
|
|
23
|
-
export async function mobilePerformAccessibilityAudit(auditTypes) {
|
|
24
|
-
return /** @type {AccessibilityAuditItem[]} */ (
|
|
25
|
-
await this.proxyCommand('/wda/performAccessibilityAudit', 'POST', {auditTypes})
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
31
|
-
*/
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sets the primary clipboard's content on the device under test.
|
|
3
|
-
*
|
|
4
|
-
* @param {string} content - The content to be set as base64 encoded string.
|
|
5
|
-
* @param {string} [contentType=plaintext] - The type of the content to set.
|
|
6
|
-
* Only `plaintext`, 'image and 'url' are supported.
|
|
7
|
-
* @this {XCUITestDriver}
|
|
8
|
-
*/
|
|
9
|
-
export async function setClipboard(content, contentType) {
|
|
10
|
-
await this.proxyCommand('/wda/setPasteboard', 'POST', {
|
|
11
|
-
content,
|
|
12
|
-
contentType,
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Gets the content of the primary clipboard on the device under test.
|
|
18
|
-
*
|
|
19
|
-
* @param {string} [contentType=plaintext] - The type of the content to get.
|
|
20
|
-
* Only `plaintext`, 'image and 'url' are supported.
|
|
21
|
-
* @returns {Promise<string>} The actual clipboard content encoded into base64 string.
|
|
22
|
-
* An empty string is returned if the clipboard contains no data.
|
|
23
|
-
* @this {XCUITestDriver}
|
|
24
|
-
*/
|
|
25
|
-
export async function getClipboard(contentType) {
|
|
26
|
-
return /** @type {string} */ (
|
|
27
|
-
await this.proxyCommand('/wda/getPasteboard', 'POST', {
|
|
28
|
-
contentType,
|
|
29
|
-
})
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
35
|
-
*/
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import {utilities} from 'appium-ios-device';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Returns the miscellaneous information about the device under test.
|
|
5
|
-
*
|
|
6
|
-
* Since XCUITest driver v4.2.0, this includes device information via lockdown in a real device.
|
|
7
|
-
*
|
|
8
|
-
* @returns {Promise<DeviceInfo | (DeviceInfo & LockdownInfo)>} The response of `/wda/device/info'`
|
|
9
|
-
* @this {import('../driver').XCUITestDriver}
|
|
10
|
-
*/
|
|
11
|
-
export async function mobileGetDeviceInfo() {
|
|
12
|
-
const infoByWda = /** @type {import('./types').DeviceInfo} */ (
|
|
13
|
-
await this.proxyCommand('/wda/device/info', 'GET')
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
if (this.isRealDevice()) {
|
|
17
|
-
const lockdownInfo = await utilities.getDeviceInfo(this.device.udid);
|
|
18
|
-
return {...infoByWda, ...{lockdownInfo}};
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return infoByWda;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* @typedef {import('./types').DeviceInfo} DeviceInfo
|
|
26
|
-
* @typedef {import('./types').LockdownInfo} LockdownInfo
|
|
27
|
-
*/
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import _ from 'lodash';
|
|
2
|
-
import {assertSimulator as _assertSimulator} from '../utils';
|
|
3
|
-
import { errors } from 'appium/driver';
|
|
4
|
-
|
|
5
|
-
const assertSimulator = (driver) => _assertSimulator.call(driver, 'Content size ui command');
|
|
6
|
-
|
|
7
|
-
const INCREASE_CONTRAST_CONFIG = [
|
|
8
|
-
'enabled',
|
|
9
|
-
'disabled',
|
|
10
|
-
];
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Sets the increase contrast configuration for the given simulator.
|
|
14
|
-
*
|
|
15
|
-
* @since Xcode 15 (but lower xcode could have this command)
|
|
16
|
-
* @param {IncreaseContrastAction} increaseContrast valid increase contrast configuration value.
|
|
17
|
-
* Acceptable value is 'enabled' or 'disabled' with Xcode 16.2.
|
|
18
|
-
* @throws {Error} if the current platform does not support content size appearance changes
|
|
19
|
-
* @this {XCUITestDriver}
|
|
20
|
-
*/
|
|
21
|
-
export async function mobileSetIncreaseContrast(increaseContrast) {
|
|
22
|
-
const simulator = assertSimulator(this);
|
|
23
|
-
|
|
24
|
-
if (!INCREASE_CONTRAST_CONFIG.includes(_.lowerCase(increaseContrast))) {
|
|
25
|
-
throw new errors.InvalidArgumentError(
|
|
26
|
-
`The 'increaseContrast' value is expected to be one of ${INCREASE_CONTRAST_CONFIG.join(',')}`
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
await simulator.setIncreaseContrast(increaseContrast);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Retrieves the current increase contrast configuration value from the given simulator.
|
|
35
|
-
*
|
|
36
|
-
* @since Xcode 15 (but lower xcode could have this command)
|
|
37
|
-
* @returns {Promise<IncreaseContrastResult>} the contrast configuration value.
|
|
38
|
-
* Possible return value is 'enabled', 'disabled',
|
|
39
|
-
* 'unsupported' or 'unknown' with Xcode 16.2.
|
|
40
|
-
* @this {XCUITestDriver}
|
|
41
|
-
*/
|
|
42
|
-
export async function mobileGetIncreaseContrast() {
|
|
43
|
-
return /** @type {IncreaseContrastResult} */ (await assertSimulator(this).getIncreaseContrast());
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
48
|
-
* @typedef {import('./types').IncreaseContrastAction} IncreaseContrastAction
|
|
49
|
-
* @typedef {import('./types').IncreaseContrastResult} IncreaseContrastResult
|
|
50
|
-
*/
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import {assertSimulator as _assertSimulator} from '../utils';
|
|
2
|
-
|
|
3
|
-
const assertSimulator = (driver) => _assertSimulator.call(driver, 'Keychain modification');
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Clears keychains on a simulated device.
|
|
7
|
-
*
|
|
8
|
-
* @throws {Error} If current device is not a Simulator or there was an error
|
|
9
|
-
* while clearing keychains.
|
|
10
|
-
* @this {import('../driver').XCUITestDriver}
|
|
11
|
-
* @group Simulator Only
|
|
12
|
-
*/
|
|
13
|
-
export async function mobileClearKeychains() {
|
|
14
|
-
assertSimulator(this);
|
|
15
|
-
|
|
16
|
-
await /** @type {import('appium-ios-simulator').Simulator} */ (this.device).clearKeychains();
|
|
17
|
-
}
|
package/lib/commands/lock.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import B from 'bluebird';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Lock the device (and optionally unlock the device after a certain amount of time)
|
|
5
|
-
*
|
|
6
|
-
* @param {number|string} [seconds] - the number of seconds after which to unlock the device. Set to `0` or leave empty to require manual unlock (do not automatically unlock).
|
|
7
|
-
* @defaultValue 0
|
|
8
|
-
* @this {XCUITestDriver}
|
|
9
|
-
*/
|
|
10
|
-
export async function lock(seconds) {
|
|
11
|
-
await this.proxyCommand('/wda/lock', 'POST');
|
|
12
|
-
if (isNaN(Number(seconds))) {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const floatSeconds = parseFloat(String(seconds));
|
|
17
|
-
if (floatSeconds <= 0) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
await B.delay(floatSeconds * 1000);
|
|
22
|
-
await this.proxyCommand('/wda/unlock', 'POST');
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Unlock the device
|
|
27
|
-
*
|
|
28
|
-
* @this {XCUITestDriver}
|
|
29
|
-
*/
|
|
30
|
-
export async function unlock() {
|
|
31
|
-
await this.proxyCommand('/wda/unlock', 'POST');
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Determine whether the device is locked
|
|
36
|
-
*
|
|
37
|
-
* @this {XCUITestDriver}
|
|
38
|
-
* @returns {Promise<boolean>} `true` if the device is locked, `false` otherwise
|
|
39
|
-
*/
|
|
40
|
-
export async function isLocked() {
|
|
41
|
-
return /** @type {boolean} */ (await this.proxyCommand('/wda/locked', 'GET'));
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
46
|
-
*/
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import _ from 'lodash';
|
|
2
|
-
import { assertSimulator } from '../utils';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Sets the Simulator's pasteboard content to the given value.
|
|
6
|
-
*
|
|
7
|
-
* Does not work for real devices.
|
|
8
|
-
* @param {string} content - The content to set
|
|
9
|
-
* @param {string} encoding - The content's encoding
|
|
10
|
-
* @group Simulator Only
|
|
11
|
-
* @returns {Promise<void>}
|
|
12
|
-
* @this {XCUITestDriver}
|
|
13
|
-
*/
|
|
14
|
-
export async function mobileSetPasteboard(content, encoding = 'utf8') {
|
|
15
|
-
assertSimulator.call(this, 'Setting pasteboard content');
|
|
16
|
-
if (!_.isString(content)) {
|
|
17
|
-
// can be empty string
|
|
18
|
-
throw new Error('Pasteboard content is mandatory to set');
|
|
19
|
-
}
|
|
20
|
-
return await /** @type {import('appium-ios-simulator').Simulator} */ (this.device).simctl.setPasteboard(
|
|
21
|
-
content, /** @type {BufferEncoding} */ (encoding)
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Gets the Simulator's pasteboard content.
|
|
27
|
-
*
|
|
28
|
-
* Does not work for real devices.
|
|
29
|
-
* @param {string} encoding - Expected encoding of returned string
|
|
30
|
-
* @group Simulator Only
|
|
31
|
-
* @this {XCUITestDriver}
|
|
32
|
-
* @returns {Promise<string>} The pasteboard content string
|
|
33
|
-
*/
|
|
34
|
-
export async function mobileGetPasteboard(encoding = 'utf8') {
|
|
35
|
-
assertSimulator.call(this, 'Getting pasteboard content');
|
|
36
|
-
return await /** @type {import('appium-ios-simulator').Simulator} */ (this.device).simctl.getPasteboard(
|
|
37
|
-
/** @type {BufferEncoding} */ (encoding)
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
|
|
43
|
-
*/
|