File tree 4 files changed +100
-7
lines changed
4 files changed +100
-7
lines changed Original file line number Diff line number Diff line change
1
+ name : flutter integration tests
2
+ on :
3
+ push :
4
+ branches :
5
+ - main
6
+ pull_request :
7
+
8
+ jobs :
9
+ test :
10
+ runs-on : macos-10.15
11
+ defaults :
12
+ run :
13
+ working-directory : ./flutter/example
14
+ strategy :
15
+ matrix :
16
+ sdk : ['stable', 'beta']
17
+ steps :
18
+ - name : checkout
19
+ uses : actions/checkout@v3
20
+
21
+ - uses : actions/setup-java@v3
22
+ with :
23
+ distribution : ' adopt'
24
+ java-version : ' 8'
25
+
26
+ - uses : subosito/flutter-action@v2
27
+ with :
28
+ channel : ${{ matrix.sdk }}
29
+
30
+ - name : flutter upgrade
31
+ run : flutter upgrade
32
+
33
+ - name : flutter pub get
34
+ run : flutter pub get
35
+
36
+ - name : launch ios emulator
37
+ uses : futureware-tech/simulator-action@v1
38
+ with :
39
+ model : ' iPhone 8'
40
+ os_version : ' 14.4'
41
+
42
+ - name : run ios integration test
43
+ run : flutter test integration_test/launch_test.dart
44
+
45
+ - name : launch android emulator & run android integration test
46
+ uses : reactivecircus/android-emulator-runner@v2
47
+ with :
48
+ working-directory : ./flutter/example
49
+ api-level : 21
50
+ arch : x86_64
51
+ profile : Nexus 6
52
+ script : flutter test integration_test/launch_test.dart
53
+
54
+
Original file line number Diff line number Diff line change
1
+ import 'package:flutter/widgets.dart' ;
2
+ import 'package:flutter_test/flutter_test.dart' ;
3
+ import 'package:integration_test/integration_test.dart' ;
4
+ import 'package:sentry_flutter/sentry_flutter.dart' ;
5
+ import 'package:sentry_flutter_example/main.dart' ;
6
+
7
+ void main () {
8
+
9
+ final binding = IntegrationTestWidgetsFlutterBinding .ensureInitialized ();
10
+ binding.framePolicy = LiveTestWidgetsFlutterBindingFramePolicy .fullyLive;
11
+
12
+ testWidgets ('setup sentry and render app' , (tester) async {
13
+
14
+ await setupSentry (
15
+ () async {
16
+ await tester.pumpWidget (
17
+ DefaultAssetBundle (
18
+ bundle: SentryAssetBundle (enableStructuredDataTracing: true ),
19
+ child: MyApp (),
20
+ )
21
+ );
22
+ await tester.pumpAndSettle ();
23
+ }
24
+ );
25
+
26
+ // Find any UI element and verify it is present.
27
+ expect (find.text ('Open another Scaffold' ), findsOneWidget);
28
+ });
29
+ }
Original file line number Diff line number Diff line change @@ -21,8 +21,19 @@ const String _exampleDsn =
21
21
final _channel = const MethodChannel ('example.flutter.sentry.io' );
22
22
23
23
Future <void > main () async {
24
+ await setupSentry (
25
+ () => runApp (
26
+ DefaultAssetBundle (
27
+ bundle: SentryAssetBundle (enableStructuredDataTracing: true ),
28
+ child: MyApp (),
29
+ ),
30
+ )
31
+ );
32
+ }
33
+
34
+ Future <void > setupSentry (AppRunner appRunner) async {
24
35
await SentryFlutter .init (
25
- (options) {
36
+ (options) async {
26
37
options.dsn = _exampleDsn;
27
38
options.tracesSampleRate = 1.0 ;
28
39
options.reportPackages = false ;
@@ -37,12 +48,7 @@ Future<void> main() async {
37
48
options.debug = true ;
38
49
},
39
50
// Init your App.
40
- appRunner: () => runApp (
41
- DefaultAssetBundle (
42
- bundle: SentryAssetBundle (enableStructuredDataTracing: true ),
43
- child: MyApp (),
44
- ),
45
- ),
51
+ appRunner: appRunner,
46
52
);
47
53
}
48
54
Original file line number Diff line number Diff line change @@ -24,6 +24,10 @@ dependencies:
24
24
dev_dependencies :
25
25
pedantic : ^1.11.1
26
26
sentry_dart_plugin : ^1.0.0-alpha.4
27
+ integration_test :
28
+ sdk : flutter
29
+ flutter_test :
30
+ sdk : flutter
27
31
28
32
dependency_overrides :
29
33
sentry :
You can’t perform that action at this time.
0 commit comments