I have one screen (Say screen B) which uses animation for a second and then displays UI element.
After the animation is over, I need to get a button and press it.
This screen comes after a particular screen (Say screen A). I have successfully written integration tests (using integration_test) and now this screen appears. Now here is the scenario-
- A has a button on which I tap and do
pumpAndSettle
- Due to button press, B screen appears.
- Now I need to wait for 1 second, and then current view animated to the left and a new view appears which has a button.
- I did pumpAndSettle(Duration(seconds: 1))
- Now, after 4th line of code, nothing executes afterwards and test does not end until timeout.
More info:
So there is one screen (Say Home screen of App) on which I am showing "Progress Indicator" until I have data available.
Now there is one screen that is pushed on top (kind of welcome screen) of home screen for a fresh installation of app.
In that screen welcome screen, I have one view which I animated to left after one second and show welcome items with skip button.
So
[1] expect(welcomeScreen, findsOneWidget);
[2] await Future.delayed(Duration(seconds: 1));
[3] await tester.pumpAndSettle();
The above lines of code work fine but if I do,
[2Alt] await tester.pumpAndSettle(Duration(seconds: 1))
This runs indefinitely.
Further
There is a skip button that appears after 1 second (on welcom screen), I click on the skip button which pops the welcome screen and get back to home screen where "progress indicator" is spinning until the data is received.
expect(skipButton, findsOneWidget);
await tester.tap(skipButton);
await tester.pumpAndSettle();
Here pumpAndSettle is taking infinite time (until timeout)
I am not sure what is the reason. What actually pumpAndSettle is doing.. If I do pump only, it works
question from:
https://stackoverflow.com/questions/65917181/integration-test-pumpandsettle 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…