Unverified Commit 4226bff7 authored by Hans Muller's avatar Hans Muller Committed by GitHub

Updated memory_nav_test with FlutterDriver.scrollUntilVisible() (#16009)

parent c5288c73
import 'dart:async';
import 'package:flutter_driver/flutter_driver.dart';
import 'package:test/test.dart';
const Duration kWaitBetweenActions = const Duration(milliseconds: 250);
void main() {
group('flutter gallery transitions', () {
FlutterDriver driver;
......@@ -18,21 +14,16 @@ void main() {
});
test('navigation', () async {
final Completer<Null> completer = new Completer<Null>();
bool scroll = true;
final SerializableFinder menuItem = find.text('Text fields');
driver.waitFor(menuItem).then<Null>((Null value) async {
scroll = false;
for (int i = 0; i < 15; i++) {
await driver.tap(menuItem);
await driver.tap(find.byTooltip('Back'));
}
completer.complete();
});
while (scroll) {
await driver.scroll(find.text('Flutter Gallery'), 0.0, -500.0, const Duration(milliseconds: 80));
await driver.scrollUntilVisible(find.byType('CustomScrollView'), menuItem,
dyScroll: -300.0,
alignment: 0.5,
timeout: const Duration(minutes: 1),
);
for (int i = 0; i < 15; i++) {
await driver.tap(menuItem);
await driver.tap(find.byTooltip('Back'));
}
await completer.future;
}, timeout: const Timeout(const Duration(minutes: 1)));
});
});
}
......@@ -22,9 +22,8 @@ void main() {
test('measure', () async {
final Timeline timeline = await driver.traceAction(() async {
// Find the scrollable stock list
final SerializableFinder stockList = find.byValueKey('Gallery List');
expect(stockList, isNotNull);
final SerializableFinder home = find.byValueKey('Gallery List');
expect(home, isNotNull);
await driver.tap(find.text('Vignettes'));
await driver.tap(find.text('Components'));
......@@ -34,13 +33,13 @@ void main() {
// https://github.com/flutter/flutter/issues/3316
// Scroll down
for (int i = 0; i < 5; i++) {
await driver.scroll(stockList, 0.0, -300.0, const Duration(milliseconds: 300));
await driver.scroll(home, 0.0, -300.0, const Duration(milliseconds: 300));
await new Future<Null>.delayed(const Duration(milliseconds: 500));
}
// Scroll up
for (int i = 0; i < 5; i++) {
await driver.scroll(stockList, 0.0, 300.0, const Duration(milliseconds: 300));
await driver.scroll(home, 0.0, 300.0, const Duration(milliseconds: 300));
await new Future<Null>.delayed(const Duration(milliseconds: 500));
}
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment