mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-22 23:40:41 +00:00
Trace animated dialog opening
This commit is contained in:
parent
4a88bad074
commit
a8f5f106a3
5 changed files with 50 additions and 5 deletions
1
.vscode/launch.json
vendored
1
.vscode/launch.json
vendored
|
@ -57,6 +57,7 @@
|
||||||
"name": "Integration Test",
|
"name": "Integration Test",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"type": "dart",
|
"type": "dart",
|
||||||
|
"flutterMode": "profile",
|
||||||
"args": [
|
"args": [
|
||||||
"--flavor",
|
"--flavor",
|
||||||
"prod",
|
"prod",
|
||||||
|
|
|
@ -9,7 +9,7 @@ import 'package:lightmeter/screens/metering/components/shared/readings_container
|
||||||
import 'mocks/application_mock.dart';
|
import 'mocks/application_mock.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
|
final binding = IntegrationTestWidgetsFlutterBinding.ensureInitialized();
|
||||||
|
|
||||||
group('AnimatedDialogPicker test', () {
|
group('AnimatedDialogPicker test', () {
|
||||||
testWidgets('Tap on `ReadingValueContainer`, verify opened', (tester) async {
|
testWidgets('Tap on `ReadingValueContainer`, verify opened', (tester) async {
|
||||||
|
@ -17,10 +17,16 @@ void main() {
|
||||||
expect(find.text('Film'), findsOneWidget);
|
expect(find.text('Film'), findsOneWidget);
|
||||||
expect(find.text('None'), findsOneWidget);
|
expect(find.text('None'), findsOneWidget);
|
||||||
|
|
||||||
|
await binding.traceAction(
|
||||||
|
() async {
|
||||||
await tester.tap(find.byType(AnimatedDialogPicker<Film>));
|
await tester.tap(find.byType(AnimatedDialogPicker<Film>));
|
||||||
await tester.pumpAndSettle(Dimens.durationL);
|
await tester.pumpAndSettle(Dimens.durationL);
|
||||||
expect(find.text('Film'), findsNWidgets(2));
|
},
|
||||||
expect(find.text('None'), findsNWidgets(2));
|
reportKey: 'dialog_opening_timeline',
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(find.text('Film'), findsNWidgets(3));
|
||||||
|
expect(find.text('None'), findsNWidgets(3));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,8 @@ dependencies:
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
bloc_test: 9.1.3
|
bloc_test: 9.1.3
|
||||||
build_runner: ^2.1.7
|
build_runner: ^2.1.7
|
||||||
|
flutter_driver:
|
||||||
|
sdk: flutter
|
||||||
flutter_launcher_icons: 0.11.0
|
flutter_launcher_icons: 0.11.0
|
||||||
flutter_native_splash: 2.2.16
|
flutter_native_splash: 2.2.16
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|
27
test_driver/performance_driver.dart
Normal file
27
test_driver/performance_driver.dart
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
import 'package:flutter_driver/flutter_driver.dart' as driver;
|
||||||
|
import 'package:integration_test/integration_test_driver.dart';
|
||||||
|
|
||||||
|
Future<void> main() {
|
||||||
|
return integrationDriver(
|
||||||
|
responseDataCallback: (data) async {
|
||||||
|
if (data != null) {
|
||||||
|
final timeline =
|
||||||
|
driver.Timeline.fromJson(data['dialog_opening_timeline'] as Map<String, dynamic>);
|
||||||
|
|
||||||
|
// Convert the Timeline into a TimelineSummary that's easier to
|
||||||
|
// read and understand.
|
||||||
|
final summary = driver.TimelineSummary.summarize(timeline);
|
||||||
|
|
||||||
|
// Then, write the entire timeline to disk in a json format.
|
||||||
|
// This file can be opened in the Chrome browser's tracing tools
|
||||||
|
// found by navigating to chrome://tracing.
|
||||||
|
// Optionally, save the summary to disk by setting includeSummary
|
||||||
|
// to true
|
||||||
|
await summary.writeTimelineToFile(
|
||||||
|
'dialog_opening_timeline',
|
||||||
|
pretty: true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
9
test_driver/test_driver.md
Normal file
9
test_driver/test_driver.md
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
Trace actions
|
||||||
|
```console
|
||||||
|
flutter drive \
|
||||||
|
--driver=test_driver/performance_driver.dart \
|
||||||
|
--target=integration_test/widget_dialog_animated_test.dart \
|
||||||
|
--profile \
|
||||||
|
--flavor=dev \
|
||||||
|
--no-dds
|
||||||
|
```
|
Loading…
Reference in a new issue