Skip to content

Add test APIs to support find descendant/ancestor widgets #7643

Closed

Description

@zhenqiu1101

We would like to have widget tester APIs to find ancestor or descendant of an Element. So that we can test cases like,

  • Find text within a specific widget (not the whole widget tree).
  • Find text widget, who is under a Row and with a specific content.

Activity

  1. Hixie commented on Jan 26, 2017

    @Hixie
    Contributor

    we should probably add two things: a matcher that checks if a widget has a descendant, identified by finder:

       expect(find.byType(Foo), hasDescendantWidget(find.text('hello'));

    ...and a finder that takes two finders:

       find.descendant(of: find.byType(Foo), matching: find.text('hello'))
  2. zhenqiu1101 commented on Feb 8, 2017

    @zhenqiu1101
    ContributorAuthor

    The PR is merged. Should I close this issue?

  3. eseidelGoogle commented on Feb 8, 2017

    @eseidelGoogle
    Contributor

    Thanks! Github is also smart enough to auto-close issues when PRs land if we use the right wording in the PR:
    https://help.github.com/articles/closing-issues-via-commit-messages/

  4. zhenqiu1101 commented on Feb 8, 2017

    @zhenqiu1101
    ContributorAuthor

    Good to know! Thanks!

  5. github-actions commented on Sep 5, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  6. locked as resolved and limited conversation to collaborators on Sep 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions