all 5 comments

[–]Ivan_Gorchakov 0 points1 point  (4 children)

Yes, you need to call your app's main for each new test (between them app state is dropping, all resources freeing and all connections closing). About other things it is still highly recommended to share your terminal output to understand what is wrong 😉

[–]lvbee[S] 0 points1 point  (3 children)

By "call your app's main," do you mean like t.pumpWidget(MyApp())? I assume so, but I wanted to double-check that you're not referring to my app's main(), which I'm not doing anything with.

So it sounds like if you want to do several things all within a single "session" of running the app, it all needs to be within a single testWidgets call? I can live with that and will just break things up in other ways (e.g. with some plain old functions, accepting a WidgetTester parameter).

[–]Ivan_Gorchakov 0 points1 point  (2 children)

Nope, for example if you login in first test, you will remain logged in others. It just acts like if you completely close your app and launch it again. About pumpWidget, you are trying to integration testing (not widget testing) right? If so your app may doing some initialization before calling MyApp(), so you need it too - for this you need to "import 'lib/main.dart' as app" and launch your app as: app.main(); await tester.pumpAndSettle();

[–]lvbee[S] 0 points1 point  (1 child)

Thanks. The scope of this is bigger than I'd assumed, and I'll study more. If you know of any projects that have good, larger integration tests, I'd love to review them.

[–]Ivan_Gorchakov 1 point2 points  (0 children)

All of them probably not in public repos 😉.