Skip to content

Commit a90a5b7

Browse files
Squashed commit of the following:
commit fe8b5a5 Author: Ahmed alaa <[email protected]> Date: Fri Jul 25 17:03:06 2025 +0300 fix: dart format commit 4a2305c Author: Ahmed alaa <[email protected]> Date: Fri Jul 25 16:40:50 2025 +0300 fix: dart format commit 6ff064e Author: Ahmed alaa <[email protected]> Date: Fri Jul 25 16:39:32 2025 +0300 fix: dart format commit 7d2daf6 Author: Ahmed alaa <[email protected]> Date: Fri Jul 25 16:37:35 2025 +0300 fix: dart format commit efb1d16 Author: Ahmed alaa <[email protected]> Date: Fri Jul 25 16:13:42 2025 +0300 fix: dart format commit fb8eb6b Author: Ahmed alaa <[email protected]> Date: Fri Jul 25 15:33:07 2025 +0300 fix: dart format commit 8c45834 Author: Ahmed alaa <[email protected]> Date: Fri Jul 25 15:09:35 2025 +0300 fix: dart format commit 8cb7446 Author: Ahmed alaa <[email protected]> Date: Fri Jul 25 07:24:06 2025 +0300 fix: dart format commit e7b8223 Author: Ahmed alaa <[email protected]> Date: Fri Jul 25 06:52:01 2025 +0300 fix: dart format commit eb7894e Author: Ahmed alaa <[email protected]> Date: Fri Jul 25 06:22:54 2025 +0300 fix: dart format commit 10f8af4 Author: Ahmed alaa <[email protected]> Date: Fri Jul 25 06:17:55 2025 +0300 fix: dart format commit 0c95d93 Author: Ahmed alaa <[email protected]> Date: Fri Jul 25 06:14:08 2025 +0300 fix: dart format commit 1120ad3 Author: Ahmed alaa <[email protected]> Date: Fri Jul 25 05:54:23 2025 +0300 fix: dart format commit 28845a9 Author: Ahmed alaa <[email protected]> Date: Fri Jul 25 05:51:55 2025 +0300 fix: dart format commit fb44dcc Author: Ahmed alaa <[email protected]> Date: Fri Jul 25 05:50:48 2025 +0300 fix: dart format commit bb4dd19 Author: Ahmed alaa <[email protected]> Date: Fri Jul 25 05:37:54 2025 +0300 fix: dart format commit 83e79a2 Author: Ahmed alaa <[email protected]> Date: Fri Jul 25 05:35:42 2025 +0300 fix: dart format commit 76aaa64 Author: Ahmed alaa <[email protected]> Date: Fri Jul 25 05:28:41 2025 +0300 fix: dart format commit 7b8d542 Author: Ahmed alaa <[email protected]> Date: Fri Jul 25 05:02:00 2025 +0300 fix: dart format commit 8767b88 Author: Ahmed alaa <[email protected]> Date: Fri Jul 25 04:46:32 2025 +0300 fix: dart format commit 46cc570 Author: Ahmed alaa <[email protected]> Date: Fri Jul 25 04:34:10 2025 +0300 fix: dart format commit c7edf00 Author: Ahmed alaa <[email protected]> Date: Fri Jul 25 04:20:25 2025 +0300 fix: dart format commit 18c20b4 Author: Ahmed alaa <[email protected]> Date: Fri Jul 25 04:01:37 2025 +0300 fix: dart format commit ae0fd58 Author: Ahmed alaa <[email protected]> Date: Fri Jul 25 04:00:18 2025 +0300 fix: dart format commit f78c6ad Author: Ahmed alaa <[email protected]> Date: Fri Jul 25 03:40:09 2025 +0300 fix: dart format commit b6e6840 Author: Ahmed alaa <[email protected]> Date: Fri Jul 25 03:08:07 2025 +0300 fix: dart format commit 8764567 Author: Ahmed alaa <[email protected]> Date: Fri Jul 25 03:04:46 2025 +0300 fix: dart format commit aa369c0 Author: Ahmed alaa <[email protected]> Date: Fri Jul 25 02:46:43 2025 +0300 fix: dart format commit 111884a Author: Ahmed alaa <[email protected]> Date: Fri Jul 25 02:18:20 2025 +0300 fix: dart format commit 6ad5486 Author: Ahmed alaa <[email protected]> Date: Fri Jul 25 01:49:27 2025 +0300 fix: dart format commit 9b150d6 Author: Ahmed alaa <[email protected]> Date: Fri Jul 25 01:40:59 2025 +0300 fix: dart format commit 4836a62 Author: Ahmed alaa <[email protected]> Date: Fri Jul 25 01:32:21 2025 +0300 fix: dart format commit 0ff5f6d Author: Ahmed alaa <[email protected]> Date: Fri Jul 25 01:27:43 2025 +0300 fix: dart format commit c71fcba Author: Ahmed alaa <[email protected]> Date: Fri Jul 25 01:23:46 2025 +0300 fix: dart format commit fe231f3 Author: Ahmed alaa <[email protected]> Date: Fri Jul 25 01:19:57 2025 +0300 fix: dart format commit 8abdc23 Author: Ahmed alaa <[email protected]> Date: Fri Jul 25 01:04:28 2025 +0300 fix: dart format commit 98d2659 Author: Ahmed alaa <[email protected]> Date: Fri Jul 25 00:24:48 2025 +0300 fix: dart format
1 parent dd69dcc commit a90a5b7

File tree

20 files changed

+896
-127
lines changed

20 files changed

+896
-127
lines changed

.circleci/config.yml

Lines changed: 89 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ version: 2.1
22

33
orbs:
44
android: circleci/[email protected]
5-
flutter: circleci/flutter@2.0.2
5+
flutter: circleci/flutter@2.1.0
66
node: circleci/[email protected]
77
advanced-checkout: vsco/[email protected]
8+
ios: circleci/[email protected]
89

910
commands:
1011
setup_flutter:
@@ -17,79 +18,55 @@ commands:
1718
setup_ios:
1819
steps:
1920
# Flutter doesn't support Apple Silicon yet, so we need to install Rosetta use Flutter on M1 machines.
20-
- run:
21-
name: Install Rosetta
22-
command: softwareupdate --install-rosetta --agree-to-license
21+
- ios/install-rosetta
2322
- setup_flutter
2423
- run:
2524
name: Install CocoaPods
2625
command: sudo gem install cocoapods
27-
- run:
28-
name: Install Pods
29-
working_directory: example/ios
30-
command: pod install --repo-update
31-
setup_captain:
32-
parameters:
33-
platform:
34-
type: enum
35-
enum:
36-
- ios
37-
- android
26+
- flutter/install_ios_pod:
27+
app-dir: example
28+
repo-update: true
29+
setup_patrol:
3830
steps:
3931
- run:
40-
name: Install Appium
41-
command: npm install -g appium
42-
- when:
43-
condition:
44-
equal:
45-
- <<parameters.platform>>
46-
- ios
47-
steps:
48-
- run:
49-
name: Install XCUITest Driver
50-
command: appium driver install [email protected]
51-
- when:
52-
condition:
53-
equal:
54-
- <<parameters.platform>>
55-
- android
56-
steps:
57-
- run:
58-
name: Install UIAutomator2 Driver
59-
command: appium driver install [email protected]
60-
- run:
61-
name: Launch Appium
62-
# Enable --relaxed-security for `mobile: shell` command that Captain uses internally.
63-
command: appium --relaxed-security
64-
background: true
65-
- run:
66-
name: Install .NET 6
67-
command: curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel 6.0.1xx
68-
- run:
69-
name: Add .NET to PATH
32+
name: Add pub-cache bin to PATH
7033
command: |
71-
echo 'export DOTNET_ROOT=$HOME/.dotnet' >> $BASH_ENV
72-
echo 'export PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools' >> $BASH_ENV
34+
echo 'export PATH="$PATH:$HOME/.pub-cache/bin"' >> $BASH_ENV
35+
source $BASH_ENV
7336
- run:
74-
name: Clone Captain
75-
command: git clone [email protected]:Instabug/Captain.git ../Instabug.Captain
76-
- run:
77-
name: Configure Captain Platform
78-
command: echo 'export CAPTAIN_PLATFORM=<<parameters.platform>>' >> $BASH_ENV
37+
name: Install patrol
38+
command: dart pub global activate patrol_cli 3.5.0
7939
# This runs `flutter pub get` and `dart pub get` if we pass parameter `generate_pigeons` to the job it also runs the following:
8040
# - `sh ./scripts/pigeon.sh`
8141
# - `dart run build_runner build --delete-conflicting-outputs`
8242
install_flutter_and_dart_packages:
8343
parameters:
8444
generate_pigeons:
8545
type: boolean
46+
remove_patrol:
47+
type: boolean
48+
default: false
49+
version:
50+
type: string
51+
default: "3.24.0"
8652
steps:
53+
- flutter/install_sdk:
54+
version: <<parameters.version>>
55+
- when:
56+
condition:
57+
equal:
58+
- <<parameters.remove_patrol>>
59+
- true
60+
steps:
61+
- run:
62+
name: remove Patrol
63+
command: cd example && dart pub remove patrol
8764
- run:
8865
name: Install Flutter Packages
89-
command: flutter pub get
66+
command: flutter pub get --verbose
9067
- run:
9168
name: Install Dart Packages
92-
command: dart pub get
69+
command: dart pub get --verbose
9370
description: Install Dart Packages (for dart explicit packages)
9471
- when:
9572
condition:
@@ -123,12 +100,21 @@ jobs:
123100
parameters:
124101
version:
125102
type: string
126-
docker:
127-
- image: cirrusci/flutter:<<parameters.version>>
103+
executor:
104+
name: android/android-machine
105+
resource-class: xlarge
106+
tag: 2024.01.1
128107
steps:
129108
- advanced-checkout/shallow-checkout
130109
- install_flutter_and_dart_packages:
131110
generate_pigeons: true
111+
remove_patrol: true
112+
version: <<parameters.version>>
113+
- run:
114+
name: Install lcov
115+
command: |
116+
sudo apt-get update
117+
sudo apt-get install -y lcov
132118
- run: flutter test --coverage
133119
- run:
134120
working_directory: coverage
@@ -150,26 +136,31 @@ jobs:
150136
working-directory: example/android
151137
test-command: ./gradlew test
152138

153-
e2e_android_captain:
139+
e2e_android_patrol:
154140
executor:
155141
name: android/android-machine
156142
resource-class: xlarge
157143
tag: 2024.01.1
158144
steps:
159145
- advanced-checkout/shallow-checkout
160-
- setup_captain:
161-
platform: android
162146
- setup_flutter
163-
- android/start-emulator-and-run-tests:
164-
run-tests-working-directory: e2e
165-
additional-avd-args: --device 3
147+
- setup_patrol
148+
- android/create-avd:
149+
avd-name: 'test'
150+
install: true
166151
system-image: system-images;android-33;default;x86_64
167-
post-emulator-launch-assemble-command: cd example && flutter build apk --debug
168-
test-command: dotnet test
152+
- android/start-emulator:
153+
avd-name: 'test'
154+
post-emulator-launch-assemble-command: ""
155+
- run:
156+
name: Run E2E Tests
157+
no_output_timeout: 30m
158+
working_directory: example
159+
command: patrol test -t integration_test/
169160

170161
test_ios:
171162
macos:
172-
xcode: 15.2.0
163+
xcode: 16.0.0
173164
resource_class: macos.m1.medium.gen1
174165
environment:
175166
INSTABUG_SOURCEMAPS_UPLOAD_DISABLE: true
@@ -185,31 +176,37 @@ jobs:
185176
-scheme Runner \
186177
-resultBundlePath coverage/result.xcresult \
187178
-sdk iphonesimulator \
188-
-destination 'platform=iOS Simulator,name=iPhone 15 Pro Max,OS=17.2' \
179+
-destination 'platform=iOS Simulator,name=iPhone 16 Pro Max,OS=18.0' \
180+
-skip-testing:RunnerUITests \
189181
test | xcpretty
190182
191-
e2e_ios_captain:
183+
e2e_ios_patrol:
192184
macos:
193-
xcode: 15.2.0
185+
xcode: 16.0.0
194186
resource_class: macos.m1.medium.gen1
195187
steps:
196188
- advanced-checkout/shallow-checkout
197-
- setup_captain:
198-
platform: ios
199189
- setup_ios
190+
- setup_patrol
191+
- ios/preboot-simulator:
192+
version: "18.0"
193+
device: "iPhone 16 Pro"
194+
- ios/wait-until-simulator-booted
195+
- ios/wait-until-simulator-booted
200196
- run:
201-
name: Build Example App
202-
working_directory: example
203-
command: flutter build ios --simulator
197+
name: sleep 10 seconds
198+
command: sleep 10
199+
204200
- run:
205201
name: Run E2E Tests
206202
no_output_timeout: 30m
207-
working_directory: e2e
208-
command: dotnet test
209-
203+
working_directory: example
204+
command: patrol test -t integration_test/ --verbose
210205
format_flutter:
211-
docker:
212-
- image: cirrusci/flutter
206+
executor:
207+
name: android/android-machine
208+
resource-class: xlarge
209+
tag: 2024.01.1
213210
steps:
214211
- advanced-checkout/shallow-checkout
215212
- install_flutter_and_dart_packages:
@@ -219,8 +216,10 @@ jobs:
219216
command: dart format . --set-exit-if-changed
220217

221218
lint_flutter:
222-
docker:
223-
- image: cirrusci/flutter
219+
executor:
220+
name: android/android-machine
221+
resource-class: xlarge
222+
tag: 2024.01.1
224223
steps:
225224
- advanced-checkout/shallow-checkout
226225
- install_flutter_and_dart_packages:
@@ -230,8 +229,10 @@ jobs:
230229
command: flutter analyze
231230

232231
verify_pub:
233-
docker:
234-
- image: cirrusci/flutter
232+
executor:
233+
name: android/android-machine
234+
resource-class: xlarge
235+
tag: 2024.01.1
235236
steps:
236237
- advanced-checkout/shallow-checkout
237238
- install_flutter_and_dart_packages:
@@ -243,7 +244,7 @@ jobs:
243244

244245
release:
245246
macos:
246-
xcode: 15.2.0
247+
xcode: 16.0.0
247248
resource_class: macos.m1.medium.gen1
248249
working_directory: "~"
249250
steps:
@@ -288,13 +289,13 @@ workflows:
288289
- test_flutter-stable
289290
- test_flutter:
290291
name: test_flutter-stable
291-
version: stable
292+
version: 3.24.0
292293
- test_flutter:
293294
name: test_flutter-2.10.5
294295
version: 2.10.5
295-
- e2e_android_captain
296+
- e2e_android_patrol
296297
- test_ios
297-
- e2e_ios_captain
298+
- e2e_ios_patrol
298299
- format_flutter
299300
- lint_flutter:
300301
requires:
@@ -312,9 +313,9 @@ workflows:
312313
# TODO: Fix the flaky tests and add the following jobs to the dependencies for the release
313314
# The following jobs have been removed while releasing v13.2.0 to avoid delaying the release
314315
# as they were just flaky and the tests pass locally without issues.
315-
# - e2e_android_captain
316+
# - e2e_android_patrol
316317
# - test_ios
317-
- e2e_ios_captain
318+
- e2e_ios_patrol
318319
- verify_pub
319320
filters:
320321
branches:

example/android/app/build.gradle

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,19 @@ android {
1919
jvmTarget = JavaVersion.VERSION_1_8
2020
}
2121

22+
testOptions {
23+
execution "ANDROIDX_TEST_ORCHESTRATOR"
24+
}
25+
2226
defaultConfig {
2327
applicationId "com.instabug.flutter.example"
2428
minSdkVersion 21
2529
targetSdkVersion 34
2630
versionCode flutter.versionCode
2731
versionName flutter.versionName
28-
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
2932
multiDexEnabled true
33+
testInstrumentationRunner "pl.leancode.patrol.PatrolJUnitRunner"
34+
testInstrumentationRunnerArguments clearPackageData: "true"
3035
}
3136

3237
buildTypes {
@@ -51,6 +56,8 @@ dependencies {
5156
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.20"
5257
implementation 'com.android.support:multidex:1.0.3'
5358
implementation 'org.mockito:mockito-core:1.10.19'
54-
testImplementation 'junit:junit:4.12'
59+
testImplementation 'junit:junit:4.13.2'
5560
testImplementation 'org.mockito:mockito-core:1.10.19'
61+
androidTestUtil "androidx.test:orchestrator:1.5.1"
62+
5663
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package com.instabug.flutter.example;
2+
3+
import androidx.test.platform.app.InstrumentationRegistry;
4+
5+
import com.example.InstabugSample.MainActivity;
6+
7+
import org.junit.Test;
8+
import org.junit.runner.RunWith;
9+
import org.junit.runners.Parameterized;
10+
import org.junit.runners.Parameterized.Parameters;
11+
import pl.leancode.patrol.PatrolJUnitRunner;
12+
13+
@RunWith(Parameterized.class)
14+
public class MainActivityTest {
15+
@Parameters(name = "{0}")
16+
public static Object[] testCases() {
17+
PatrolJUnitRunner instrumentation = (PatrolJUnitRunner) InstrumentationRegistry.getInstrumentation();
18+
// replace "MainActivity.class" with "io.flutter.embedding.android.FlutterActivity.class"
19+
// if in AndroidManifest.xml in manifest/application/activity you have
20+
// android:name="io.flutter.embedding.android.FlutterActivity"
21+
instrumentation.setUp(MainActivity.class);
22+
instrumentation.waitForPatrolAppService();
23+
return instrumentation.listDartTests();
24+
}
25+
26+
public MainActivityTest(String dartTestName) {
27+
this.dartTestName = dartTestName;
28+
}
29+
30+
private final String dartTestName;
31+
32+
@Test
33+
public void runDartTest() {
34+
PatrolJUnitRunner instrumentation = (PatrolJUnitRunner) InstrumentationRegistry.getInstrumentation();
35+
instrumentation.runDartTest(dartTestName);
36+
}
37+
}

example/android/app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
android:networkSecurityConfig="@xml/network_security_config"
1919
android:usesCleartextTraffic="true">
2020
<activity
21-
android:name=".MainActivity"
21+
android:name="com.example.InstabugSample.MainActivity"
2222
android:exported="true"
2323
android:launchMode="singleTop"
2424
android:theme="@style/LaunchTheme"

example/android/app/src/main/kotlin/com/example/InstabugSample/MainActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.instabug.flutter.example
1+
package com.example.InstabugSample
22

33
import com.example.InstabugSample.InstabugExampleMethodCallHandler
44
import com.example.InstabugSample.InstabugExampleMethodCallHandler.Companion.METHOD_CHANNEL_NAME

0 commit comments

Comments
 (0)