Skip to content

Commit

Permalink
fix unlock
Browse files Browse the repository at this point in the history
  • Loading branch information
xudafeng committed Sep 27, 2016
1 parent 9e77079 commit 036bfdb
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
.DS_Store
node_modules
npm-debug.log
*.sw*
*.un~
.idea/*
Thumbs.db
coverage/
logs/
.project
build/
*.sw*
*.un~
2 changes: 1 addition & 1 deletion .jshintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ node_modules/
coverage/
build/
assets/
dist/
dist/
4 changes: 4 additions & 0 deletions lib/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,4 +207,8 @@ controllers.getSource = function *() {
return xml.length > xml_hack.length ? xml : xml_hack;
};

controllers.isDisplayed = function *() {
return true;
};

module.exports = controllers;
1 change: 0 additions & 1 deletion lib/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const getErrorByCode = require('webdriver-dfn-error-code').getErrorByCode;

var _ = macacaUtils.merge({}, macacaUtils);


_.sleep = function(ms) {
return new Promise((resolve, reject) => {
setTimeout(resolve, ms);
Expand Down
6 changes: 5 additions & 1 deletion lib/macaca-android.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ Android.prototype.startDevice = function *(caps) {
yield this.initDevice();
yield this.initUiautomator();
yield this.getApkInfo();
yield this.adb.install(UnlockApk.apkPath);
yield this.unlock();
yield this.setIME();
yield this.launchApk();
Expand Down Expand Up @@ -189,6 +188,11 @@ Android.prototype.getApkInfo = function *() {
};

Android.prototype.unlock = function *() {
if (!_.isExistedFile(UnlockApk.apkPath)) {
logger.warn(`unlock apk not found in: ${UnlockApk.apkPath}`);
return;
}
yield this.adb.install(UnlockApk.apkPath);
var isScreenLocked = yield this.adb.isScreenLocked();

if (isScreenLocked) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "macaca-android",
"version": "1.0.30",
"version": "1.0.32",
"description": "Macaca Android driver",
"keywords": [
"android"
Expand Down

0 comments on commit 036bfdb

Please sign in to comment.