appium-xcuitest-driver 7.21.0 → 7.21.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 (41) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/lib/commands/log.d.ts +0 -8
  3. package/build/lib/commands/log.d.ts.map +1 -1
  4. package/build/lib/commands/log.js +4 -13
  5. package/build/lib/commands/log.js.map +1 -1
  6. package/build/lib/commands/types.d.ts +5 -0
  7. package/build/lib/commands/types.d.ts.map +1 -1
  8. package/build/lib/device-log/helpers.d.ts +3 -0
  9. package/build/lib/device-log/helpers.d.ts.map +1 -0
  10. package/build/lib/device-log/helpers.js +11 -0
  11. package/build/lib/device-log/helpers.js.map +1 -0
  12. package/build/lib/device-log/ios-crash-log.d.ts +6 -17
  13. package/build/lib/device-log/ios-crash-log.d.ts.map +1 -1
  14. package/build/lib/device-log/ios-crash-log.js +4 -10
  15. package/build/lib/device-log/ios-crash-log.js.map +1 -1
  16. package/build/lib/device-log/ios-device-log.d.ts +5 -2
  17. package/build/lib/device-log/ios-device-log.d.ts.map +1 -1
  18. package/build/lib/device-log/ios-device-log.js +3 -0
  19. package/build/lib/device-log/ios-device-log.js.map +1 -1
  20. package/build/lib/device-log/ios-log.d.ts +36 -7
  21. package/build/lib/device-log/ios-log.d.ts.map +1 -1
  22. package/build/lib/device-log/ios-log.js +73 -25
  23. package/build/lib/device-log/ios-log.js.map +1 -1
  24. package/build/lib/device-log/ios-performance-log.d.ts +25 -8
  25. package/build/lib/device-log/ios-performance-log.d.ts.map +1 -1
  26. package/build/lib/device-log/ios-performance-log.js +40 -23
  27. package/build/lib/device-log/ios-performance-log.js.map +1 -1
  28. package/build/lib/device-log/ios-simulator-log.d.ts +11 -4
  29. package/build/lib/device-log/ios-simulator-log.d.ts.map +1 -1
  30. package/build/lib/device-log/ios-simulator-log.js +41 -47
  31. package/build/lib/device-log/ios-simulator-log.js.map +1 -1
  32. package/lib/commands/log.js +6 -14
  33. package/lib/commands/types.ts +6 -0
  34. package/lib/device-log/helpers.ts +9 -0
  35. package/lib/device-log/ios-crash-log.js +4 -11
  36. package/lib/device-log/ios-device-log.js +4 -2
  37. package/lib/device-log/ios-log.js +78 -27
  38. package/lib/device-log/ios-performance-log.js +40 -29
  39. package/lib/device-log/ios-simulator-log.js +45 -49
  40. package/npm-shrinkwrap.json +52 -27
  41. package/package.json +2 -2
@@ -4,10 +4,11 @@ import {logger} from 'appium/support';
4
4
  import {exec} from 'teen_process';
5
5
 
6
6
  const log = logger.getLogger('IOSSimulatorLog');
7
+ const EXECVP_ERROR_PATTERN = /execvp\(\)/;
7
8
 
8
9
  const START_TIMEOUT = 10000;
9
10
 
10
- class IOSSimulatorLog extends IOSLog {
11
+ export class IOSSimulatorLog extends IOSLog {
11
12
  constructor({sim, showLogs, xcodeVersion, iosSimulatorLogsPredicate}) {
12
13
  super();
13
14
  this.sim = sim;
@@ -17,6 +18,9 @@ class IOSSimulatorLog extends IOSLog {
17
18
  this.proc = null;
18
19
  }
19
20
 
21
+ /**
22
+ * @override
23
+ */
20
24
  async startCapture() {
21
25
  if (_.isUndefined(this.sim.udid)) {
22
26
  throw new Error(`Log capture requires a sim udid`);
@@ -44,41 +48,9 @@ class IOSSimulatorLog extends IOSLog {
44
48
  }
45
49
  }
46
50
 
47
- async finishStartingLogCapture() {
48
- if (!this.proc) {
49
- log.errorAndThrow('Could not capture simulator log');
50
- }
51
- let firstLine = true;
52
- let logRow = '';
53
- this.proc.on('output', (stdout, stderr) => {
54
- if (stdout) {
55
- if (firstLine) {
56
- if (stdout.endsWith('\n')) {
57
- // don't store the first line of the log because it came before the sim was launched
58
- firstLine = false;
59
- }
60
- } else {
61
- logRow += stdout;
62
- if (stdout.endsWith('\n')) {
63
- this.onOutput(logRow);
64
- logRow = '';
65
- }
66
- }
67
- }
68
- if (stderr) {
69
- this.onOutput(logRow, 'STDERR');
70
- }
71
- });
72
-
73
- let sd = (stdout, stderr) => {
74
- if (/execvp\(\)/.test(stderr)) {
75
- throw new Error('iOS log capture process failed to start');
76
- }
77
- return stdout || stderr;
78
- };
79
- await this.proc.start(sd, START_TIMEOUT);
80
- }
81
-
51
+ /**
52
+ * @override
53
+ */
82
54
  async stopCapture() {
83
55
  if (!this.proc) {
84
56
  return;
@@ -87,6 +59,25 @@ class IOSSimulatorLog extends IOSLog {
87
59
  this.proc = null;
88
60
  }
89
61
 
62
+ /**
63
+ * @override
64
+ */
65
+ get isCapturing() {
66
+ return this.proc && this.proc.isRunning;
67
+ }
68
+
69
+ /**
70
+ * @param {string} logRow
71
+ * @param {string} [prefix='']
72
+ */
73
+ onOutput(logRow, prefix = '') {
74
+ this.broadcast(logRow);
75
+ if (this.showLogs) {
76
+ const space = prefix.length > 0 ? ' ' : '';
77
+ log.info(`[IOS_SYSLOG_ROW${space}${prefix}] ${logRow}`);
78
+ }
79
+ }
80
+
90
81
  async killLogSubProcess() {
91
82
  if (!this.proc.isRunning) {
92
83
  return;
@@ -103,22 +94,27 @@ class IOSSimulatorLog extends IOSLog {
103
94
  }
104
95
  }
105
96
 
106
- get isCapturing() {
107
- return this.proc && this.proc.isRunning;
108
- }
97
+ async finishStartingLogCapture() {
98
+ if (!this.proc) {
99
+ log.errorAndThrow('Could not capture simulator log');
100
+ }
109
101
 
110
- onOutput(logRow, prefix = '') {
111
- const logs = _.cloneDeep(logRow.split('\n'));
112
- for (const logLine of logs) {
113
- if (!logLine) continue; // eslint-disable-line curly
114
- this.broadcast(logLine);
115
- if (this.showLogs) {
116
- const space = prefix.length > 0 ? ' ' : '';
117
- log.info(`[IOS_SYSLOG_ROW${space}${prefix}] ${logLine}`);
118
- }
102
+ for (const streamName of ['stdout', 'stderr']) {
103
+ this.proc.on(`lines-${streamName}`, (/** @type {string[]} */ lines) => {
104
+ for (const line of lines) {
105
+ this.onOutput(line, ...(streamName === 'stderr' ? ['STDERR'] : []));
106
+ }
107
+ });
119
108
  }
109
+
110
+ const startDetector = (/** @type {string} */ stdout, /** @type {string} */ stderr) => {
111
+ if (EXECVP_ERROR_PATTERN.test(stderr)) {
112
+ throw new Error('iOS log capture process failed to start');
113
+ }
114
+ return stdout || stderr;
115
+ };
116
+ await this.proc.start(startDetector, START_TIMEOUT);
120
117
  }
121
118
  }
122
119
 
123
- export {IOSSimulatorLog};
124
120
  export default IOSSimulatorLog;
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "appium-xcuitest-driver",
3
- "version": "7.21.0",
3
+ "version": "7.21.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "appium-xcuitest-driver",
9
- "version": "7.21.0",
9
+ "version": "7.21.1",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "@colors/colors": "^1.6.0",
@@ -30,7 +30,7 @@
30
30
  "portscanner": "^2.2.0",
31
31
  "semver": "^7.5.4",
32
32
  "source-map-support": "^0.x",
33
- "teen_process": "^2.0.60",
33
+ "teen_process": "^2.1.10",
34
34
  "ws": "^8.13.0"
35
35
  },
36
36
  "devDependencies": {
@@ -75,17 +75,17 @@
75
75
  }
76
76
  },
77
77
  "node_modules/@appium/base-driver": {
78
- "version": "9.11.0",
79
- "resolved": "https://registry.npmjs.org/@appium/base-driver/-/base-driver-9.11.0.tgz",
80
- "integrity": "sha512-DU6HVQL9Ys6R55c1BeSBZ8eBmQ4QjRG2vNjSJNaj4IXSfx4e9XVlVm4RbTqMbE7Tc2zsoGfqqPQFP4sxJCGsCg==",
78
+ "version": "9.11.1",
79
+ "resolved": "https://registry.npmjs.org/@appium/base-driver/-/base-driver-9.11.1.tgz",
80
+ "integrity": "sha512-gil/4mE/I9SusprGkCgePSkqnvLhv+D2CZ3xS2GkOPmCv07M0Gpsf9y9IuN9LmgyNUDalDtnXjErSn+LDjZd9g==",
81
81
  "dependencies": {
82
- "@appium/support": "^5.1.0",
82
+ "@appium/support": "^5.1.1",
83
83
  "@appium/types": "^0.21.0",
84
84
  "@colors/colors": "1.6.0",
85
85
  "@types/async-lock": "1.4.2",
86
86
  "@types/bluebird": "3.5.42",
87
87
  "@types/express": "4.17.21",
88
- "@types/lodash": "4.17.5",
88
+ "@types/lodash": "4.17.6",
89
89
  "@types/method-override": "0.0.35",
90
90
  "@types/serve-favicon": "2.5.7",
91
91
  "async-lock": "1.4.1",
@@ -96,7 +96,7 @@
96
96
  "express": "4.19.2",
97
97
  "http-status-codes": "2.3.0",
98
98
  "lodash": "4.17.21",
99
- "lru-cache": "10.2.2",
99
+ "lru-cache": "10.3.0",
100
100
  "method-override": "3.0.0",
101
101
  "morgan": "1.10.0",
102
102
  "path-to-regexp": "7.0.0",
@@ -113,17 +113,12 @@
113
113
  "spdy": "4.0.2"
114
114
  }
115
115
  },
116
- "node_modules/@appium/base-driver/node_modules/@types/lodash": {
117
- "version": "4.17.5",
118
- "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.5.tgz",
119
- "integrity": "sha512-MBIOHVZqVqgfro1euRDWX7OO0fBVUUMrN6Pwm8LQsz8cWhEpihlvR70ENj3f40j58TNxZaWv2ndSkInykNBBJw=="
120
- },
121
116
  "node_modules/@appium/docutils": {
122
- "version": "1.0.16",
123
- "resolved": "https://registry.npmjs.org/@appium/docutils/-/docutils-1.0.16.tgz",
124
- "integrity": "sha512-EjBN/Y3HW4cugjJcGBu8KEnqYZVr99TqnioVF5yOUmN7b/1j/tsvcsaRP+7w8h/cVAVSk+v4oDcLp8sU6dHl6A==",
117
+ "version": "1.0.17",
118
+ "resolved": "https://registry.npmjs.org/@appium/docutils/-/docutils-1.0.17.tgz",
119
+ "integrity": "sha512-SXJftkyY2YRvPouPFuYAUrv9Yw8tkKHUUoBFQrOH5yvMOxt4RIx6G9TktHcisZ8p0y66fa+pr8ic87jnDPlCvA==",
125
120
  "dependencies": {
126
- "@appium/support": "^5.1.0",
121
+ "@appium/support": "^5.1.1",
127
122
  "@appium/tsconfig": "^0.3.3",
128
123
  "@sliphua/lilconfig-ts-loader": "3.2.2",
129
124
  "@types/which": "3.0.4",
@@ -152,6 +147,21 @@
152
147
  "npm": ">=8"
153
148
  }
154
149
  },
150
+ "node_modules/@appium/docutils/node_modules/teen_process": {
151
+ "version": "2.1.6",
152
+ "resolved": "https://registry.npmjs.org/teen_process/-/teen_process-2.1.6.tgz",
153
+ "integrity": "sha512-VCbxLX0EMjnq3kYS+UJBlqAIJJeNfAxDExLLX0jvWa8KyRPbVLzc+CHFwigwR8fTWIdsVOXR2f7owrSq1xtYrw==",
154
+ "dependencies": {
155
+ "bluebird": "^3.7.2",
156
+ "lodash": "^4.17.21",
157
+ "shell-quote": "^1.8.1",
158
+ "source-map-support": "^0.x"
159
+ },
160
+ "engines": {
161
+ "node": "^16.13.0 || >=18.0.0",
162
+ "npm": ">=8"
163
+ }
164
+ },
155
165
  "node_modules/@appium/logger": {
156
166
  "version": "1.5.0",
157
167
  "resolved": "https://registry.npmjs.org/@appium/logger/-/logger-1.5.0.tgz",
@@ -194,9 +204,9 @@
194
204
  }
195
205
  },
196
206
  "node_modules/@appium/support": {
197
- "version": "5.1.0",
198
- "resolved": "https://registry.npmjs.org/@appium/support/-/support-5.1.0.tgz",
199
- "integrity": "sha512-i3h5b811wSjshSPZzf+vRWvXMJ0cCnevpxcnNGYSu2HVxZtGRGx2wxkXiJnrojadQHCtA0wVwm0wHqudMb6kwA==",
207
+ "version": "5.1.1",
208
+ "resolved": "https://registry.npmjs.org/@appium/support/-/support-5.1.1.tgz",
209
+ "integrity": "sha512-YwludQ+V5mgGYJQjkuDJ29X0LSJehBeC5IwvaZxKdv/VKLKAbOl3QZqv3RKIGJqQInP6ZOD+doG3OVP64Y/txQ==",
200
210
  "dependencies": {
201
211
  "@appium/logger": "^1.5.0",
202
212
  "@appium/tsconfig": "^0.3.3",
@@ -259,6 +269,21 @@
259
269
  "sharp": "0.33.4"
260
270
  }
261
271
  },
272
+ "node_modules/@appium/support/node_modules/teen_process": {
273
+ "version": "2.1.6",
274
+ "resolved": "https://registry.npmjs.org/teen_process/-/teen_process-2.1.6.tgz",
275
+ "integrity": "sha512-VCbxLX0EMjnq3kYS+UJBlqAIJJeNfAxDExLLX0jvWa8KyRPbVLzc+CHFwigwR8fTWIdsVOXR2f7owrSq1xtYrw==",
276
+ "dependencies": {
277
+ "bluebird": "^3.7.2",
278
+ "lodash": "^4.17.21",
279
+ "shell-quote": "^1.8.1",
280
+ "source-map-support": "^0.x"
281
+ },
282
+ "engines": {
283
+ "node": "^16.13.0 || >=18.0.0",
284
+ "npm": ">=8"
285
+ }
286
+ },
262
287
  "node_modules/@appium/tsconfig": {
263
288
  "version": "0.3.3",
264
289
  "resolved": "https://registry.npmjs.org/@appium/tsconfig/-/tsconfig-0.3.3.tgz",
@@ -2420,9 +2445,9 @@
2420
2445
  }
2421
2446
  },
2422
2447
  "node_modules/lru-cache": {
2423
- "version": "10.2.2",
2424
- "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.2.tgz",
2425
- "integrity": "sha512-9hp3Vp2/hFQUiIwKo8XCeFVnrg8Pk3TYNPIR7tJADKi5YfcF7vEaK7avFHTlSy3kOKYaJQaalfEo6YuXdceBOQ==",
2448
+ "version": "10.3.0",
2449
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.3.0.tgz",
2450
+ "integrity": "sha512-CQl19J/g+Hbjbv4Y3mFNNXFEL/5t/KCg8POCuUqd4rMKjGG+j1ybER83hxV58zL+dFI1PTkt3GNFSHRt+d8qEQ==",
2426
2451
  "engines": {
2427
2452
  "node": "14 || >=16.14"
2428
2453
  }
@@ -3717,9 +3742,9 @@
3717
3742
  }
3718
3743
  },
3719
3744
  "node_modules/teen_process": {
3720
- "version": "2.1.6",
3721
- "resolved": "https://registry.npmjs.org/teen_process/-/teen_process-2.1.6.tgz",
3722
- "integrity": "sha512-VCbxLX0EMjnq3kYS+UJBlqAIJJeNfAxDExLLX0jvWa8KyRPbVLzc+CHFwigwR8fTWIdsVOXR2f7owrSq1xtYrw==",
3745
+ "version": "2.1.10",
3746
+ "resolved": "https://registry.npmjs.org/teen_process/-/teen_process-2.1.10.tgz",
3747
+ "integrity": "sha512-zEXJ+qOij5Kiov7X5rvWexo3yV9EJiVdjM53XTD0E7v8QxEOHoGBeIy4J/iKDD2sCO60sIaSIRS4Y50Tya5/PA==",
3723
3748
  "dependencies": {
3724
3749
  "bluebird": "^3.7.2",
3725
3750
  "lodash": "^4.17.21",
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "xcuitest",
9
9
  "xctest"
10
10
  ],
11
- "version": "7.21.0",
11
+ "version": "7.21.1",
12
12
  "author": "Appium Contributors",
13
13
  "license": "Apache-2.0",
14
14
  "repository": {
@@ -97,7 +97,7 @@
97
97
  "portscanner": "^2.2.0",
98
98
  "semver": "^7.5.4",
99
99
  "source-map-support": "^0.x",
100
- "teen_process": "^2.0.60",
100
+ "teen_process": "^2.1.10",
101
101
  "ws": "^8.13.0"
102
102
  },
103
103
  "scripts": {