In one of my Android tests I need to force close the app (on my real device I do it by performing a swipe-close on the app switcher screen). For that I need to close the app without finishing the driver session.
I have tried the following options:
-
driver.terminateApp(com.csg.securechat);
, and got this error:Original error: 'com.csg.securechat' is still running after 500ms timeout
driver.closeApp(); Activity activity = new Activity(com.csg.securechat', com.csg.csg4.modules.splash.CsgStartupActivity); androidDriver.startActivity(activity);
On this second try, it does close the app, it opens again, but the following appears on the appium log:
[debug] [ADB] Found package: 'com.csg.securechat' and fully qualified activity name : 'com.csg.csg4.modules.home.CsgHomeActivity' [debug] [ADB] Incorrect package and activity. Retrying.
This message repeats untill the following error appears:
Error: Cannot start the 'com.csg.securechat' application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting. Original error: 'com.csg.csg4.modules.splash.CsgStartupActivity' or 'com.csg.securechat.com.csg.csg4.modules.splash.CsgStartupActivity' never started
Note: if I try to set com.csg.csg4.modules.home.CsgHomeActivity
as the app activity, the app doesn’t even open.
Am I going to the right place, or there’s a better way?