Skip to content

Commit aeb6a94

Browse files
committed
action-sheet test: Simplify and explain a bit more the #732 repro test
1 parent 63b57fe commit aeb6a94

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

test/widgets/action_sheet_test.dart

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -476,25 +476,23 @@ void main() {
476476
check(await Clipboard.getData('text/plain')).isNotNull().text.equals('Hello world');
477477
});
478478

479-
testWidgets('success with a snackbar', (tester) async {
480-
// for #732 regression check below
479+
testWidgets('can show snackbar on success', (tester) async {
480+
// Regression test for: https://github.com/zulip/zulip-flutter/issues/732
481481
testBinding.deviceInfoResult = IosDeviceInfo(systemVersion: '16.0');
482482

483483
final message = eg.streamMessage();
484484
await setupToMessageActionSheet(tester, message: message, narrow: TopicNarrow.ofMessage(message));
485485
final store = await testBinding.globalStore.perAccount(eg.selfAccount.id);
486486

487-
prepareRawContentResponseSuccess(store,
488-
message: message,
489-
rawContent: 'Hello world',
487+
// Make the request take a bit of time to complete…
488+
prepareRawContentResponseSuccess(store, message: message, rawContent: 'Hello world',
490489
delay: const Duration(milliseconds: 500));
491-
492490
await tapCopyMessageTextButton(tester);
493-
for (int i = 0; i < 5; i++) {
494-
await tester.pump(const Duration(milliseconds: 100));
495-
}
491+
// … and pump a frame to finish the NavigationState.pop animation…
492+
await tester.pump(const Duration(milliseconds: 250));
493+
// … before the request finishes. This is the repro condition for #732.
494+
await tester.pump(const Duration(milliseconds: 250));
496495

497-
// regression check for #732
498496
final snackbar = tester.widget<SnackBar>(find.byType(SnackBar));
499497
check(snackbar.behavior).equals(SnackBarBehavior.floating);
500498
final zulipLocalizations = GlobalLocalizations.zulipLocalizations;

0 commit comments

Comments
 (0)