appium-xcuitest-driver 7.22.1 → 7.23.1
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/certificate.js +4 -4
- package/build/lib/commands/certificate.js.map +1 -1
- package/build/lib/commands/log.d.ts.map +1 -1
- package/build/lib/commands/log.js +2 -1
- package/build/lib/commands/log.js.map +1 -1
- package/build/lib/commands/memory.js +1 -1
- package/build/lib/commands/memory.js.map +1 -1
- package/build/lib/commands/pcap.d.ts.map +1 -1
- package/build/lib/commands/pcap.js +3 -7
- package/build/lib/commands/pcap.js.map +1 -1
- package/build/lib/device-log/helpers.d.ts +4 -0
- package/build/lib/device-log/helpers.d.ts.map +1 -1
- package/build/lib/device-log/helpers.js +22 -0
- package/build/lib/device-log/helpers.js.map +1 -1
- package/build/lib/device-log/ios-crash-log.d.ts +30 -38
- package/build/lib/device-log/ios-crash-log.d.ts.map +1 -1
- package/build/lib/device-log/ios-crash-log.js +97 -100
- package/build/lib/device-log/ios-crash-log.js.map +1 -1
- package/build/lib/device-log/ios-log.d.ts +1 -1
- package/build/lib/device-log/ios-log.d.ts.map +1 -1
- package/build/lib/device-log/ios-log.js +2 -1
- package/build/lib/device-log/ios-log.js.map +1 -1
- package/build/lib/driver.d.ts +4 -2
- package/build/lib/driver.d.ts.map +1 -1
- package/build/lib/driver.js +2 -2
- package/build/lib/driver.js.map +1 -1
- package/build/lib/real-device-clients/base-device-client.d.ts +22 -0
- package/build/lib/real-device-clients/base-device-client.d.ts.map +1 -0
- package/build/lib/real-device-clients/base-device-client.js +13 -0
- package/build/lib/real-device-clients/base-device-client.js.map +1 -0
- package/build/lib/real-device-clients/devicectl.d.ts.map +1 -0
- package/build/lib/real-device-clients/devicectl.js.map +1 -0
- package/build/lib/real-device-clients/py-ios-device-client.d.ts +21 -0
- package/build/lib/real-device-clients/py-ios-device-client.d.ts.map +1 -0
- package/build/lib/{py-ios-device-client.js → real-device-clients/py-ios-device-client.js} +53 -84
- package/build/lib/real-device-clients/py-ios-device-client.js.map +1 -0
- package/build/lib/real-device.d.ts +1 -1
- package/build/lib/real-device.d.ts.map +1 -1
- package/build/lib/real-device.js +1 -1
- package/build/lib/real-device.js.map +1 -1
- package/lib/commands/certificate.js +1 -1
- package/lib/commands/log.js +2 -1
- package/lib/commands/memory.js +1 -1
- package/lib/commands/pcap.js +3 -4
- package/lib/device-log/helpers.ts +27 -0
- package/lib/device-log/ios-crash-log.ts +167 -0
- package/lib/device-log/ios-log.ts +2 -1
- package/lib/driver.js +1 -1
- package/lib/real-device-clients/base-device-client.ts +34 -0
- package/lib/real-device-clients/py-ios-device-client.ts +149 -0
- package/lib/real-device.js +1 -1
- package/npm-shrinkwrap.json +35 -28
- package/package.json +1 -2
- package/build/lib/devicectl.d.ts.map +0 -1
- package/build/lib/devicectl.js.map +0 -1
- package/build/lib/py-ios-device-client.d.ts +0 -76
- package/build/lib/py-ios-device-client.d.ts.map +0 -1
- package/build/lib/py-ios-device-client.js.map +0 -1
- package/lib/device-log/ios-crash-log.js +0 -146
- package/lib/py-ios-device-client.js +0 -167
- /package/build/lib/{devicectl.d.ts → real-device-clients/devicectl.d.ts} +0 -0
- /package/build/lib/{devicectl.js → real-device-clients/devicectl.js} +0 -0
- /package/lib/{devicectl.js → real-device-clients/devicectl.js} +0 -0
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
import {exec, SubProcess} from 'teen_process';
|
|
2
|
-
import {fs, util, tempDir} from 'appium/support';
|
|
3
|
-
import log from './logger';
|
|
4
|
-
import path from 'path';
|
|
5
|
-
|
|
6
|
-
// https://github.com/YueChen-C/py-ios-device
|
|
7
|
-
|
|
8
|
-
const BINARY_NAME = 'pyidevice';
|
|
9
|
-
|
|
10
|
-
class Pyidevice {
|
|
11
|
-
/**
|
|
12
|
-
* @param {string} udid
|
|
13
|
-
*/
|
|
14
|
-
constructor(udid) {
|
|
15
|
-
this.udid = udid;
|
|
16
|
-
this.binaryPath = null;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* @param {boolean} isStrict
|
|
21
|
-
* @return {Promise<boolean>}
|
|
22
|
-
*/
|
|
23
|
-
async assertExists(isStrict = true) {
|
|
24
|
-
if (this.binaryPath) {
|
|
25
|
-
return true;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
try {
|
|
29
|
-
this.binaryPath = await fs.which(BINARY_NAME);
|
|
30
|
-
return true;
|
|
31
|
-
} catch (e) {
|
|
32
|
-
if (isStrict) {
|
|
33
|
-
throw new Error(
|
|
34
|
-
`${BINARY_NAME} binary cannot be found in PATH. ` +
|
|
35
|
-
`Please make sure it is installed. Visit https://github.com/YueChen-C/py-ios-device for ` +
|
|
36
|
-
`more details.`,
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* @typedef {Object} ExecuteOptions
|
|
45
|
-
* @property {string} cwd
|
|
46
|
-
* @property {string?} format [json]
|
|
47
|
-
* @property {boolean} logStdout [false]
|
|
48
|
-
* @property {boolean} asynchronous [false]
|
|
49
|
-
*/
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* @param {string[]} args
|
|
53
|
-
* @param {Partial<ExecuteOptions>} opts
|
|
54
|
-
* @return {Promise<import('teen_process').TeenProcessExecResult|import('teen_process').SubProcess>}
|
|
55
|
-
*/
|
|
56
|
-
async execute(args, opts = {}) {
|
|
57
|
-
await this.assertExists();
|
|
58
|
-
const {cwd, format = 'json', logStdout = false, asynchronous = false} = opts;
|
|
59
|
-
|
|
60
|
-
const finalArgs = [...args, '--udid', this.udid, '--network'];
|
|
61
|
-
if (format) {
|
|
62
|
-
finalArgs.push('--format', format);
|
|
63
|
-
}
|
|
64
|
-
const binaryPath = /** @type {string} */ (this.binaryPath);
|
|
65
|
-
const cmdStr = util.quote([binaryPath, ...finalArgs]);
|
|
66
|
-
log.debug(`Executing ${cmdStr}`);
|
|
67
|
-
try {
|
|
68
|
-
if (asynchronous) {
|
|
69
|
-
const result = new SubProcess(binaryPath, finalArgs, {cwd});
|
|
70
|
-
await result.start(0);
|
|
71
|
-
return result;
|
|
72
|
-
}
|
|
73
|
-
const result = await exec(binaryPath, finalArgs, {cwd});
|
|
74
|
-
if (logStdout) {
|
|
75
|
-
log.debug(`Command output: ${result.stdout}`);
|
|
76
|
-
}
|
|
77
|
-
return result;
|
|
78
|
-
} catch (e) {
|
|
79
|
-
throw new Error(`'${cmdStr}' failed. Original error: ${e.stderr || e.stdout || e.message}`);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* @return {Promise<object>}
|
|
85
|
-
*/
|
|
86
|
-
async listProfiles() {
|
|
87
|
-
const {stdout} = /** @type {import('teen_process').TeenProcessExecResult} */ (
|
|
88
|
-
await this.execute(['profiles', 'list'])
|
|
89
|
-
);
|
|
90
|
-
return JSON.parse(stdout);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
*
|
|
95
|
-
* @param { {profilePath?: string, payload: string|Buffer} } opts
|
|
96
|
-
* @privateRemarks The error below seems to suggest that `payload` can be undefined, but the code suggests otherwise
|
|
97
|
-
*/
|
|
98
|
-
async installProfile(opts) {
|
|
99
|
-
const {profilePath, payload} = opts ?? {};
|
|
100
|
-
if (!profilePath && !payload) {
|
|
101
|
-
throw new Error('Either the full path to the profile or its payload must be provided');
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
let tmpRoot;
|
|
105
|
-
let srcPath = profilePath;
|
|
106
|
-
try {
|
|
107
|
-
if (!srcPath) {
|
|
108
|
-
tmpRoot = await tempDir.openDir();
|
|
109
|
-
srcPath = path.join(tmpRoot, 'cert.pem');
|
|
110
|
-
await fs.writeFile(srcPath, payload, 'utf8');
|
|
111
|
-
}
|
|
112
|
-
await this.execute(['profiles', 'install', '--path', srcPath], {
|
|
113
|
-
logStdout: true,
|
|
114
|
-
});
|
|
115
|
-
} finally {
|
|
116
|
-
if (tmpRoot) {
|
|
117
|
-
await fs.rimraf(tmpRoot);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
*
|
|
124
|
-
* @param {string} name
|
|
125
|
-
* @returns {Promise<string>}
|
|
126
|
-
*/
|
|
127
|
-
async removeProfile(name) {
|
|
128
|
-
return /** @type {import('teen_process').TeenProcessExecResult} */ (
|
|
129
|
-
await this.execute(['profiles', 'remove', '--name', name], {logStdout: true})
|
|
130
|
-
).stdout;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* @returns {Promise<object>}
|
|
135
|
-
*/
|
|
136
|
-
async listCrashes() {
|
|
137
|
-
const {stdout} = /** @type {import('teen_process').TeenProcessExecResult} */ (
|
|
138
|
-
await this.execute(['crash', 'list'])
|
|
139
|
-
);
|
|
140
|
-
return JSON.parse(stdout.replace(/'/g, '"')).filter((x) => !['.', '..'].includes(x));
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* @param {string} name
|
|
145
|
-
* @param {string} dstFolder
|
|
146
|
-
* @returns {Promise<void>}
|
|
147
|
-
*/
|
|
148
|
-
async exportCrash(name, dstFolder) {
|
|
149
|
-
await this.execute(['crash', 'export', '--name', name], {
|
|
150
|
-
logStdout: true,
|
|
151
|
-
// The tool exports crash reports to the current working dir
|
|
152
|
-
cwd: dstFolder,
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* @param {string} dstFile
|
|
157
|
-
*/
|
|
158
|
-
async collectPcap(dstFile) {
|
|
159
|
-
return await this.execute(['pcapd', dstFile], {
|
|
160
|
-
format: null,
|
|
161
|
-
asynchronous: true,
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
export {Pyidevice};
|
|
167
|
-
export default Pyidevice;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|