Skip to content

Commit

Permalink
Add settle argument to tTestWidgets.
Browse files Browse the repository at this point in the history
Controls whether pumpAndSettle() or pump() is called.
  • Loading branch information
ronba committed Sep 8, 2022
1 parent ff6ca01 commit bdb2050
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/convenient_test_dev/lib/src/functions/core.dart
Original file line number Diff line number Diff line change
Expand Up @@ -160,19 +160,24 @@ Future<void> _lastTearDownAll() async {

typedef TWidgetTesterCallback = Future<void> Function(ConvenientTest t);

/// Wrapper around [testWidgets].
///
/// If the app's main widget contains a widget that never settles (for example:
/// has animations that repeats infinitely), set [settle] to false.
@isTest
void tTestWidgets(
// ... forward the arguments ...
String description,
TWidgetTesterCallback callback, {
bool skip = false,
bool settle = true,
}) {
testWidgets(
description,
(tester) async => await ConvenientTest.withActiveInstance(tester, (t) async {
final log = t.log('START APP', '');
await myGetIt.get<ConvenientTestSlot>().appMain(AppMainExecuteMode.integrationTest);
await t.pumpAndSettle();
settle ? await t.pumpAndSettle() : await t.pump();
await log.snapshot(name: 'after');

await callback(t);
Expand Down

0 comments on commit bdb2050

Please sign in to comment.