Skip to content

Commit 6a40d32

Browse files
denrasemarandaneto
andauthored
Fix flaky iOS integration test (#1524)
Co-authored-by: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com>
1 parent cf67555 commit 6a40d32

File tree

2 files changed

+47
-50
lines changed

2 files changed

+47
-50
lines changed

.github/workflows/flutter_integration_test.yml

Lines changed: 46 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,56 @@ jobs:
2020
test-android:
2121
runs-on: macos-latest
2222
timeout-minutes: 30
23+
defaults:
24+
run:
25+
working-directory: ./flutter/example
26+
strategy:
27+
fail-fast: false
28+
matrix:
29+
sdk: ['stable', 'beta']
30+
steps:
31+
- name: checkout
32+
uses: actions/checkout@v3
33+
34+
- uses: actions/setup-java@v3
35+
with:
36+
distribution: 'adopt'
37+
java-version: '11'
38+
39+
- uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa # pin@v2.10.0
40+
with:
41+
channel: ${{ matrix.sdk }}
42+
43+
- name: flutter upgrade
44+
run: flutter upgrade
45+
46+
- name: flutter pub get
47+
run: flutter pub get
48+
49+
- name: launch android emulator & run android integration test
50+
uses: reactivecircus/android-emulator-runner@50986b1464923454c95e261820bc626f38490ec0 #pin@v2.27.0
51+
with:
52+
working-directory: ./flutter/example
53+
api-level: 21
54+
arch: x86_64
55+
profile: Nexus 6
56+
script: flutter test integration_test/integration_test.dart --verbose
57+
58+
test-ios:
59+
runs-on: macos-13
60+
timeout-minutes: 30
2361
defaults:
2462
run:
2563
working-directory: ./flutter/example
2664
strategy:
2765
fail-fast: false
2866
matrix:
29-
sdk: ['stable', 'beta']
67+
# 'beta' is flaky because of https://github.com/flutter/flutter/issues/124340
68+
sdk: ['stable']
3069
steps:
3170
- name: checkout
3271
uses: actions/checkout@v3
3372

34-
- uses: actions/setup-java@v3
35-
with:
36-
distribution: 'adopt'
37-
java-version: '11'
38-
3973
- uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa # pin@v2.10.0
4074
with:
4175
channel: ${{ matrix.sdk }}
@@ -46,46 +80,10 @@ jobs:
4680
- name: flutter pub get
4781
run: flutter pub get
4882

49-
- name: launch android emulator & run android integration test
50-
uses: reactivecircus/android-emulator-runner@50986b1464923454c95e261820bc626f38490ec0 #pin@v2.27.0
51-
with:
52-
working-directory: ./flutter/example
53-
api-level: 21
54-
arch: x86_64
55-
profile: Nexus 6
56-
script: flutter test integration_test/integration_test.dart --verbose
57-
58-
# Enable after fixing https://github.com/getsentry/sentry-dart/issues/1448
59-
# test-ios:
60-
# runs-on: macos-latest
61-
# timeout-minutes: 30
62-
# defaults:
63-
# run:
64-
# working-directory: ./flutter/example
65-
# strategy:
66-
# fail-fast: false
67-
# matrix:
68-
# # 'beta' is flaky because of https://github.com/flutter/flutter/issues/124340
69-
# sdk: ['stable']
70-
# steps:
71-
# - name: checkout
72-
# uses: actions/checkout@v3
73-
74-
# - uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa # pin@v2.10.0
75-
# with:
76-
# channel: ${{ matrix.sdk }}
77-
78-
# - name: flutter upgrade
79-
# run: flutter upgrade
80-
81-
# - name: flutter pub get
82-
# run: flutter pub get
83-
84-
# - name: launch ios emulator
85-
# uses: futureware-tech/simulator-action@ee05c113b79f056b47f354d7b313555f5491e158 #pin@v2
86-
# with:
87-
# model: 'iPhone 14'
88-
# os_version: '16.2'
83+
- name: launch ios simulator
84+
run: |
85+
simulator_id=$(xcrun simctl create sentryPhone com.apple.CoreSimulator.SimDeviceType.iPhone-14 com.apple.CoreSimulator.SimRuntime.iOS-16-2)
86+
xcrun simctl boot ${simulator_id}
8987
90-
# - name: run ios integration test
91-
# run: flutter test integration_test/integration_test.dart --verbose
88+
- name: run ios integration test
89+
run: flutter test integration_test/integration_test.dart --verbose

flutter/example/integration_test/integration_test.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import 'package:sentry_flutter_example/main.dart';
66
void main() {
77
TestWidgetsFlutterBinding.ensureInitialized();
88

9-
setUp(() async {
9+
tearDown(() async {
1010
await Sentry.close();
1111
});
1212

@@ -18,7 +18,6 @@ void main() {
1818
bundle: SentryAssetBundle(enableStructuredDataTracing: true),
1919
child: const MyApp(),
2020
)));
21-
await tester.pumpAndSettle();
2221
}, 'https://abc@def.ingest.sentry.io/1234567');
2322
}
2423

0 commit comments

Comments
 (0)