appium-instruments
Advanced tools
Comparing version 0.1.19 to 0.1.20
@@ -420,3 +420,20 @@ // Wrapper around Apple's Instruments app | ||
Instruments.prototype.getAvailableDevices = function (cb) { | ||
logger.info("Getting list of devices instruments supports"); | ||
this.setInstrumentsPath(function (err) { | ||
if (err) return cb(err); | ||
exec(this.instrumentsPath + " -s devices", function (err, stdout) { | ||
if (err) return cb(err); | ||
var devices = []; | ||
_.each(stdout.split("\n"), function (line) { | ||
if (/^i.+$/.test(line)) { | ||
devices.push(line); | ||
} | ||
}); | ||
cb(null, devices); | ||
}); | ||
}.bind(this)); | ||
}; | ||
/* COMMAND LIFECYCLE */ | ||
@@ -423,0 +440,0 @@ |
{ | ||
"name": "appium-instruments", | ||
"version": "0.1.19", | ||
"version": "0.1.20", | ||
"description": "IOS Instruments + instruments-without-delay launcher used by Appium", | ||
@@ -5,0 +5,0 @@ "main": "lib/main.js", |
@@ -7,2 +7,3 @@ 'use strict'; | ||
path = require('path'), | ||
exec = require('child_process').exec, | ||
Instruments = require('../../lib/main').Instruments; | ||
@@ -26,3 +27,3 @@ | ||
}); | ||
function newInstrument(timeout) { | ||
@@ -71,3 +72,30 @@ return new Instruments({ | ||
// works only on 7.1 | ||
describe("getting devices", function () { | ||
it('should get all available devices', function (done) { | ||
exec('xcrun --sdk iphonesimulator --show-sdk-version', function (err, stdout) { | ||
var onErr = function () { | ||
console.error("Couldn't get iOS sdk version, skipping test"); | ||
done(); | ||
}; | ||
if (err) return onErr(); | ||
var iosVer = parseFloat(stdout); | ||
if (typeof iosVer !== "number" || isNaN(iosVer)) { | ||
return onErr(); | ||
} | ||
instruments = newInstrument(60000); | ||
instruments.getAvailableDevices(function (err, devices) { | ||
should.not.exist(err); | ||
if (iosVer >= 7.1) { | ||
devices.length.should.equal(7); | ||
devices.should.contain("iPhone - Simulator - iOS 7.1"); | ||
} else { | ||
devices.length.should.equal(0); | ||
} | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
657322
64
749
18