Skip to content

FlutterDriver.waitForAbsent() never completing #11327

@tvolkert

Description

@tvolkert

Problem

Tried to use this inside Google today, and getting incorrect behavior:

await driver.waitForAbsent(find.text('foo'), timeout: const Duration(seconds: 20));
  • If I call that, the future never completes, and the test fails with a timeout exception after 20 seconds.
  • If I first await a delayed future of 5 seconds to let the Snackbar that holds the text go away, then run the await above, then the future completes just fine, and the test succeeds.

Analysis

The future is never completing because of an error during this call in extension.dart:

await _waitUntilFrame(() => !finder.precache());

The error is:

'package:flutter_test/src/finders.dart': Failed assertion: line 269: '_cachedResult == null': is not true.

It seems weird that it's causing the future to never complete rather than completing with an error...

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: tests"flutter test", flutter_test, or one of our testst: flutter driver"flutter driver", flutter_drive, or a driver test

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions