From cb9a849009e44beb599d060f3367d2c8b2051291 Mon Sep 17 00:00:00 2001 From: Chris Bobbe Date: Mon, 17 Mar 2025 16:39:29 -0700 Subject: [PATCH] content test: Test tap-link behavior when invalid URL Thanks Zixuan for noticing we haven't been covering this: https://github.com/zulip/zulip-flutter/pull/1410#discussion_r1999450438 --- test/widgets/content_test.dart | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/test/widgets/content_test.dart b/test/widgets/content_test.dart index f871615571..f7941bc6df 100644 --- a/test/widgets/content_test.dart +++ b/test/widgets/content_test.dart @@ -871,7 +871,18 @@ void main() { .single.equals((url: Uri.parse('https://a/'), mode: LaunchMode.inAppBrowserView)); }); - testWidgets('error dialog if invalid link', (tester) async { + testWidgets('error dialog if invalid URL', (tester) async { + await prepare(tester, + '

word

'); + await tapText(tester, find.text('word')); + await tester.pump(); + check(testBinding.takeLaunchUrlCalls()).isEmpty(); + checkErrorDialog(tester, + expectedTitle: 'Unable to open link', + expectedMessage: 'Link could not be opened: ::invalid::'); + }); + + testWidgets('error dialog if platform cannot open link', (tester) async { await prepare(tester, '

word

'); testBinding.launchUrlResult = false;