Skip to content

Commit c67710a

Browse files
fix(test): avoid findsOneWidget hang on ConnectionsPanel expanded test
findsOneWidget polls until a long timeout; assert finder.evaluate().length instead Made-with: Cursor
1 parent 2031b5f commit c67710a

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

‎test/features/connections/connections_panel_layout_test.dart‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ import '../../support/layout_overflow.dart';
1313

1414
String _isoNow() => DateTime.now().toUtc().toIso8601String();
1515

16+
/// Avoid [findsOneWidget] here: it polls until a long timeout and can hang the suite.
17+
void _expectTextCount(String label, int expected) {
18+
final n = find.text(label).evaluate().length;
19+
expect(n, expected, reason: 'Text("$label"): expected $expected, found $n');
20+
}
21+
1622
class _FakePathProvider extends PathProviderPlatform {
1723
_FakePathProvider(this._root);
1824
final String _root;
@@ -168,10 +174,10 @@ void main() {
168174
}
169175
});
170176

171-
expect(find.text('LayoutTestFolder'), findsOneWidget);
172-
expect(find.text('PG local'), findsOneWidget);
173-
expect(find.text('Redis local'), findsOneWidget);
174-
expect(find.text('Mongo local'), findsOneWidget);
177+
_expectTextCount('LayoutTestFolder', 1);
178+
_expectTextCount('PG local', 1);
179+
_expectTextCount('Redis local', 1);
180+
_expectTextCount('Mongo local', 1);
175181
});
176182
});
177183
}

0 commit comments

Comments
 (0)