This repository has been archived by the owner on May 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.dart
78 lines (70 loc) · 2.19 KB
/
main.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import 'dart:convert';
import 'dart:io';
import 'package:automated_testing_framework/automated_testing_framework.dart';
import 'package:automated_testing_framework_example/automated_testing_framework_example.dart';
import 'package:automated_testing_framework_plugin_flow_control/automated_testing_framework_plugin_flow_control.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:logging/logging.dart';
void main() async {
Logger.root.level = Level.ALL;
Logger.root.onRecord.listen((record) {
// ignore: avoid_print
print('${record.level.name}: ${record.time}: ${record.message}');
if (record.error != null) {
// ignore: avoid_print
print('${record.error}');
}
if (record.stackTrace != null) {
// ignore: avoid_print
print('${record.stackTrace}');
}
});
WidgetsFlutterBinding.ensureInitialized();
TestFlowControlHelper.registerTestSteps();
var gestures = TestableGestures();
if (kIsWeb ||
Platform.isFuchsia ||
Platform.isLinux ||
Platform.isMacOS ||
Platform.isWindows) {
gestures = TestableGestures(
widgetLongPress: null,
widgetSecondaryLongPress: TestableGestureAction.open_test_actions_page,
widgetSecondaryTap: TestableGestureAction.open_test_actions_dialog,
);
}
final allTests = List<String>.from(
json.decode(
await rootBundle.loadString(
'assets/all_tests.json',
),
),
);
allTests.addAll(
List<String>.from(
json.decode(
await rootBundle.loadString(
'packages/automated_testing_framework_example/assets/all_tests.json',
),
),
),
);
runApp(App(
options: TestExampleOptions(
autorun: kProfileMode,
enabled: true,
gestures: gestures,
testReader: AssetTestStore(testAssets: allTests).testReader,
testWidgetsEnabled: true,
testWriter: ClipboardTestStore.testWriter,
variables: {
'fun42': (_, __) async => 42,
'funDelayed': (_, __) async {
await Future.delayed(const Duration(seconds: 5));
return 'delayed';
}
}),
));
}