Skip to content

Commit 7d9cccd

Browse files
committed
Honor reset without the app capability
Fixes appium#157
1 parent 53fa62e commit 7d9cccd

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

lib/driver.js

+10-4
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ class AndroidDriver extends BaseDriver {
171171
// unlock the device
172172
await helpers.unlock(this.adb);
173173
// If the user sets autoLaunch to false, they are responsible for initAUT() and startAUT()
174-
if (!this.appOnDevice && this.opts.autoLaunch) {
174+
if (this.opts.autoLaunch) {
175175
// set up app under test
176176
await this.initAUT();
177177
}
@@ -225,14 +225,20 @@ class AndroidDriver extends BaseDriver {
225225
let launchInfo = await helpers.getLaunchInfo(this.adb, this.opts);
226226
Object.assign(this.opts, launchInfo);
227227
Object.assign(this.caps, launchInfo);
228-
if (!this.opts.skipUninstall) {
229-
await this.adb.uninstallApk(this.opts.appPackage);
230-
}
231228
// install app
232229
if (!this.opts.app) {
230+
if (this.opts.fullReset) {
231+
log.errorAndThrow('Full reset requires an app capability, use fastReset if app is not provided');
232+
}
233233
log.debug('No app capability. Assuming it is already on the device');
234+
if (this.opts.fastReset) {
235+
await helpers.resetApp(this.adb, this.opts.app, this.opts.appPackage, this.opts.fastReset);
236+
}
234237
return;
235238
}
239+
if (!this.opts.skipUninstall) {
240+
await this.adb.uninstallApk(this.opts.appPackage);
241+
}
236242
await helpers.installApkRemotely(this.adb, this.opts.app, this.opts.appPackage, this.opts.fastReset);
237243
this.apkStrings[this.opts.language] = await helpers.pushStrings(
238244
this.opts.language, this.adb, this.opts);

0 commit comments

Comments
 (0)