Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
357 views
in Technique[技术] by (71.8m points)

flutter - Integration test | PumpAndSettle

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-

  1. A has a button on which I tap and do pumpAndSettle
  2. Due to button press, B screen appears.
  3. 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.
  4. I did pumpAndSettle(Duration(seconds: 1))
  5. 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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...