appium-instruments
Advanced tools
Comparing version 1.2.3 to 1.3.0
@@ -66,2 +66,3 @@ // Wrapper around Apple's Instruments app | ||
this.simulatorSdkAndDevice = opts.simulatorSdkAndDevice; | ||
this.tmpDir = opts.tmpDir || '/tmp/appium-instruments'; | ||
}; | ||
@@ -179,3 +180,3 @@ | ||
if (err) return cb(err); | ||
var diedTooYoung = this.spawnInstruments("/tmp"); | ||
var diedTooYoung = this.spawnInstruments(); | ||
diedTooYoung.on("error", function (err) { | ||
@@ -212,6 +213,5 @@ if (err.message.indexOf("ENOENT") !== -1) { | ||
// prepare temp dir | ||
var tmpDir = "/tmp/appium-instruments"; | ||
try { | ||
rimraf.sync(tmpDir); | ||
mkdirp.sync(tmpDir); | ||
rimraf.sync(this.tmpDir); | ||
mkdirp.sync(this.tmpDir); | ||
} catch (err) { | ||
@@ -223,3 +223,3 @@ return cb(err); | ||
this.proc = this.spawnInstruments(tmpDir); | ||
this.proc = this.spawnInstruments(); | ||
this.proc.on("error", function (err) { | ||
@@ -253,3 +253,3 @@ logger.error("Error with instruments proc: " + err.message); | ||
Instruments.prototype.spawnInstruments = function (tmpDir) { | ||
Instruments.prototype.spawnInstruments = function () { | ||
var args = ["-t", this.template]; | ||
@@ -270,3 +270,3 @@ if (this.udid) { | ||
args = args.concat(["-e", "UIASCRIPT", this.bootstrap]); | ||
args = args.concat(["-e", "UIARESULTSPATH", tmpDir]); | ||
args = args.concat(["-e", "UIARESULTSPATH", this.tmpDir]); | ||
var env = _.clone(process.env); | ||
@@ -273,0 +273,0 @@ var thirdpartyPath = path.resolve(__dirname, "../thirdparty"); |
@@ -36,23 +36,20 @@ 'use strict'; | ||
exports.quickInstrument = function (opts) { | ||
opts = _.clone(opts); | ||
if (opts.logger) { | ||
logger.init(opts.logger); | ||
} | ||
opts = _.clone(opts); | ||
_.defaults(opts, { | ||
launchTimeout: 60000 | ||
}); | ||
delete opts.logger; | ||
return getXcodeTraceTemplatePath() | ||
.then(function (xcodeTraceTemplatePath) { | ||
return new Instruments({ | ||
app: opts.app, | ||
bootstrap: opts.bootstrap, | ||
template: xcodeTraceTemplatePath, | ||
withoutDelay: true, | ||
xcodeVersion: '5.1', | ||
webSocket: null, | ||
launchTimeout: opts.launchTimeout, | ||
flakeyRetries: true, | ||
logNoColors: false, | ||
_.defaults(opts, { | ||
launchTimeout: 60000, | ||
template: xcodeTraceTemplatePath, | ||
withoutDelay: true, | ||
xcodeVersion: '5.1', | ||
webSocket: null, | ||
flakeyRetries: true, | ||
logNoColors: false, | ||
}); | ||
return new Instruments(opts); | ||
}); | ||
}; |
{ | ||
"name": "appium-instruments", | ||
"version": "1.2.3", | ||
"version": "1.3.0", | ||
"description": "IOS Instruments + instruments-without-delay launcher used by Appium", | ||
@@ -5,0 +5,0 @@ "main": "lib/main.js", |
@@ -7,3 +7,6 @@ 'use strict'; | ||
exec = require('child_process').exec, | ||
path = require('path'); | ||
path = require('path'), | ||
_ =require('underscore'), | ||
rimraf = require('rimraf'), | ||
fs = require('fs'); | ||
@@ -23,39 +26,67 @@ describe('intruments tests', function () { | ||
function newInstrument(launchTimeout) { | ||
return utils.quickInstrument({ | ||
function newInstrument(opts) { | ||
_.extend(opts, { | ||
app: path.resolve(__dirname, '../assets/TestApp.app'), | ||
bootstrap: path.resolve(__dirname, '../assets/bootstrap.js'), | ||
launchTimeout: launchTimeout | ||
}); | ||
return utils.quickInstrument(opts); | ||
} | ||
function test(desc, timeout) { | ||
describe(desc, function () { | ||
it('should start', function (done) { | ||
newInstrument(timeout).then(function (_instruments) { | ||
instruments = _instruments; | ||
setTimeout(function () { | ||
instruments.launchHandler(); | ||
}, 5000); | ||
instruments.start(function (err) { | ||
should.not.exist(err); | ||
}); | ||
}).done(); | ||
function test(opts) { | ||
it('should start', function (done) { | ||
newInstrument(opts).then(function (_instruments) { | ||
instruments = _instruments; | ||
setTimeout(function () { | ||
instruments.didLaunch.should.be.ok; | ||
done(); | ||
},20000); | ||
}); | ||
it('should shutdown', function (done) { | ||
instruments.shutdown(done); | ||
}); | ||
instruments.launchHandler(); | ||
}, 5000); | ||
instruments.start(function (err) { | ||
should.not.exist(err); | ||
}); | ||
}).done(); | ||
setTimeout(function () { | ||
instruments.didLaunch.should.be.ok; | ||
done(); | ||
},20000); | ||
}); | ||
it('should shutdown', function (done) { | ||
instruments.shutdown(done); | ||
}); | ||
} | ||
test('regular timeout', 60000); | ||
//test('smart timeout', {global: 60000, afterSimLaunch: 10000}); | ||
describe('regular timeout', function () { | ||
test({launchTimeout: 60000}); | ||
}); | ||
describe('smart timeout', function () { | ||
test({launchTimeout: {global: 60000, afterSimLaunch: 10000}}); | ||
}); | ||
describe("using different tmp dir", function () { | ||
it('should start', function (done) { | ||
var altTmpDir = '/tmp/abcd'; | ||
rimraf.sync(altTmpDir); | ||
newInstrument({launchTimeout: 60000, tmpDir: altTmpDir}).then(function (_instruments) { | ||
instruments = _instruments; | ||
instruments.tmpDir.should.equal(altTmpDir); | ||
setTimeout(function () { | ||
instruments.launchHandler(); | ||
}, 5000); | ||
instruments.start(function (err) { | ||
should.not.exist(err); | ||
fs.exists('/tmp/abcd').should.be.ok; | ||
}); | ||
}).done(); | ||
setTimeout(function () { | ||
instruments.didLaunch.should.be.ok; | ||
done(); | ||
},20000); | ||
}); | ||
it('should shutdown', function (done) { | ||
instruments.shutdown(done); | ||
}); | ||
}); | ||
describe("shutdown without startup", function () { | ||
it('should start', function (done) { | ||
newInstrument(60000).then(function (_instruments) { | ||
newInstrument({launchTimeout: 60000}).then(function (_instruments) { | ||
instruments = _instruments; | ||
@@ -84,3 +115,3 @@ instruments.shutdown(function (err) { | ||
} | ||
newInstrument(60000).then(function (_instruments) { | ||
newInstrument({launchTimeout: 60000}).then(function (_instruments) { | ||
instruments = _instruments; | ||
@@ -87,0 +118,0 @@ instruments.getAvailableDevices(function (err, devices) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
616061
704
3