File tree 3 files changed +21
-1
lines changed
3 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -345,6 +345,19 @@ export async function background(seconds) {
345
345
return await this . adb . startApp ( args ) ;
346
346
}
347
347
348
+ /**
349
+ * Puts the app to background and waits the given number of seconds then restores the app
350
+ * if necessary. The call is blocking.
351
+ *
352
+ * @this {AndroidDriver}
353
+ * @param {number } [seconds=-1] The amount of seconds to wait between putting the app to background and restoring it.
354
+ * Any negative value means to not restore the app after putting it to background.
355
+ * @returns {Promise<void> }
356
+ */
357
+ export async function mobileBackgroundApp ( seconds = - 1 ) {
358
+ await this . background ( seconds ) ;
359
+ }
360
+
348
361
/**
349
362
* @this {AndroidDriver}
350
363
* @param {import('../driver').AndroidDriverOpts? } [opts=null]
Original file line number Diff line number Diff line change @@ -71,6 +71,7 @@ import {
71
71
installAUT ,
72
72
resetAUT ,
73
73
background ,
74
+ mobileBackgroundApp ,
74
75
getCurrentActivity ,
75
76
getCurrentPackage ,
76
77
mobileClearApp ,
@@ -413,6 +414,7 @@ class AndroidDriver
413
414
activateApp = activateApp ;
414
415
queryAppState = queryAppState ;
415
416
isAppInstalled = isAppInstalled ;
417
+ mobileBackgroundApp = mobileBackgroundApp ;
416
418
417
419
mobileGetUiMode = mobileGetUiMode ;
418
420
mobileSetUiMode = mobileSetUiMode ;
Original file line number Diff line number Diff line change @@ -174,7 +174,12 @@ export const executeMethodMap = {
174
174
required : [ 'appId' ] ,
175
175
} ,
176
176
} ,
177
-
177
+ 'mobile: backgroundApp' : {
178
+ command : 'mobileBackgroundApp' ,
179
+ params : {
180
+ optional : [ 'seconds' ] ,
181
+ }
182
+ } ,
178
183
'mobile: startService' : {
179
184
command : 'mobileStartService' ,
180
185
params : {
You can’t perform that action at this time.
0 commit comments