Skip to content

[espresso] (feature request) doesNotExist assertion for widgets #160599

Open
@FirentisTFW

Description

@FirentisTFW

Use case

I'm trying to add an Android integration test to one of the packages, I use Espresso for it, like suggested in Plugin-Tests.md. I need to check if a widget is not rendered on the screen, after that I'll perform an action, and then verify the existence of a widget again (this time it should be visible).

In native Espresso library we can do that with ViewAssertions.doesNotExist, but there's no equivalent in Espresso for Flutter - we only have isExisting here.

Proposal

I'd suggest adding another static function (doesNotExist) to FlutterMatchers class. This function would return a proper matcher that would check if a given Flutter widget exists. If it does, it should throw an exception.

Example code:

WidgetInteraction playButton = onFlutterWidget(withValueKey("Play"));
playButton.check(matches(doesNotExist()));

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectc: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterp: espressoThe Espresso pluginpackageflutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyteam-androidOwned by Android platform teamtriaged-androidTriaged by Android platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions