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

@@ -14,14 +14,14 @@ import '../lib/gallery/item.dart' as material_gallery;
const List<String> demoCategories = const <String>['Demos', 'Components', 'Style'];
Finder findGalleryItemByRouteName(WidgetTester tester, String routeName) {
return find.byPredicate((Widget widget) {
return find.byWidgetPredicate((Widget widget) {
return widget is material_gallery.GalleryItem
&& widget.routeName == routeName;
});
}
Finder byTooltip(WidgetTester tester, String message) {
return find.byPredicate((Widget widget) {
return find.byWidgetPredicate((Widget widget) {
return widget is Tooltip && widget.message == message;
});
}