Test API improvements: pumpAndSettle, autogenerate pointer IDs (#8751)
This commit is contained in:
@@ -23,7 +23,7 @@ void main() {
|
||||
final Point allDemosOrigin = tester.getTopRight(find.text('Demos'));
|
||||
final Finder button = find.text('Buttons');
|
||||
while (button.evaluate().isEmpty) {
|
||||
await tester.scrollAt(allDemosOrigin, const Offset(0.0, -100.0));
|
||||
await tester.dragFrom(allDemosOrigin, const Offset(0.0, -100.0));
|
||||
await tester.pump(); // start the scroll
|
||||
await tester.pump(const Duration(seconds: 1));
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ void main() {
|
||||
await tester.pump(); // Launch the recipe page
|
||||
await tester.pump(const Duration(seconds: 1)); // transition is complete
|
||||
|
||||
await tester.scroll(find.text('Pesto Bruschetta'), const Offset(0.0, -300.0));
|
||||
await tester.drag(find.text('Pesto Bruschetta'), const Offset(0.0, -300.0));
|
||||
await tester.pump();
|
||||
|
||||
Navigator.pop(find.byType(Scaffold).evaluate().single);
|
||||
@@ -51,8 +51,7 @@ void main() {
|
||||
await tester.pump(const Duration(seconds: 1)); // transition is complete
|
||||
|
||||
await tester.fling(find.text('Pesto Bruschetta'), const Offset(0.0, -200.0), 10000.0);
|
||||
await tester.pump(); // start fling
|
||||
await tester.pumpUntilNoTransientCallbacks();
|
||||
await tester.pumpAndSettle(); // start and finish fling
|
||||
expect(find.text('Sicilian-Style sardines'), findsOneWidget);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -47,17 +47,17 @@ void main() {
|
||||
await tester.pump(const Duration(seconds: 1)); // end animation
|
||||
|
||||
// Scroll it up
|
||||
await tester.scroll(find.text('(650) 555-1234'), const Offset(0.0, -50.0));
|
||||
await tester.drag(find.text('(650) 555-1234'), const Offset(0.0, -50.0));
|
||||
await tester.pump(const Duration(milliseconds: 200));
|
||||
await tester.scroll(find.text('(650) 555-1234'), const Offset(0.0, -50.0));
|
||||
await tester.drag(find.text('(650) 555-1234'), const Offset(0.0, -50.0));
|
||||
await tester.pump(const Duration(milliseconds: 200));
|
||||
await tester.scroll(find.text('(650) 555-1234'), const Offset(0.0, -50.0));
|
||||
await tester.drag(find.text('(650) 555-1234'), const Offset(0.0, -50.0));
|
||||
await tester.pump(const Duration(milliseconds: 200));
|
||||
await tester.scroll(find.text('(650) 555-1234'), const Offset(0.0, -50.0));
|
||||
await tester.drag(find.text('(650) 555-1234'), const Offset(0.0, -50.0));
|
||||
await tester.pump(const Duration(milliseconds: 200));
|
||||
await tester.scroll(find.text('(650) 555-1234'), const Offset(0.0, -50.0));
|
||||
await tester.drag(find.text('(650) 555-1234'), const Offset(0.0, -50.0));
|
||||
await tester.pump(const Duration(milliseconds: 200));
|
||||
await tester.scroll(find.text('(650) 555-1234'), const Offset(0.0, -50.0));
|
||||
await tester.drag(find.text('(650) 555-1234'), const Offset(0.0, -50.0));
|
||||
await tester.pump(const Duration(milliseconds: 200));
|
||||
|
||||
await tester.pump(const Duration(hours: 100)); // for testing
|
||||
|
||||
@@ -127,8 +127,7 @@ Future<Null> runSmokeTest(WidgetTester tester) async {
|
||||
for (String routeName in routeNames) {
|
||||
final Finder finder = findGalleryItemByRouteName(tester, routeName);
|
||||
Scrollable.ensureVisible(tester.element(finder), alignment: 0.5);
|
||||
await tester.pump();
|
||||
await tester.pumpUntilNoTransientCallbacks();
|
||||
await tester.pumpAndSettle();
|
||||
await smokeDemo(tester, routeName);
|
||||
tester.binding.debugAssertNoTransientCallbacks('A transient callback was still active after leaving route $routeName');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user