@@ -8,6 +8,7 @@ import 'package:flutter_test/flutter_test.dart';
8
8
import 'package:http/http.dart' as http;
9
9
import 'package:zulip/api/model/model.dart' ;
10
10
import 'package:zulip/api/route/messages.dart' ;
11
+ import 'package:zulip/model/binding.dart' ;
11
12
import 'package:zulip/model/compose.dart' ;
12
13
import 'package:zulip/model/localizations.dart' ;
13
14
import 'package:zulip/model/narrow.dart' ;
@@ -84,11 +85,12 @@ void main() {
84
85
void prepareRawContentResponseSuccess (PerAccountStore store, {
85
86
required Message message,
86
87
required String rawContent,
88
+ Duration delay = Duration .zero,
87
89
}) {
88
90
// Prepare fetch-raw-Markdown response
89
91
// TODO: Message should really only differ from `message`
90
92
// in its content / content_type, not in `id` or anything else.
91
- (store.connection as FakeApiConnection ).prepare (json:
93
+ (store.connection as FakeApiConnection ).prepare (delay : delay, json:
92
94
GetMessageResult (message: eg.streamMessage (contentMarkdown: rawContent)).toJson ());
93
95
}
94
96
@@ -474,6 +476,33 @@ void main() {
474
476
check (await Clipboard .getData ('text/plain' )).isNotNull ().text.equals ('Hello world' );
475
477
});
476
478
479
+ testWidgets ('success with a snackbar' , (tester) async {
480
+ // for #732 regression check below
481
+ testBinding.deviceInfoResult = IosDeviceInfo (systemVersion: '16.0' );
482
+
483
+ final message = eg.streamMessage ();
484
+ await setupToMessageActionSheet (tester, message: message, narrow: TopicNarrow .ofMessage (message));
485
+ final store = await testBinding.globalStore.perAccount (eg.selfAccount.id);
486
+
487
+ prepareRawContentResponseSuccess (store,
488
+ message: message,
489
+ rawContent: 'Hello world' ,
490
+ delay: const Duration (milliseconds: 500 ));
491
+
492
+ await tapCopyMessageTextButton (tester);
493
+ for (int i = 0 ; i < 5 ; i++ ) {
494
+ await tester.pump (const Duration (milliseconds: 100 ));
495
+ }
496
+
497
+ // regression check for #732
498
+ final snackbar = tester.widget <SnackBar >(find.byType (SnackBar ));
499
+ check (snackbar.behavior).equals (SnackBarBehavior .floating);
500
+ final zulipLocalizations = GlobalLocalizations .zulipLocalizations;
501
+ tester.widget (find.descendant (matchRoot: true ,
502
+ of: find.byWidget (snackbar.content),
503
+ matching: find.text (zulipLocalizations.successMessageTextCopied)));
504
+ });
505
+
477
506
testWidgets ('request has an error' , (WidgetTester tester) async {
478
507
final message = eg.streamMessage ();
479
508
await setupToMessageActionSheet (tester, message: message, narrow: TopicNarrow .ofMessage (message));
0 commit comments