-
Notifications
You must be signed in to change notification settings - Fork 30.1k
Migrate gallery/transitions_perf test to e2e #62064
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a340658
156dcea
8c7b6ed
18e595f
bde87b5
9dba080
559e394
9c4cfaf
74f86f4
daeef36
e0b6840
30b7c2e
b960ba8
65a98e4
b93aa35
76d495a
b82106d
4ee8cc5
16e4843
a77644b
8b4033a
66a6281
3423ca6
b7ef43d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| // 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_devicelab/tasks/gallery.dart'; | ||
| import 'package:flutter_devicelab/framework/adb.dart'; | ||
| import 'package:flutter_devicelab/framework/framework.dart'; | ||
|
|
||
| Future<void> main() async { | ||
| deviceOperatingSystem = DeviceOperatingSystem.android; | ||
| await task(createGalleryTransitionE2ETest()); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,11 +15,34 @@ TaskFunction createGalleryTransitionTest({ bool semanticsEnabled = false }) { | |
| return GalleryTransitionTest(semanticsEnabled: semanticsEnabled); | ||
| } | ||
|
|
||
| TaskFunction createGalleryTransitionE2ETest({ bool semanticsEnabled = false }) { | ||
| return GalleryTransitionTest( | ||
| semanticsEnabled: semanticsEnabled, | ||
| testFile: 'transitions_perf_e2e', | ||
| needFullTimeline: false, | ||
| timelineSummaryFile: 'e2e_perf_summary', | ||
| transitionDurationFile: null, | ||
| driverFile: 'transitions_perf_e2e_test', | ||
| ); | ||
| } | ||
|
|
||
| class GalleryTransitionTest { | ||
|
|
||
| GalleryTransitionTest({ this.semanticsEnabled = false }); | ||
| GalleryTransitionTest({ | ||
| this.semanticsEnabled = false, | ||
| this.testFile = 'transitions_perf', | ||
| this.needFullTimeline = true, | ||
| this.timelineSummaryFile = 'transitions.timeline_summary', | ||
| this.transitionDurationFile = 'transition_durations.timeline', | ||
| this.driverFile, | ||
| }); | ||
|
|
||
| final bool semanticsEnabled; | ||
| final bool needFullTimeline; | ||
| final String testFile; | ||
| final String timelineSummaryFile; | ||
| final String transitionDurationFile; | ||
| final String driverFile; | ||
|
|
||
| Future<TaskResult> call() async { | ||
| final Device device = await devices.workingDevice; | ||
|
|
@@ -31,41 +54,41 @@ class GalleryTransitionTest { | |
| await flutter('packages', options: <String>['get']); | ||
|
|
||
| final String testDriver = semanticsEnabled | ||
| ? 'transitions_perf_with_semantics.dart' | ||
| : 'transitions_perf.dart'; | ||
| ? '${testFile}_with_semantics.dart' | ||
| : '$testFile.dart'; | ||
|
|
||
| await flutter('drive', options: <String>[ | ||
| '--profile', | ||
| '--trace-startup', | ||
| if (needFullTimeline) | ||
| '--trace-startup', | ||
| '-t', | ||
| 'test_driver/$testDriver', | ||
| if (driverFile != null) | ||
| ...<String>['--driver', 'test_driver/$driverFile.dart'], | ||
| '-d', | ||
| deviceId, | ||
| ]); | ||
| }); | ||
|
|
||
| // Route paths contains slashes, which Firebase doesn't accept in keys, so we | ||
| // remove them. | ||
| final Map<String, dynamic> original = json.decode( | ||
| file('${galleryDirectory.path}/build/transition_durations.timeline.json').readAsStringSync(), | ||
| ) as Map<String, dynamic>; | ||
| final Map<String, List<int>> transitions = <String, List<int>>{}; | ||
| for (final String key in original.keys) { | ||
| transitions[key.replaceAll('/', '')] = List<int>.from(original[key] as List<dynamic>); | ||
| } | ||
|
|
||
| final Map<String, dynamic> summary = json.decode( | ||
| file('${galleryDirectory.path}/build/transitions.timeline_summary.json').readAsStringSync(), | ||
| file('${galleryDirectory.path}/build/$timelineSummaryFile.json').readAsStringSync(), | ||
| ) as Map<String, dynamic>; | ||
|
|
||
| final Map<String, dynamic> data = <String, dynamic>{ | ||
| 'transitions': transitions, | ||
| 'missed_transition_count': _countMissedTransitions(transitions), | ||
| ...summary, | ||
| }; | ||
| if (transitionDurationFile != null) { | ||
|
||
| final Map<String, dynamic> original = json.decode( | ||
| file('${galleryDirectory.path}/build/$transitionDurationFile.json').readAsStringSync(), | ||
| ) as Map<String, dynamic>; | ||
| final Map<String, List<int>> transitions = <String, List<int>>{}; | ||
| for (final String key in original.keys) { | ||
| transitions[key] = List<int>.from(original[key] as List<dynamic>); | ||
| } | ||
| summary['transitions'] = transitions; | ||
| summary['missed_transition_count'] = _countMissedTransitions(transitions); | ||
| } | ||
|
|
||
| return TaskResult.success(data, benchmarkScoreKeys: <String>[ | ||
| 'missed_transition_count', | ||
| return TaskResult.success(summary, benchmarkScoreKeys: <String>[ | ||
| if (transitionDurationFile != null) | ||
| 'missed_transition_count', | ||
| 'average_frame_build_time_millis', | ||
| 'worst_frame_build_time_millis', | ||
| '90th_percentile_frame_build_time_millis', | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -411,15 +411,6 @@ tasks: | |
| stage: devicelab | ||
| required_agent_capabilities: ["linux/android"] | ||
|
|
||
| # flutter_gallery_instrumentation_test: | ||
| # description: > | ||
| # Same as flutter_gallery__transition_perf but uses Android instrumentation | ||
| # framework, and therefore does not require a host computer to run. This | ||
| # test can run on off-the-shelf infrastructures, such as Firebase Test Lab. | ||
| # stage: devicelab | ||
| # required_agent_capabilities: ["linux/android"] | ||
| # flaky: true | ||
|
|
||
| linux_chrome_dev_mode: | ||
| description: > | ||
| Run flutter web on the devicelab and hot restart. | ||
|
|
@@ -763,6 +754,14 @@ tasks: | |
| stage: devicelab | ||
| required_agent_capabilities: ["linux/android"] | ||
|
|
||
| flutter_gallery__transition_perf_e2e: | ||
|
||
| description: > | ||
| Measures the performance of screen transitions in Flutter Gallery on | ||
| Android with e2e. | ||
| stage: devicelab | ||
| required_agent_capabilities: ["linux/android"] | ||
| flaky: true | ||
|
|
||
| flutter_gallery_sksl_warmup__transition_perf: | ||
| description: > | ||
| Measures the runtime performance of Flutter gallery transitions on Android | ||
|
|
||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| // 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. | ||
|
|
||
| package io.flutter.demo.gallery; | ||
|
|
||
| import androidx.test.rule.ActivityTestRule; | ||
| import dev.flutter.plugins.e2e.FlutterTestRunner; | ||
| import org.junit.Rule; | ||
| import org.junit.runner.RunWith; | ||
|
|
||
| @RunWith(FlutterTestRunner.class) | ||
| public class MainActivityTest { | ||
| @Rule | ||
| public ActivityTestRule<MainActivity> rule = new ActivityTestRule<>(MainActivity.class, true, false); | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.