Minor widget_tester refactoring and docs (#3472)

This reorders some classes so that this file makes more sense, and adds
a bunch of docs. It also makes the following changes:

* Move allElements from Instrumentation to TestWidgets. (Instrumentation
  is going away.)

* Remove findElements.

* Rename byElement to byElementPredicate

* Rename byPredicate to byWidgetPredicate

* Implement _WidgetPredicateFinder so that byWidgetPredicate has good
  messages

* Fix one use of byElementPredicate to use byWidgetPredicate.
This commit is contained in:
Ian Hickson
2016-04-21 16:35:46 -07:00
parent 31d199b0ee
commit c167efca17
7 changed files with 179 additions and 111 deletions

View File

@@ -15,8 +15,7 @@ void main() {
tester.pump(); // see https://github.com/flutter/flutter/issues/1865
tester.pump(); // triggers a frame
Finder navigationMenu = find.byElement((Element element) {
Widget widget = element.widget;
Finder navigationMenu = find.byWidgetPredicate((Widget widget) {
if (widget is Tooltip)
return widget.message == 'Open navigation menu';
return false;