Home > Blockchain >  Flutter Integration Tests Not Waiting For App To Load Before Failure
Flutter Integration Tests Not Waiting For App To Load Before Failure

Time:01-16

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

CodePudding user response:

Looks like

await tester.pumpAndSettle(Duration(seconds: 7));

Did the trick... The only reason I have it set for 7 seconds because we have a splash screen I want to load through fully

  • Related