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
18 changes: 14 additions & 4 deletions test/page_screenshots_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -712,14 +712,24 @@ void main() {
await tester.pump();
// It stays up, saying so, until the capture has stopped.
expect(find.text('Stopping…'), findsOneWidget);
// The clock moves too, so the dialog's closing animation plays out.
// The clock moves too, so the dialog's closing animation plays out. The
// toast is shown while real time passes here, so its closing timer runs
// on real time: it is looked for as it shows, and taken away at once,
// so it neither closes before the check on a slow machine nor closes
// itself after the test, on a torn-down tree.
var toldCancelled = false;
for (var i = 0;
i < 400 && find.text('Saving screenshots').evaluate().isNotEmpty;
i++) {
await tester.runAsync(
() => Future<void>.delayed(const Duration(milliseconds: 16)),
);
await tester.pump(const Duration(milliseconds: 16));
if (!toldCancelled &&
find.text('Screenshots cancelled.').evaluate().isNotEmpty) {
toldCancelled = true;
toastification.dismissAll(delayForAnimation: false);
}
}
for (var i = 0; i < 10; i++) {
await tester.pump(const Duration(milliseconds: 100));
Expand All @@ -729,10 +739,10 @@ void main() {
expect(find.byType(EditorToolbar), findsOneWidget);
expect(find.text('Library'), findsNothing);
expect(folder.listSync(), isEmpty);
expect(find.text('Screenshots cancelled.'), findsOneWidget);
expect(toldCancelled, isTrue);
ignoreTestFontOverflow(tester);
// Let the toast leave.
await tester.pump(const Duration(seconds: 10));
// Let the toast's removal play out.
await tester.pump(const Duration(seconds: 4));
});

testWidgets('a finished capture closes only its own dialog', (tester) async {
Expand Down
Loading