appium-xcuitest-driver 10.8.2 → 10.8.4
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/app-management.js +1 -1
- package/build/lib/commands/app-management.js.map +1 -1
- package/build/lib/commands/file-movement.d.ts.map +1 -1
- package/build/lib/commands/file-movement.js +4 -4
- package/build/lib/commands/file-movement.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/performance.d.ts.map +1 -1
- package/build/lib/commands/performance.js +13 -4
- package/build/lib/commands/performance.js.map +1 -1
- package/build/lib/commands/xctest-record-screen.js +1 -1
- package/build/lib/commands/xctest-record-screen.js.map +1 -1
- package/build/lib/desired-caps.d.ts +9 -7
- package/build/lib/desired-caps.d.ts.map +1 -1
- package/build/lib/desired-caps.js +1 -0
- package/build/lib/desired-caps.js.map +1 -1
- package/build/lib/device/device-connections-factory.d.ts +18 -0
- package/build/lib/device/device-connections-factory.d.ts.map +1 -0
- package/build/lib/{device-connections-factory.js → device/device-connections-factory.js} +57 -41
- package/build/lib/device/device-connections-factory.js.map +1 -0
- package/build/lib/device/real-device-management.d.ts +146 -0
- package/build/lib/device/real-device-management.d.ts.map +1 -0
- package/build/lib/device/real-device-management.js +727 -0
- package/build/lib/device/real-device-management.js.map +1 -0
- package/build/lib/device/simulator-management.d.ts +65 -0
- package/build/lib/device/simulator-management.d.ts.map +1 -0
- package/build/lib/{simulator-management.js → device/simulator-management.js} +23 -42
- package/build/lib/device/simulator-management.js.map +1 -0
- package/build/lib/driver.d.ts +4 -1
- package/build/lib/driver.d.ts.map +1 -1
- package/build/lib/driver.js +5 -6
- package/build/lib/driver.js.map +1 -1
- package/lib/commands/app-management.js +1 -1
- package/lib/commands/file-movement.js +8 -4
- package/lib/commands/memory.js +1 -1
- package/lib/commands/performance.js +12 -1
- package/lib/commands/xctest-record-screen.js +1 -1
- package/lib/desired-caps.js +1 -0
- package/lib/{device-connections-factory.js → device/device-connections-factory.ts} +96 -60
- package/lib/device/real-device-management.ts +818 -0
- package/lib/{simulator-management.js → device/simulator-management.ts} +68 -61
- package/lib/driver.js +3 -5
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/build/lib/device-connections-factory.d.ts +0 -13
- package/build/lib/device-connections-factory.d.ts.map +0 -1
- package/build/lib/device-connections-factory.js.map +0 -1
- package/build/lib/ios-fs-helpers.d.ts +0 -75
- package/build/lib/ios-fs-helpers.d.ts.map +0 -1
- package/build/lib/ios-fs-helpers.js +0 -370
- package/build/lib/ios-fs-helpers.js.map +0 -1
- package/build/lib/real-device-management.d.ts +0 -53
- package/build/lib/real-device-management.d.ts.map +0 -1
- package/build/lib/real-device-management.js +0 -128
- package/build/lib/real-device-management.js.map +0 -1
- package/build/lib/real-device.d.ts +0 -112
- package/build/lib/real-device.d.ts.map +0 -1
- package/build/lib/real-device.js +0 -352
- package/build/lib/real-device.js.map +0 -1
- package/build/lib/simulator-management.d.ts +0 -96
- package/build/lib/simulator-management.d.ts.map +0 -1
- package/build/lib/simulator-management.js.map +0 -1
- package/build/lib/xcrun.d.ts +0 -3
- package/build/lib/xcrun.d.ts.map +0 -1
- package/build/lib/xcrun.js +0 -17
- package/build/lib/xcrun.js.map +0 -1
- package/lib/ios-fs-helpers.js +0 -355
- package/lib/real-device-management.js +0 -133
- package/lib/real-device.js +0 -347
- package/lib/xcrun.js +0 -16
|
@@ -1,370 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.IO_TIMEOUT_MS = void 0;
|
|
40
|
-
exports.pullFile = pullFile;
|
|
41
|
-
exports.pullFolder = pullFolder;
|
|
42
|
-
exports.pushFile = pushFile;
|
|
43
|
-
exports.pushFolder = pushFolder;
|
|
44
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
45
|
-
const bluebird_1 = __importStar(require("bluebird"));
|
|
46
|
-
const support_1 = require("appium/support");
|
|
47
|
-
const path_1 = __importDefault(require("path"));
|
|
48
|
-
const logger_1 = __importDefault(require("./logger"));
|
|
49
|
-
exports.IO_TIMEOUT_MS = 4 * 60 * 1000;
|
|
50
|
-
// Mobile devices use NAND memory modules for the storage,
|
|
51
|
-
// and the parallelism there is not as performant as on regular SSDs
|
|
52
|
-
const MAX_IO_CHUNK_SIZE = 8;
|
|
53
|
-
/**
|
|
54
|
-
* Retrieve a file from a real device
|
|
55
|
-
*
|
|
56
|
-
* @param {any} afcService Apple File Client service instance from
|
|
57
|
-
* 'appium-ios-device' module
|
|
58
|
-
* @param {string} remotePath Relative path to the file on the device
|
|
59
|
-
* @returns {Promise<Buffer>} The file content as a buffer
|
|
60
|
-
*/
|
|
61
|
-
async function pullFile(afcService, remotePath) {
|
|
62
|
-
const stream = await afcService.createReadStream(remotePath, { autoDestroy: true });
|
|
63
|
-
const pullPromise = new bluebird_1.default((resolve, reject) => {
|
|
64
|
-
stream.on('close', resolve);
|
|
65
|
-
stream.on('error', reject);
|
|
66
|
-
}).timeout(exports.IO_TIMEOUT_MS);
|
|
67
|
-
const buffers = [];
|
|
68
|
-
stream.on('data', (data) => buffers.push(data));
|
|
69
|
-
await pullPromise;
|
|
70
|
-
return Buffer.concat(buffers);
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Checks a presence of a local folder.
|
|
74
|
-
*
|
|
75
|
-
* @param {string} folderPath Full path to the local folder
|
|
76
|
-
* @returns {Promise<boolean>} True if the folder exists and is actually a folder
|
|
77
|
-
*/
|
|
78
|
-
async function folderExists(folderPath) {
|
|
79
|
-
try {
|
|
80
|
-
return (await support_1.fs.stat(folderPath)).isDirectory();
|
|
81
|
-
}
|
|
82
|
-
catch {
|
|
83
|
-
return false;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Retrieve a folder from a real device
|
|
88
|
-
*
|
|
89
|
-
* @param {any} afcService Apple File Client service instance from
|
|
90
|
-
* 'appium-ios-device' module
|
|
91
|
-
* @param {string} remoteRootPath Relative path to the folder on the device
|
|
92
|
-
* @returns {Promise<Buffer>} The folder content as a zipped base64-encoded buffer
|
|
93
|
-
*/
|
|
94
|
-
async function pullFolder(afcService, remoteRootPath) {
|
|
95
|
-
const tmpFolder = await support_1.tempDir.openDir();
|
|
96
|
-
try {
|
|
97
|
-
let localTopItem = null;
|
|
98
|
-
let countFilesSuccess = 0;
|
|
99
|
-
let countFilesFail = 0;
|
|
100
|
-
let countFolders = 0;
|
|
101
|
-
const pullPromises = [];
|
|
102
|
-
await afcService.walkDir(remoteRootPath, true, async (remotePath, isDir) => {
|
|
103
|
-
const localPath = path_1.default.join(tmpFolder, remotePath);
|
|
104
|
-
const dirname = isDir ? localPath : path_1.default.dirname(localPath);
|
|
105
|
-
if (!(await folderExists(dirname))) {
|
|
106
|
-
await (0, support_1.mkdirp)(dirname);
|
|
107
|
-
}
|
|
108
|
-
if (!localTopItem || localPath.split(path_1.default.sep).length < localTopItem.split(path_1.default.sep).length) {
|
|
109
|
-
localTopItem = localPath;
|
|
110
|
-
}
|
|
111
|
-
if (isDir) {
|
|
112
|
-
++countFolders;
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
const readStream = await afcService.createReadStream(remotePath, { autoDestroy: true });
|
|
116
|
-
const writeStream = support_1.fs.createWriteStream(localPath, { autoClose: true });
|
|
117
|
-
pullPromises.push(new bluebird_1.default((resolve) => {
|
|
118
|
-
writeStream.on('close', () => {
|
|
119
|
-
++countFilesSuccess;
|
|
120
|
-
resolve();
|
|
121
|
-
});
|
|
122
|
-
const onStreamingError = (e) => {
|
|
123
|
-
readStream.unpipe(writeStream);
|
|
124
|
-
logger_1.default.warn(`Cannot pull '${remotePath}' to '${localPath}'. ` +
|
|
125
|
-
`The file will be skipped. Original error: ${e.message}`);
|
|
126
|
-
++countFilesFail;
|
|
127
|
-
resolve();
|
|
128
|
-
};
|
|
129
|
-
writeStream.on('error', onStreamingError);
|
|
130
|
-
readStream.on('error', onStreamingError);
|
|
131
|
-
}).timeout(exports.IO_TIMEOUT_MS));
|
|
132
|
-
readStream.pipe(writeStream);
|
|
133
|
-
if (pullPromises.length >= MAX_IO_CHUNK_SIZE) {
|
|
134
|
-
await bluebird_1.default.any(pullPromises);
|
|
135
|
-
for (let i = pullPromises.length - 1; i >= 0; i--) {
|
|
136
|
-
if (pullPromises[i].isFulfilled()) {
|
|
137
|
-
pullPromises.splice(i, 1);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
// Wait for the rest of files to be pulled
|
|
143
|
-
if (!lodash_1.default.isEmpty(pullPromises)) {
|
|
144
|
-
await bluebird_1.default.all(pullPromises);
|
|
145
|
-
}
|
|
146
|
-
logger_1.default.info(`Pulled ${support_1.util.pluralize('file', countFilesSuccess, true)} out of ` +
|
|
147
|
-
`${countFilesSuccess + countFilesFail} and ${support_1.util.pluralize('folder', countFolders, true)} ` +
|
|
148
|
-
`from '${remoteRootPath}'`);
|
|
149
|
-
return await support_1.zip.toInMemoryZip(localTopItem ? path_1.default.dirname(localTopItem) : tmpFolder, {
|
|
150
|
-
encodeToBase64: true,
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
finally {
|
|
154
|
-
await support_1.fs.rimraf(tmpFolder);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Creates remote folder path recursively. Noop if the given path
|
|
159
|
-
* already exists
|
|
160
|
-
*
|
|
161
|
-
* @param {any} afcService Apple File Client service instance from
|
|
162
|
-
* 'appium-ios-device' module
|
|
163
|
-
* @param {string} remoteRoot The relative path to the remote folder structure
|
|
164
|
-
* to be created
|
|
165
|
-
*/
|
|
166
|
-
async function remoteMkdirp(afcService, remoteRoot) {
|
|
167
|
-
if (remoteRoot === '.' || remoteRoot === '/') {
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
try {
|
|
171
|
-
await afcService.listDirectory(remoteRoot);
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
catch {
|
|
175
|
-
// This means that the directory is missing and we got an object not found error.
|
|
176
|
-
// Therefore, we are going to the parent
|
|
177
|
-
await remoteMkdirp(afcService, path_1.default.dirname(remoteRoot));
|
|
178
|
-
}
|
|
179
|
-
await afcService.createDirectory(remoteRoot);
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* @typedef {Object} PushFileOptions
|
|
183
|
-
* @property {number} [timeoutMs=240000] The maximum count of milliceconds to wait until
|
|
184
|
-
* file push is completed. Cannot be lower than 60000ms
|
|
185
|
-
*/
|
|
186
|
-
/**
|
|
187
|
-
* Pushes a file to a real device
|
|
188
|
-
*
|
|
189
|
-
* @param {any} afcService afcService Apple File Client service instance from
|
|
190
|
-
* 'appium-ios-device' module
|
|
191
|
-
* @param {string|Buffer} localPathOrPayload Either full path to the source file
|
|
192
|
-
* or a buffer payload to be written into the remote destination
|
|
193
|
-
* @param {string} remotePath Relative path to the file on the device. The remote
|
|
194
|
-
* folder structure is created automatically if necessary.
|
|
195
|
-
* @param {PushFileOptions} [opts={}]
|
|
196
|
-
*/
|
|
197
|
-
async function pushFile(afcService, localPathOrPayload, remotePath, opts = {}) {
|
|
198
|
-
const { timeoutMs = exports.IO_TIMEOUT_MS } = opts;
|
|
199
|
-
const timer = new support_1.timing.Timer().start();
|
|
200
|
-
await remoteMkdirp(afcService, path_1.default.dirname(remotePath));
|
|
201
|
-
const source = Buffer.isBuffer(localPathOrPayload)
|
|
202
|
-
? localPathOrPayload
|
|
203
|
-
: support_1.fs.createReadStream(localPathOrPayload, { autoClose: true });
|
|
204
|
-
const writeStream = await afcService.createWriteStream(remotePath, {
|
|
205
|
-
autoDestroy: true,
|
|
206
|
-
});
|
|
207
|
-
writeStream.on('finish', writeStream.destroy);
|
|
208
|
-
let pushError = null;
|
|
209
|
-
const filePushPromise = new bluebird_1.default((resolve, reject) => {
|
|
210
|
-
writeStream.on('close', () => {
|
|
211
|
-
if (pushError) {
|
|
212
|
-
reject(pushError);
|
|
213
|
-
}
|
|
214
|
-
else {
|
|
215
|
-
resolve();
|
|
216
|
-
}
|
|
217
|
-
});
|
|
218
|
-
const onStreamError = (e) => {
|
|
219
|
-
if (!Buffer.isBuffer(source)) {
|
|
220
|
-
source.unpipe(writeStream);
|
|
221
|
-
}
|
|
222
|
-
logger_1.default.debug(e);
|
|
223
|
-
pushError = e;
|
|
224
|
-
};
|
|
225
|
-
writeStream.on('error', onStreamError);
|
|
226
|
-
if (!Buffer.isBuffer(source)) {
|
|
227
|
-
source.on('error', onStreamError);
|
|
228
|
-
}
|
|
229
|
-
});
|
|
230
|
-
if (Buffer.isBuffer(source)) {
|
|
231
|
-
writeStream.write(source);
|
|
232
|
-
writeStream.end();
|
|
233
|
-
}
|
|
234
|
-
else {
|
|
235
|
-
source.pipe(writeStream);
|
|
236
|
-
}
|
|
237
|
-
await filePushPromise.timeout(Math.max(timeoutMs, 60000));
|
|
238
|
-
const fileSize = Buffer.isBuffer(localPathOrPayload)
|
|
239
|
-
? localPathOrPayload.length
|
|
240
|
-
: (await support_1.fs.stat(localPathOrPayload)).size;
|
|
241
|
-
logger_1.default.debug(`Successfully pushed the file payload (${support_1.util.toReadableSizeString(fileSize)}) ` +
|
|
242
|
-
`to the remote location '${remotePath}' in ${timer.getDuration().asMilliSeconds.toFixed(0)}ms`);
|
|
243
|
-
}
|
|
244
|
-
/**
|
|
245
|
-
* @typedef {Object} PushFolderOptions
|
|
246
|
-
*
|
|
247
|
-
* @property {number} [timeoutMs=240000] The maximum timeout to wait until a
|
|
248
|
-
* single file is copied
|
|
249
|
-
* @property {boolean} [enableParallelPush=false] Whether to push files in parallel.
|
|
250
|
-
* This usually gives better performance, but might sometimes be less stable.
|
|
251
|
-
*/
|
|
252
|
-
/**
|
|
253
|
-
* Pushes a folder to a real device
|
|
254
|
-
*
|
|
255
|
-
* @param {any} afcService Apple File Client service instance from
|
|
256
|
-
* 'appium-ios-device' module
|
|
257
|
-
* @param {string} srcRootPath The full path to the source folder
|
|
258
|
-
* @param {string} dstRootPath The relative path to the destination folder. The folder
|
|
259
|
-
* will be deleted if already exists.
|
|
260
|
-
* @param {PushFolderOptions} opts
|
|
261
|
-
*/
|
|
262
|
-
async function pushFolder(afcService, srcRootPath, dstRootPath, opts = {}) {
|
|
263
|
-
const { timeoutMs = exports.IO_TIMEOUT_MS, enableParallelPush = false } = opts;
|
|
264
|
-
const timer = new support_1.timing.Timer().start();
|
|
265
|
-
const allItems = /** @type {import('path-scurry').Path[]} */ (
|
|
266
|
-
/** @type {unknown} */ (await support_1.fs.glob('**', {
|
|
267
|
-
cwd: srcRootPath,
|
|
268
|
-
withFileTypes: true,
|
|
269
|
-
})));
|
|
270
|
-
logger_1.default.debug(`Successfully scanned the tree structure of '${srcRootPath}'`);
|
|
271
|
-
// top-level folders go first
|
|
272
|
-
/** @type {string[]} */
|
|
273
|
-
const foldersToPush = allItems
|
|
274
|
-
.filter((x) => x.isDirectory())
|
|
275
|
-
.map((x) => x.relative())
|
|
276
|
-
.sort((a, b) => a.split(path_1.default.sep).length - b.split(path_1.default.sep).length);
|
|
277
|
-
// larger files go first
|
|
278
|
-
/** @type {string[]} */
|
|
279
|
-
const filesToPush = allItems
|
|
280
|
-
.filter((x) => !x.isDirectory())
|
|
281
|
-
.sort((a, b) => (b.size ?? 0) - (a.size ?? 0))
|
|
282
|
-
.map((x) => x.relative());
|
|
283
|
-
logger_1.default.debug(`Got ${support_1.util.pluralize('folder', foldersToPush.length, true)} and ` +
|
|
284
|
-
`${support_1.util.pluralize('file', filesToPush.length, true)} to push`);
|
|
285
|
-
// create the folder structure first
|
|
286
|
-
try {
|
|
287
|
-
await afcService.deleteDirectory(dstRootPath);
|
|
288
|
-
}
|
|
289
|
-
catch { }
|
|
290
|
-
await afcService.createDirectory(dstRootPath);
|
|
291
|
-
for (const relativeFolderPath of foldersToPush) {
|
|
292
|
-
// createDirectory does not accept folder names ending with a path separator
|
|
293
|
-
const absoluteFolderPath = lodash_1.default.trimEnd(path_1.default.join(dstRootPath, relativeFolderPath), path_1.default.sep);
|
|
294
|
-
if (absoluteFolderPath) {
|
|
295
|
-
await afcService.createDirectory(absoluteFolderPath);
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
// do not forget about the root folder
|
|
299
|
-
logger_1.default.debug(`Successfully created the remote folder structure ` +
|
|
300
|
-
`(${support_1.util.pluralize('item', foldersToPush.length + 1, true)})`);
|
|
301
|
-
const _pushFile = async (/** @type {string} */ relativePath) => {
|
|
302
|
-
const absoluteSourcePath = path_1.default.join(srcRootPath, relativePath);
|
|
303
|
-
const readStream = support_1.fs.createReadStream(absoluteSourcePath, { autoClose: true });
|
|
304
|
-
const absoluteDestinationPath = path_1.default.join(dstRootPath, relativePath);
|
|
305
|
-
const writeStream = await afcService.createWriteStream(absoluteDestinationPath, {
|
|
306
|
-
autoDestroy: true,
|
|
307
|
-
});
|
|
308
|
-
writeStream.on('finish', writeStream.destroy);
|
|
309
|
-
let pushError = null;
|
|
310
|
-
const filePushPromise = new bluebird_1.default((resolve, reject) => {
|
|
311
|
-
writeStream.on('close', () => {
|
|
312
|
-
if (pushError) {
|
|
313
|
-
reject(pushError);
|
|
314
|
-
}
|
|
315
|
-
else {
|
|
316
|
-
resolve();
|
|
317
|
-
}
|
|
318
|
-
});
|
|
319
|
-
const onStreamError = (e) => {
|
|
320
|
-
readStream.unpipe(writeStream);
|
|
321
|
-
logger_1.default.debug(e);
|
|
322
|
-
pushError = e;
|
|
323
|
-
};
|
|
324
|
-
writeStream.on('error', onStreamError);
|
|
325
|
-
readStream.on('error', onStreamError);
|
|
326
|
-
});
|
|
327
|
-
readStream.pipe(writeStream);
|
|
328
|
-
await filePushPromise.timeout(Math.max(timeoutMs - timer.getDuration().asMilliSeconds, 60000));
|
|
329
|
-
};
|
|
330
|
-
if (enableParallelPush) {
|
|
331
|
-
logger_1.default.debug(`Proceeding to parallel files push (max ${MAX_IO_CHUNK_SIZE} writers)`);
|
|
332
|
-
const pushPromises = [];
|
|
333
|
-
for (const relativeFilePath of filesToPush) {
|
|
334
|
-
pushPromises.push(bluebird_1.default.resolve(_pushFile(relativeFilePath)));
|
|
335
|
-
// keep the push queue filled
|
|
336
|
-
if (pushPromises.length >= MAX_IO_CHUNK_SIZE) {
|
|
337
|
-
await bluebird_1.default.any(pushPromises);
|
|
338
|
-
const elapsedMs = timer.getDuration().asMilliSeconds;
|
|
339
|
-
if (elapsedMs > timeoutMs) {
|
|
340
|
-
throw new bluebird_1.TimeoutError(`Timed out after ${elapsedMs} ms`);
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
for (let i = pushPromises.length - 1; i >= 0; i--) {
|
|
344
|
-
if (pushPromises[i].isFulfilled()) {
|
|
345
|
-
pushPromises.splice(i, 1);
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
if (!lodash_1.default.isEmpty(pushPromises)) {
|
|
350
|
-
const remainingPromises = pushPromises.filter((p) => !p.isFulfilled());
|
|
351
|
-
if (remainingPromises.length > 0) {
|
|
352
|
-
await bluebird_1.default.all(remainingPromises).timeout(Math.max(timeoutMs - timer.getDuration().asMilliSeconds, 60000));
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
else {
|
|
357
|
-
logger_1.default.debug(`Proceeding to serial files push`);
|
|
358
|
-
for (const relativeFilePath of filesToPush) {
|
|
359
|
-
await _pushFile(relativeFilePath);
|
|
360
|
-
const elapsedMs = timer.getDuration().asMilliSeconds;
|
|
361
|
-
if (elapsedMs > timeoutMs) {
|
|
362
|
-
throw new bluebird_1.TimeoutError(`Timed out after ${elapsedMs} ms`);
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
logger_1.default.debug(`Successfully pushed ${support_1.util.pluralize('folder', foldersToPush.length, true)} ` +
|
|
367
|
-
`and ${support_1.util.pluralize('file', filesToPush.length, true)} ` +
|
|
368
|
-
`within ${timer.getDuration().asMilliSeconds.toFixed(0)}ms`);
|
|
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MAAM,SAAS,CAAC,gBAAgB,CAAC,CAAC;YAClC,MAAM,SAAS,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC,cAAc,CAAC;YACrD,IAAI,SAAS,GAAG,SAAS,EAAE,CAAC;gBAC1B,MAAM,IAAI,uBAAY,CAAC,mBAAmB,SAAS,KAAK,CAAC,CAAC;YAC5D,CAAC;QACH,CAAC;IACH,CAAC;IAED,gBAAG,CAAC,KAAK,CACP,uBAAuB,cAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG;QAC5E,OAAO,cAAI,CAAC,SAAS,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG;QAC1D,UAAU,KAAK,CAAC,WAAW,EAAE,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAC9D,CAAC;AACJ,CAAC"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @typedef {Object} InstallOptions
|
|
3
|
-
*
|
|
4
|
-
* @property {boolean} [skipUninstall] Whether to skip app uninstall before installing it
|
|
5
|
-
* @property {number} [timeout=480000] App install timeout
|
|
6
|
-
* @property {boolean} [shouldEnforceUninstall] Whether to enforce the app uninstallation. e.g. fullReset, or enforceAppInstall is true
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* @this {import('./driver').XCUITestDriver}
|
|
10
|
-
* @param {string} [app] The app to the path
|
|
11
|
-
* @param {string} [bundleId] The bundle id to ensure it is already installed and uninstall it
|
|
12
|
-
* @param {InstallOptions} [opts={}]
|
|
13
|
-
*/
|
|
14
|
-
export function installToRealDevice(this: import("./driver").XCUITestDriver, app?: string, bundleId?: string, opts?: InstallOptions): Promise<void>;
|
|
15
|
-
/**
|
|
16
|
-
* @this {import('./driver').XCUITestDriver}
|
|
17
|
-
* @returns {Promise<void>}
|
|
18
|
-
*/
|
|
19
|
-
export function runRealDeviceReset(this: import("./driver").XCUITestDriver): Promise<void>;
|
|
20
|
-
/**
|
|
21
|
-
* Configures Safari startup options based on the given session capabilities.
|
|
22
|
-
*
|
|
23
|
-
* !!! This method mutates driver options.
|
|
24
|
-
*
|
|
25
|
-
* @this {import('./driver').XCUITestDriver}
|
|
26
|
-
* @return {boolean} true if process arguments have been modified
|
|
27
|
-
*/
|
|
28
|
-
export function applySafariStartupArgs(this: import("./driver").XCUITestDriver): boolean;
|
|
29
|
-
/**
|
|
30
|
-
* @this {XCUITestDriver}
|
|
31
|
-
* @returns {Promise<string>}
|
|
32
|
-
*/
|
|
33
|
-
export function detectUdid(this: import("./driver").XCUITestDriver): Promise<string>;
|
|
34
|
-
export type InstallOptions = {
|
|
35
|
-
/**
|
|
36
|
-
* Whether to skip app uninstall before installing it
|
|
37
|
-
*/
|
|
38
|
-
skipUninstall?: boolean | undefined;
|
|
39
|
-
/**
|
|
40
|
-
* App install timeout
|
|
41
|
-
*/
|
|
42
|
-
timeout?: number | undefined;
|
|
43
|
-
/**
|
|
44
|
-
* Whether to enforce the app uninstallation. e.g. fullReset, or enforceAppInstall is true
|
|
45
|
-
*/
|
|
46
|
-
shouldEnforceUninstall?: boolean | undefined;
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* }
|
|
50
|
-
*/
|
|
51
|
-
export type RealDevice = import("./real-device").RealDevice;
|
|
52
|
-
export type XCUITestDriver = import("./driver").XCUITestDriver;
|
|
53
|
-
//# sourceMappingURL=real-device-management.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"real-device-management.d.ts","sourceRoot":"","sources":["../../lib/real-device-management.js"],"names":[],"mappings":"AAMA;;;;;;GAMG;AAEH;;;;;GAKG;AACH,mFAJW,MAAM,aACN,MAAM,SACN,cAAc,iBAkDxB;AAED;;;GAGG;AACH,6EAFa,OAAO,CAAC,IAAI,CAAC,CAWzB;AAED;;;;;;;GAOG;AACH,iFAFY,OAAO,CAiBlB;AAED;;;GAGG;AACH,qEAFa,OAAO,CAAC,MAAM,CAAC,CAe3B;;;;;;;;;;;;;;;;;;yBAGY,OAAO,eAAe,EAAE,UAAU;6BAClC,OAAO,UAAU,EAAE,cAAc"}
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.installToRealDevice = installToRealDevice;
|
|
7
|
-
exports.runRealDeviceReset = runRealDeviceReset;
|
|
8
|
-
exports.applySafariStartupArgs = applySafariStartupArgs;
|
|
9
|
-
exports.detectUdid = detectUdid;
|
|
10
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
11
|
-
const app_utils_1 = require("./app-utils");
|
|
12
|
-
const real_device_1 = require("./real-device");
|
|
13
|
-
const DEFAULT_APP_INSTALLATION_TIMEOUT_MS = 8 * 60 * 1000;
|
|
14
|
-
/**
|
|
15
|
-
* @typedef {Object} InstallOptions
|
|
16
|
-
*
|
|
17
|
-
* @property {boolean} [skipUninstall] Whether to skip app uninstall before installing it
|
|
18
|
-
* @property {number} [timeout=480000] App install timeout
|
|
19
|
-
* @property {boolean} [shouldEnforceUninstall] Whether to enforce the app uninstallation. e.g. fullReset, or enforceAppInstall is true
|
|
20
|
-
*/
|
|
21
|
-
/**
|
|
22
|
-
* @this {import('./driver').XCUITestDriver}
|
|
23
|
-
* @param {string} [app] The app to the path
|
|
24
|
-
* @param {string} [bundleId] The bundle id to ensure it is already installed and uninstall it
|
|
25
|
-
* @param {InstallOptions} [opts={}]
|
|
26
|
-
*/
|
|
27
|
-
async function installToRealDevice(app, bundleId, opts = {}) {
|
|
28
|
-
const device = /** @type {RealDevice} */ (this.device);
|
|
29
|
-
if (!device.udid || !app || !bundleId) {
|
|
30
|
-
this.log.debug('No device id, app or bundle id, not installing to real device.');
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
const { skipUninstall, timeout = DEFAULT_APP_INSTALLATION_TIMEOUT_MS, } = opts;
|
|
34
|
-
if (!skipUninstall) {
|
|
35
|
-
this.log.info(`Reset requested. Removing app with id '${bundleId}' from the device`);
|
|
36
|
-
await device.remove(bundleId);
|
|
37
|
-
}
|
|
38
|
-
this.log.debug(`Installing '${app}' on the device with UUID '${device.udid}'`);
|
|
39
|
-
try {
|
|
40
|
-
await device.install(app, bundleId, {
|
|
41
|
-
timeoutMs: timeout,
|
|
42
|
-
});
|
|
43
|
-
this.log.debug('The app has been installed successfully.');
|
|
44
|
-
}
|
|
45
|
-
catch (e) {
|
|
46
|
-
// Want to clarify the device's application installation state in this situation.
|
|
47
|
-
if (!skipUninstall || !e.message.includes('MismatchedApplicationIdentifierEntitlement')) {
|
|
48
|
-
// Other error cases that could not be recoverable by here.
|
|
49
|
-
// Exact error will be in the log.
|
|
50
|
-
// We cannot recover 'ApplicationVerificationFailed' situation since this reason is clearly the app's provisioning profile was invalid.
|
|
51
|
-
// [XCUITest] Error installing app '/path/to.app': Unexpected data: {"Error":"ApplicationVerificationFailed","ErrorDetail":-402620395,"ErrorDescription":"Failed to verify code signature of /path/to.app : 0xe8008015 (A valid provisioning profile for this executable was not found.)"}
|
|
52
|
-
throw e;
|
|
53
|
-
}
|
|
54
|
-
// If the error was by below error case, we could recover the situation
|
|
55
|
-
// by uninstalling the device's app bundle id explicitly regard less the app exists on the device or not (e.g. offload app).
|
|
56
|
-
// [XCUITest] Error installing app '/path/to.app': Unexpected data: {"Error":"MismatchedApplicationIdentifierEntitlement","ErrorDescription":"Upgrade's application-identifier entitlement string (TEAM_ID.com.kazucocoa.example) does not match installed application's application-identifier string (ANOTHER_TEAM_ID.com.kazucocoa.example); rejecting upgrade."}
|
|
57
|
-
this.log.info(`The application identified by '${bundleId}' cannot be installed because it might ` +
|
|
58
|
-
`be already cached on the device, probably with a different signature. ` +
|
|
59
|
-
`Will try to remove it and install a new copy. Original error: ${e.message}`);
|
|
60
|
-
await device.remove(bundleId);
|
|
61
|
-
await device.install(app, bundleId, {
|
|
62
|
-
timeoutMs: timeout,
|
|
63
|
-
});
|
|
64
|
-
this.log.debug('The app has been installed after one retrial.');
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* @this {import('./driver').XCUITestDriver}
|
|
69
|
-
* @returns {Promise<void>}
|
|
70
|
-
*/
|
|
71
|
-
async function runRealDeviceReset() {
|
|
72
|
-
if (!this.opts.noReset || this.opts.fullReset) {
|
|
73
|
-
this.log.debug('Reset: running ios real device reset flow');
|
|
74
|
-
if (!this.opts.noReset) {
|
|
75
|
-
await /** @type {RealDevice} */ (this.device).reset(this.opts);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
this.log.debug('Reset: fullReset not set. Leaving as is');
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Configures Safari startup options based on the given session capabilities.
|
|
84
|
-
*
|
|
85
|
-
* !!! This method mutates driver options.
|
|
86
|
-
*
|
|
87
|
-
* @this {import('./driver').XCUITestDriver}
|
|
88
|
-
* @return {boolean} true if process arguments have been modified
|
|
89
|
-
*/
|
|
90
|
-
function applySafariStartupArgs() {
|
|
91
|
-
const prefs = (0, app_utils_1.buildSafariPreferences)(this.opts);
|
|
92
|
-
if (lodash_1.default.isEmpty(prefs)) {
|
|
93
|
-
return false;
|
|
94
|
-
}
|
|
95
|
-
const args = lodash_1.default.toPairs(prefs)
|
|
96
|
-
.flatMap(([key, value]) => [lodash_1.default.startsWith(key, '-') ? key : `-${key}`, String(value)]);
|
|
97
|
-
this.log.debug(`Generated Safari command line arguments: ${args.join(' ')}`);
|
|
98
|
-
if (lodash_1.default.isPlainObject(this.opts.processArguments)) {
|
|
99
|
-
this.opts.processArguments.args = [...(this.opts.processArguments.args ?? []), ...args];
|
|
100
|
-
}
|
|
101
|
-
else {
|
|
102
|
-
this.opts.processArguments = { args };
|
|
103
|
-
}
|
|
104
|
-
return true;
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* @this {XCUITestDriver}
|
|
108
|
-
* @returns {Promise<string>}
|
|
109
|
-
*/
|
|
110
|
-
async function detectUdid() {
|
|
111
|
-
this.log.debug('Auto-detecting real device udid...');
|
|
112
|
-
const udids = await (0, real_device_1.getConnectedDevices)();
|
|
113
|
-
if (lodash_1.default.isEmpty(udids)) {
|
|
114
|
-
throw new Error('No real devices are connected to the host');
|
|
115
|
-
}
|
|
116
|
-
const udid = udids[udids.length - 1];
|
|
117
|
-
if (udids.length > 1) {
|
|
118
|
-
this.log.info(`Multiple devices found: ${udids.join(', ')}`);
|
|
119
|
-
this.log.info(`Choosing '${udid}'. Consider settings the 'udid' capability if another device must be selected`);
|
|
120
|
-
}
|
|
121
|
-
this.log.debug(`Detected real device udid: '${udid}'`);
|
|
122
|
-
return udid;
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* @typedef {import('./real-device').RealDevice} RealDevice}
|
|
126
|
-
* @typedef {import('./driver').XCUITestDriver} XCUITestDriver
|
|
127
|
-
*/
|
|
128
|
-
//# sourceMappingURL=real-device-management.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"real-device-management.js","sourceRoot":"","sources":["../../lib/real-device-management.js"],"names":[],"mappings":";;;;;AAoBA,kDAgDC;AAMD,gDASC;AAUD,wDAeC;AAMD,gCAaC;AA/HD,oDAAuB;AACvB,2CAAmD;AACnD,+CAAoD;AAEpD,MAAM,mCAAmC,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AAE1D;;;;;;GAMG;AAEH;;;;;GAKG;AACI,KAAK,UAAU,mBAAmB,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,GAAG,EAAE;IAChE,MAAM,MAAM,GAAG,yBAAyB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAEvD,IAAI,CAAC,M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