Skip to content

Flutter update breaks link interaction tests #475

Closed
@gnprice

Description

@gnprice

After a Flutter update, some tests are failing in main. This is visible also in the recent PRs #472 and #474, as here:
https://github.com/zulip/zulip-flutter/actions/runs/7391944552/job/20109637276?pr=472

The failure looks like this:

$ flutter test test/widgets/content_test.dart --name 'can tap a link'
00:02 +0: LinkNode interactions can tap a link to open URL (variant: TargetPlatform.android)
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following TestFailure was thrown running a test:
Expected: a List<({LaunchMode mode, Uri url})> that:
  has single element
Actual: []
Which: has no elements

When the exception was thrown, this was the stack:
#0      check.<anonymous closure> (package:checks/src/checks.dart:72:9)
#1      _TestContext.nest (package:checks/src/checks.dart:760:12)
#2      IterableChecks.single (package:checks/src/extensions/iterable.dart:33:36)
#3      main.<anonymous closure>.<anonymous closure> (file:///home/greg/z/flutterz/test/widgets/content_test.dart:90:10)
<asynchronous suspension>
#4      testWidgets.<anonymous closure>.<anonymous closure> (package:flutter_test/src/widget_tester.dart:168:15)
<asynchronous suspension>
#5      TestWidgetsFlutterBinding._runTestBody (package:flutter_test/src/binding.dart:1017:5)
<asynchronous suspension>
<asynchronous suspension>
(elided one frame from package:stack_trace)

The test description was:
  can tap a link to open URL (variant: TargetPlatform.android)
════════════════════════════════════════════════════════════════════════════════════════════════════
00:02 +0 -1: LinkNode interactions can tap a link to open URL (variant: TargetPlatform.android) [E]
  Test failed. See exception logs above.
  The test description was: can tap a link to open URL (variant: TargetPlatform.android)
  

To run this test again: /home/greg/n/flutter/flutter/bin/cache/dart-sdk/bin/dart test /home/greg/z/flutterz/test/widgets/content_test.dart -p vm --plain-name 'LinkNode interactions can tap a link to open URL (variant: TargetPlatform.android)'

The test renders some content that has a link in it, then taps the link and checks that the tap made it to the binding for launchUrl. The check fails — apparently the tap didn't make it to the binding.

On the other hand, following a link in the actual app seems to work fine. So this may only affect the tests.

More investigation needed.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions