Skip to content

Commit

Permalink
Merge pull request #44 from sravanmedarapu/master
Browse files Browse the repository at this point in the history
Added FULL_RESET check and refactored app installation
  • Loading branch information
sravanmedarapu authored Oct 26, 2016
2 parents e20c132 + 30b8238 commit 9a12452
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,19 +267,20 @@ class AndroidUiautomator2Driver extends BaseDriver {
if (this.opts.fastReset) {
await helpers.resetApp(this.adb, this.opts.app, this.opts.appPackage, this.opts.fastReset);
}
return;
}

if (!this.opts.skipUninstall) {
await this.adb.uninstallApk(this.opts.appPackage);
}
if (!this.opts.noSign) {
let signed = await this.adb.checkApkCert(this.opts.app, this.opts.appPackage);
if (!signed) {
if (!signed && this.opts.app) {
await this.adb.sign(this.opts.app, this.opts.appPackage);
}
}
await helpers.installApkRemotely(this.adb, this.opts);
if (this.opts.app) {
await helpers.installApkRemotely(this.adb, this.opts);
}
await this.uiautomator2.installServerApk();
}

Expand Down Expand Up @@ -325,6 +326,10 @@ class AndroidUiautomator2Driver extends BaseDriver {
if (this.opts.appPackage) {
await this.adb.forceStop(this.opts.appPackage);
}
if (this.opts.fullReset && !this.opts.skipUninstall && !this.appOnDevice) {
logger.debug(`FULL_RESET set to 'true', Uninstalling '${this.opts.appPackage}'`);
await this.adb.uninstallApk(this.opts.appPackage);
}
await this.adb.stopLogcat();
}
await super.deleteSession();
Expand Down

0 comments on commit 9a12452

Please sign in to comment.