Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 27 additions & 6 deletions packages/devtools_test/lib/src/helpers/actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,26 @@ Future<void> switchToScreen(
);
_maybeExpect(tabFinder, findsOneWidget, shouldExpect: runWithExpectations);

await controller.tap(tabFinder, warnIfMissed: warnIfTapMissed);
// We use pump here instead of pumpAndSettle because pumpAndSettle will
// never complete if there is an animation (e.g. a progress indicator).
await controller.pump(safePumpDuration);
await retryAsync<bool>(
() async {
try {
await controller.tap(tabFinder, warnIfMissed: warnIfTapMissed);
// We use pump here instead of pumpAndSettle because pumpAndSettle will
// never complete if there is an animation (e.g. a progress indicator).
await controller.pump(safePumpDuration);
return true;
} catch (e) {
logStatus('Attempt to switch to $screenId failed with error: $e');
return false;
}
},
condition: (success) => success,
onRetry: () async {
logStatus('Retrying switch to $screenId...');
// Try pumping again to give UI time to settle.
await controller.pump(safePumpDuration);
},
);
}

/// Finds the tab with [icon] either in the top-level DevTools tab bar or in the
Expand Down Expand Up @@ -174,7 +190,10 @@ Future<void> loadSampleData(
/// 2) access the [Scrollbar] widget's [ScrollController].
/// 3) scroll the scrollable attached to the [ScrollController] to the end of
/// the [ScrollController]'s scroll extent.
Future<void> scrollToEnd<T>(WidgetController controller) async {
Future<void> scrollToEnd<T>(
WidgetController controller, {
bool waitForSettle = true,
}) async {
final scrollbarFinder = find.descendant(
of: find.byType(T),
matching: find.byType(Scrollbar),
Expand All @@ -185,5 +204,7 @@ Future<void> scrollToEnd<T>(WidgetController controller) async {
duration: const Duration(milliseconds: 500),
curve: Curves.easeInOutCubic,
);
await controller.pump(shortPumpDuration);
await (waitForSettle
? controller.pumpAndSettle(shortPumpDuration)
: controller.pump(shortPumpDuration));
}
Loading