@@ -38,11 +38,14 @@ late FakeApiConnection connection;
38
38
Future <void > setupToMessageActionSheet (WidgetTester tester, {
39
39
required Message message,
40
40
required Narrow narrow,
41
+ Account ? account,
41
42
}) async {
42
43
addTearDown (testBinding.reset);
43
44
44
- await testBinding.globalStore.add (eg.selfAccount, eg.initialSnapshot ());
45
- final store = await testBinding.globalStore.perAccount (eg.selfAccount.id);
45
+ account ?? = eg.selfAccount;
46
+ final initialSnapshot = eg.initialSnapshot (zulipFeatureLevel: account.zulipFeatureLevel);
47
+ await testBinding.globalStore.add (account, initialSnapshot);
48
+ final store = await testBinding.globalStore.perAccount (account.id);
46
49
await store.addUser (eg.user (userId: message.senderId));
47
50
if (message is StreamMessage ) {
48
51
final stream = eg.stream (streamId: message.streamId);
@@ -60,8 +63,8 @@ Future<void> setupToMessageActionSheet(WidgetTester tester, {
60
63
historyLimited: false ,
61
64
messages: [message],
62
65
).toJson ());
63
-
64
- await tester.pumpWidget (TestZulipApp (accountId: eg.selfAccount .id,
66
+ await tester. pumpAndSettle ();
67
+ await tester.pumpWidget (TestZulipApp (accountId: account .id,
65
68
child: MessageListPage (initNarrow: narrow)));
66
69
67
70
// global store, per-account store, and message list get loaded
@@ -551,6 +554,24 @@ void main() {
551
554
final expectedLink = narrowLink (store, narrow, nearMessageId: message.id).toString ();
552
555
check (await Clipboard .getData ('text/plain' )).isNotNull ().text.equals (expectedLink);
553
556
});
557
+
558
+ testWidgets ('Full Url Testing' , (tester) async {
559
+ final message = eg.streamMessage ();
560
+ final narrow = TopicNarrow .ofMessage (message);
561
+ await setupToMessageActionSheet (tester, message: message, narrow: narrow);
562
+ await tapCopyMessageLinkButton (tester);
563
+ await tester.pump (Duration .zero);
564
+
565
+ final customAccount = eg.selfAccount.copyWith (
566
+ id: 2 , realmUrl: Uri .parse ('https://chat.example' ));
567
+ await setupToMessageActionSheet (
568
+ tester, message: message, narrow: narrow, account: customAccount);
569
+ final customAccountStore = await testBinding.globalStore.perAccount (customAccount.id);
570
+ final expectedLink = narrowLink (
571
+ customAccountStore, narrow, nearMessageId: message.id).toString ();
572
+
573
+ check (await Clipboard .getData ('text/plain' )).isNotNull ().text.equals (expectedLink);
574
+ });
554
575
});
555
576
556
577
group ('ShareButton' , () {
@@ -616,4 +637,4 @@ void main() {
616
637
check (mockSharePlus.sharedString).isNull ();
617
638
});
618
639
});
619
- }
640
+ }
0 commit comments