2023-01-16

Flutter Integration Tests Not Waiting For App To Load Before Failure

On an app I've been creating I setup some integration tests in the past and made sure they were working. Now some months and many commits later, I am setting up GitHub actions and noticed for some reason my tests fail every time. I noticed that the app doesn't even load up at all before the tests fail, even though I use WidgetTester tester.pumpAndSettle();

Here is a sample of my code:

void main() {
  IntegrationTestWidgetsFlutterBinding.ensureInitialized();

  // Testing login-page UI, logging in, and moving to next screen
  testWidgets(
    "Integration test runner 1",
    (WidgetTester tester) async {
      // Wait for the app to launch, etc
      app.LoginPage();

      await tester.pumpAndSettle();

      expect(find.byKey(ValueKey("bigTextFostering")), findsOneWidget);
}

I tried using a waitForElement helpfer function, but had the same outcome



No comments:

Post a Comment