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.
Files changed (64) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/build/lib/commands/certificate.js +4 -4
  3. package/build/lib/commands/certificate.js.map +1 -1
  4. package/build/lib/commands/log.d.ts.map +1 -1
  5. package/build/lib/commands/log.js +2 -1
  6. package/build/lib/commands/log.js.map +1 -1
  7. package/build/lib/commands/memory.js +1 -1
  8. package/build/lib/commands/memory.js.map +1 -1
  9. package/build/lib/commands/pcap.d.ts.map +1 -1
  10. package/build/lib/commands/pcap.js +3 -7
  11. package/build/lib/commands/pcap.js.map +1 -1
  12. package/build/lib/device-log/helpers.d.ts +4 -0
  13. package/build/lib/device-log/helpers.d.ts.map +1 -1
  14. package/build/lib/device-log/helpers.js +22 -0
  15. package/build/lib/device-log/helpers.js.map +1 -1
  16. package/build/lib/device-log/ios-crash-log.d.ts +30 -38
  17. package/build/lib/device-log/ios-crash-log.d.ts.map +1 -1
  18. package/build/lib/device-log/ios-crash-log.js +97 -100
  19. package/build/lib/device-log/ios-crash-log.js.map +1 -1
  20. package/build/lib/device-log/ios-log.d.ts +1 -1
  21. package/build/lib/device-log/ios-log.d.ts.map +1 -1
  22. package/build/lib/device-log/ios-log.js +2 -1
  23. package/build/lib/device-log/ios-log.js.map +1 -1
  24. package/build/lib/driver.d.ts +4 -2
  25. package/build/lib/driver.d.ts.map +1 -1
  26. package/build/lib/driver.js +2 -2
  27. package/build/lib/driver.js.map +1 -1
  28. package/build/lib/real-device-clients/base-device-client.d.ts +22 -0
  29. package/build/lib/real-device-clients/base-device-client.d.ts.map +1 -0
  30. package/build/lib/real-device-clients/base-device-client.js +13 -0
  31. package/build/lib/real-device-clients/base-device-client.js.map +1 -0
  32. package/build/lib/real-device-clients/devicectl.d.ts.map +1 -0
  33. package/build/lib/real-device-clients/devicectl.js.map +1 -0
  34. package/build/lib/real-device-clients/py-ios-device-client.d.ts +21 -0
  35. package/build/lib/real-device-clients/py-ios-device-client.d.ts.map +1 -0
  36. package/build/lib/{py-ios-device-client.js → real-device-clients/py-ios-device-client.js} +53 -84
  37. package/build/lib/real-device-clients/py-ios-device-client.js.map +1 -0
  38. package/build/lib/real-device.d.ts +1 -1
  39. package/build/lib/real-device.d.ts.map +1 -1
  40. package/build/lib/real-device.js +1 -1
  41. package/build/lib/real-device.js.map +1 -1
  42. package/lib/commands/certificate.js +1 -1
  43. package/lib/commands/log.js +2 -1
  44. package/lib/commands/memory.js +1 -1
  45. package/lib/commands/pcap.js +3 -4
  46. package/lib/device-log/helpers.ts +27 -0
  47. package/lib/device-log/ios-crash-log.ts +167 -0
  48. package/lib/device-log/ios-log.ts +2 -1
  49. package/lib/driver.js +1 -1
  50. package/lib/real-device-clients/base-device-client.ts +34 -0
  51. package/lib/real-device-clients/py-ios-device-client.ts +149 -0
  52. package/lib/real-device.js +1 -1
  53. package/npm-shrinkwrap.json +35 -28
  54. package/package.json +1 -2
  55. package/build/lib/devicectl.d.ts.map +0 -1
  56. package/build/lib/devicectl.js.map +0 -1
  57. package/build/lib/py-ios-device-client.d.ts +0 -76
  58. package/build/lib/py-ios-device-client.d.ts.map +0 -1
  59. package/build/lib/py-ios-device-client.js.map +0 -1
  60. package/lib/device-log/ios-crash-log.js +0 -146
  61. package/lib/py-ios-device-client.js +0 -167
  62. /package/build/lib/{devicectl.d.ts → real-device-clients/devicectl.d.ts} +0 -0
  63. /package/build/lib/{devicectl.js → real-device-clients/devicectl.js} +0 -0
  64. /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;