Full close app (no app in background, or paused state in android)
jttuboi opened this issue · 1 comments
Use case
I need a test which simulates run again the loading of the app in the same tests.
To do this in manual test, I close the app (ex: clicking in home button), click in overview button (or recent apps button), swipe to up to close the app in background, and open the app again.
I did this using patrol:
patrolTest('close app in background', ($) async {
await app.main();
await $.pumpAndSettle();
await $.native.pressHome();
await $.native.pressRecentApps();
await $.native.swipe(from: const Offset(0.5, 0.5), to: const Offset(0.5, 0));
// ... open app and check loading
});
Proposal
Continuing...
And oks for me. But it's good to have a function to do this like as $.native.closeNotifications()
to simplify this feature. In android, I know some versions you need to swipe up, but it has old ones you need swipe right, so my tests would break because of this. Of course I will not use an emulator which needs swipe right, this is only a motivation to have an official close app in background method.
Maybe a good name for this method is $.native.closeAppInBackground()
, and instead do these steps, only force close (if it is possible, I didn't check if automator can do this).
patrolTest('close app in background', ($) async {
await app.main();
await $.pumpAndSettle();
await $.native.closeAppInBackground();
// ... open app and check loading
});
This is impossible to do with Patrol's current architecture. See #1374 for more details.