@@ -171,7 +171,7 @@ class AndroidDriver extends BaseDriver {
171
171
// unlock the device
172
172
await helpers . unlock ( this . adb ) ;
173
173
// 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 ) {
175
175
// set up app under test
176
176
await this . initAUT ( ) ;
177
177
}
@@ -225,14 +225,20 @@ class AndroidDriver extends BaseDriver {
225
225
let launchInfo = await helpers . getLaunchInfo ( this . adb , this . opts ) ;
226
226
Object . assign ( this . opts , launchInfo ) ;
227
227
Object . assign ( this . caps , launchInfo ) ;
228
- if ( ! this . opts . skipUninstall ) {
229
- await this . adb . uninstallApk ( this . opts . appPackage ) ;
230
- }
231
228
// install app
232
229
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
+ }
233
233
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
+ }
234
237
return ;
235
238
}
239
+ if ( ! this . opts . skipUninstall ) {
240
+ await this . adb . uninstallApk ( this . opts . appPackage ) ;
241
+ }
236
242
await helpers . installApkRemotely ( this . adb , this . opts . app , this . opts . appPackage , this . opts . fastReset ) ;
237
243
this . apkStrings [ this . opts . language ] = await helpers . pushStrings (
238
244
this . opts . language , this . adb , this . opts ) ;
0 commit comments