Flutter Web Driver Support (#47890)
This commit is contained in:
committed by
Flutter GitHub Bot
parent
57a93419b4
commit
9df1790f24
12
examples/flutter_gallery/test_driver/scroll_perf_web.dart
Normal file
12
examples/flutter_gallery/test_driver/scroll_perf_web.dart
Normal file
@@ -0,0 +1,12 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter_driver/driver_extension.dart';
|
||||
import 'package:flutter_gallery/gallery/app.dart' show GalleryApp;
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
void main() {
|
||||
enableFlutterDriverExtension();
|
||||
runApp(const GalleryApp(testMode: true));
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter_driver/flutter_driver.dart';
|
||||
import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
|
||||
|
||||
void main() {
|
||||
group('scrolling performance test', () {
|
||||
FlutterDriver driver;
|
||||
|
||||
setUpAll(() async {
|
||||
driver = await FlutterDriver.connect(browser: true);
|
||||
});
|
||||
|
||||
tearDownAll(() async {
|
||||
if (driver != null)
|
||||
driver.close();
|
||||
});
|
||||
|
||||
test('measure', () async {
|
||||
final Timeline timeline = await driver.traceAction(() async {
|
||||
await driver.tap(find.text('Material'));
|
||||
|
||||
final SerializableFinder demoList = find.byValueKey('GalleryDemoList');
|
||||
|
||||
// TODO(eseidel): These are very artificial scrolls, we should use better
|
||||
// https://github.com/flutter/flutter/issues/3316
|
||||
// Scroll down
|
||||
for (int i = 0; i < 5; i++) {
|
||||
await driver.scroll(demoList, 0.0, -300.0, const Duration(milliseconds: 300));
|
||||
await Future<void>.delayed(const Duration(milliseconds: 500));
|
||||
}
|
||||
|
||||
// Scroll up
|
||||
for (int i = 0; i < 5; i++) {
|
||||
await driver.scroll(demoList, 0.0, 300.0, const Duration(milliseconds: 300));
|
||||
await Future<void>.delayed(const Duration(milliseconds: 500));
|
||||
}
|
||||
});
|
||||
|
||||
TimelineSummary.summarize(timeline)
|
||||
..writeTimelineToFile('home_scroll_perf', pretty: true);
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user