Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function quickLaunch (udid, appPath = path.resolve(__dirname, '..', '..', 'assets', 'TestApp.app')) {
let traceTemplatePath = await xcode.getAutomationTraceTemplatePath();
let scriptPath = path.resolve(__dirname, '..', '..', 'assets', 'blank_instruments_test.js');
let traceDocument = path.resolve('/', 'tmp', 'testTrace.trace');
let resultsPath = path.resolve('/', 'tmp');
// the trace document can be in a weird state
// but we never do anything with it, so delete
await fs.rimraf(traceDocument);
let args = ['instruments',
'-D', traceDocument,
'-t', traceTemplatePath,
'-w', udid,
appPath,
'-e', 'UIASCRIPT', scriptPath,
'-e', 'UIARESULTSPATH', resultsPath];
log.debug(`Running command: 'xcrun ${args.join(' ')}'`);
async function quickLaunch (udid, appPath = path.resolve(__dirname, '..', '..', 'assets', 'TestApp.app')) {
let traceTemplatePath = await xcode.getAutomationTraceTemplatePath();
let scriptPath = path.resolve(__dirname, '..', '..', 'assets', 'blank_instruments_test.js');
let traceDocument = path.resolve('/', 'tmp', 'testTrace.trace');
let resultsPath = path.resolve('/', 'tmp');
// the trace document can be in a weird state
// but we never do anything with it, so delete
await fs.rimraf(traceDocument);
let args = [
'instruments',
'-D', traceDocument,
'-t', traceTemplatePath,
'-w', udid,
appPath,
'-e', 'UIASCRIPT', scriptPath,
'-e', 'UIARESULTSPATH', resultsPath];
async configure () {
if (!this.xcodeVersion) {
this.xcodeVersion = await xcode.getVersion(true);
}
if (this.xcodeVersion.versionFloat === 6.0 && this.withoutDelay) {
log.info('In xcode 6.0, instruments-without-delay does not work. ' +
'If using Appium, you can disable instruments-without-delay ' +
'with the --native-instruments-lib server flag');
}
if (this.xcodeVersion.versionString === '5.0.1') {
throw new Error('Xcode 5.0.1 ships with a broken version of ' +
'Instruments. please upgrade to 5.0.2');
}
if (!this.template) {
this.template = await xcode.getAutomationTraceTemplatePath();
}
if (!this.instrumentsPath) {
this.instrumentsPath = await getInstrumentsPath();
}
}
async function quickInstruments (opts = {}) {
opts = _.cloneDeep(opts);
let xcodeTraceTemplatePath = opts.xcodeTraceTemplatePath ||
await xcode.getAutomationTraceTemplatePath();
_.defaults(opts, {
launchTimeout: 60000,
template: xcodeTraceTemplatePath,
withoutDelay: true,
xcodeVersion: '8.1',
webSocket: null,
flakeyRetries: true,
logNoColors: false,
});
return new Instruments(opts);
}
log.info('In xcode 6.0, instruments-without-delay does not work. ' +
'If using Appium, you can disable instruments-without-delay ' +
'with the --native-instruments-lib server flag');
}
if (this.xcodeVersion.versionString === '5.0.1') {
throw new Error('Xcode 5.0.1 ships with a broken version of ' +
'Instruments. please upgrade to 5.0.2');
}
if (this.xcodeVersion.major > 7) {
throw new Error(`Instruments-based automation was removed in Xcode 8. ` +
`Xcode ${this.xcodeVersion.versionString} is not supported. ` +
`Please try the XCUItest driver.`);
}
if (!this.template) {
this.template = await xcode.getAutomationTraceTemplatePath();
}
if (!this.instrumentsPath) {
this.instrumentsPath = await getInstrumentsPath();
}
}
static async quickInstruments (opts) {
opts = _.clone(opts);
let xcodeTraceTemplatePath = await xcode.getAutomationTraceTemplatePath();
_.defaults(opts, {
launchTimeout: 60000,
template: xcodeTraceTemplatePath,
withoutDelay: true,
xcodeVersion: '8.1',
webSocket: null,
flakeyRetries: 2
});
return new Instruments(opts);
}
static async quickInstruments (opts) {
opts = _.clone(opts);
let xcodeTraceTemplatePath = await xcode.getAutomationTraceTemplatePath();
_.defaults(opts, {
launchTimeout: 60000,
template: xcodeTraceTemplatePath,
withoutDelay: true,
xcodeVersion: '8.1',
webSocket: null,
flakeyRetries: 2
});
return new Instruments(opts);
}
async function quickInstruments (opts = {}) {
opts = _.cloneDeep(opts);
let xcodeTraceTemplatePath = opts.xcodeTraceTemplatePath ||
await xcode.getAutomationTraceTemplatePath();
_.defaults(opts, {
launchTimeout: 60000,
template: xcodeTraceTemplatePath,
withoutDelay: true,
xcodeVersion: '8.1',
webSocket: null,
flakeyRetries: true,
logNoColors: false,
});
return new Instruments(opts);
}