File tree 4 files changed +90
-7
lines changed
4 files changed +90
-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-latest
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 android emulator & run android integration test
37
+ uses : reactivecircus/android-emulator-runner@d7b53ddc6e44254e1f4cf4a6ad67345837027a66
38
+ with :
39
+ working-directory : ./flutter/example
40
+ api-level : 21
41
+ arch : x86_64
42
+ profile : Nexus 6
43
+ script : flutter test integration_test/launch_test.dart
44
+
45
+ - name : launch ios emulator
46
+ uses : futureware-tech/simulator-action@3899fc55d5bf1b24285a746651728263187ce9f5
47
+ with :
48
+ model : ' iPhone 8'
49
+ os_version : ' 15.2'
50
+
51
+ - name : run ios integration test
52
+ run : flutter test integration_test/launch_test.dart
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
+ final binding = IntegrationTestWidgetsFlutterBinding .ensureInitialized ();
9
+ binding.framePolicy = LiveTestWidgetsFlutterBindingFramePolicy .fullyLive;
10
+
11
+ testWidgets ('setup sentry and render app' , (tester) async {
12
+ await setupSentry (() async {
13
+ await tester.pumpWidget (DefaultAssetBundle (
14
+ bundle: SentryAssetBundle (enableStructuredDataTracing: true ),
15
+ child: MyApp (),
16
+ ));
17
+ await tester.pumpAndSettle ();
18
+ });
19
+
20
+ // Find any UI element and verify it is present.
21
+ expect (find.text ('Open another Scaffold' ), findsOneWidget);
22
+ });
23
+ }
Original file line number Diff line number Diff line change @@ -21,8 +21,17 @@ const String _exampleDsn =
21
21
final _channel = const MethodChannel ('example.flutter.sentry.io' );
22
22
23
23
Future <void > main () async {
24
+ await setupSentry (() => runApp (
25
+ DefaultAssetBundle (
26
+ bundle: SentryAssetBundle (enableStructuredDataTracing: true ),
27
+ child: MyApp (),
28
+ ),
29
+ ));
30
+ }
31
+
32
+ Future <void > setupSentry (AppRunner appRunner) async {
24
33
await SentryFlutter .init (
25
- (options) {
34
+ (options) async {
26
35
options.dsn = _exampleDsn;
27
36
options.tracesSampleRate = 1.0 ;
28
37
options.reportPackages = false ;
@@ -37,12 +46,7 @@ Future<void> main() async {
37
46
options.debug = true ;
38
47
},
39
48
// Init your App.
40
- appRunner: () => runApp (
41
- DefaultAssetBundle (
42
- bundle: SentryAssetBundle (enableStructuredDataTracing: true ),
43
- child: MyApp (),
44
- ),
45
- ),
49
+ appRunner: appRunner,
46
50
);
47
51
}
48
52
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