Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lesson 13: The difference between pumpWidget(), pump() and pumpAndSettle() #13

Merged
merged 1 commit into from
Dec 2, 2020

Conversation

samuelematias
Copy link
Owner

Description

PR with Lesson 13.

pumpWidget
pump
pumpAndSettle

pumpWidget is like a runApp method, to run our app, but in the test context.

...
await tester.pumpWidget(CalculatorApp());
..

pump if has some change in your widget by some action (e.g. set a value inside a TextField and show this value bellow the TextField), this represents a new frame, so pump help in this case.

...
await tester.pumpWidget(CalculatorApp());
await tester.enterText(find.byKey(Key('textField_top_plus')), '3');
await tester.enterText(find.byKey(Key('textField_bottom_plus')), '6');
await tester.pump();
...

pumpAndSettle if has some change in your widget by some action (e.g. set a value inside a TextField and show this value bellow the TextField), but with some animation, this represents a new frame and sometimes take a while for this animation show/end, so pumpAndSettle help in this case.

...
await tester.pumpWidget(CalculatorApp());
await tester.enterText(find.byKey(Key('textField_top_plus')), '3');
await tester.enterText(find.byKey(Key('textField_bottom_plus')), '6');
await tester.pumpAndSettle();
...

Types of changes

  • Fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Improvement (non-breaking change which adds Improvements)

@samuelematias samuelematias merged commit b42182c into main Dec 2, 2020
@samuelematias samuelematias changed the title Lesson 13 Lesson 13: The difference between pumpWidget(), pump() and pumpAndSettle() Dec 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant