leancodepl / patrol

Flutter-first UI testing framework. Ready for action!
https://patrol.leancode.co
Apache License 2.0
883 stars 133 forks source link

Possibility to add a test that closes and opens application #1374

Open Kendru98 opened 1 year ago

Kendru98 commented 1 year ago

Description: Imagine that I want to test for example local storage of the app, and I want to be sure that my settings are remembered when I close and open app Example case:

  1. Open app
  2. Change language of the app
  3. Close App (for example native.pressRecentApps() and swipe up)
  4. Open App
  5. Check language
bartekpacia commented 1 year ago

This is an interesting use case.

The problem with it is that currently, it's impossible. That's because Flutter tests run inside the app, so if the app dies, the tests also die.


It'd be very cool to accomplish this use case, though.

In Patrol 2.0, native tests are already run from the instrumentation process, which is separate from the app. But what these native tests then do is gRPC communication with the app process to execute Dart tests (which run in the app process). So again, if the app process dies, game over.

But what if we could move execution of Dart tests to the instrumentation process?


I'm just thinking out loud.

Of course, there are many problems with that, mainly that the whole flutter_test API is built to work-in-process with the app under test. Essentially, this would probably result in flutter_driver-like approach (and problems).

tenhobi commented 12 months ago

We would also want to do these types of tests to for example test whether one-time profiles are not present in the second app run, etc.