support genymotion emulator
This commit is contained in:
+13
-4
@@ -2,6 +2,7 @@ const {exec} = require("child_process");
|
||||
|
||||
// DEVICE_REGEX = "(^[a-z0-9A-Z]*) .* model:([a-z0-9A-Z_]+)"
|
||||
DEVICE_REGEX = "(^[a-z0-9A-Z-.:]*) .* model:([a-z0-9A-Z_]+)"
|
||||
|
||||
// DEVICE_REGEX = "(^[a-z0-9A-Z-]*) .* model:([a-z0-9A-Z_]+)"
|
||||
|
||||
|
||||
@@ -26,10 +27,11 @@ async function devices() {
|
||||
const o = currentLine.split('\t')
|
||||
findResult = currentLine.match(DEVICE_REGEX)
|
||||
console.log(findResult)
|
||||
try{
|
||||
result.push(new AndroidDevice(findResult[1], findResult[2]));}
|
||||
catch(e){
|
||||
console.log(e)}
|
||||
try {
|
||||
result.push(new AndroidDevice(findResult[1], findResult[2]));
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
console.log(result[i])
|
||||
}
|
||||
}
|
||||
@@ -60,6 +62,13 @@ class AndroidDevice {
|
||||
}
|
||||
}
|
||||
|
||||
async clearApp(packageName) {
|
||||
let cmd = `adb -s ${this.serial} shell pm clear ${packageName}`
|
||||
console.log("cmd is " + cmd)
|
||||
await exec(cmd);
|
||||
}
|
||||
|
||||
|
||||
shell(cmd) {
|
||||
return new Promise((resolve, reject) => {
|
||||
exec("adb -s " + this.serial + " shell " + cmd, (error, stdout, stderr) => {
|
||||
|
||||
Reference in New Issue
Block a user