Skip to content

Commit 80c9b87

Browse files
authored
[MOB-10374] Add E2E tests with Captain (#285)
* Remove native Android and iOS E2E tests * Add bug reporting E2E tests with Captain * Migrate CI to Appium and Captain * Fix .NET install in `test_android` job * Clone Captain using SSH on CI * Fix work dir for Android build and test commands * Fix E2E Android APK * Fix Android E2E test working directory * Separate unit test jobs from E2E test ones * Revert "Remove native Android and iOS E2E tests" This reverts commit 6fd77e2. * Return Espresso & XCUITest tests * Upscale `e2e_ios_captain` macOS machine to large * Update E2E dependencies * Move E2E tests to root directory
1 parent 3f697a4 commit 80c9b87

File tree

6 files changed

+643
-19
lines changed

6 files changed

+643
-19
lines changed

.circleci/config.yml

+93-19
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,25 @@ orbs:
44
android: circleci/[email protected]
55
flutter: circleci/[email protected]
66

7+
commands:
8+
setup_flutter:
9+
steps:
10+
- flutter/install_sdk_and_pub:
11+
flutter_version: 3.3.0
12+
- run:
13+
name: Generate Pigeons
14+
command: sh ./scripts/pigeon.sh
15+
setup_ios:
16+
steps:
17+
- setup_flutter
18+
- run:
19+
name: Install CocoaPods
20+
command: sudo gem install cocoapods
21+
- run:
22+
name: Install Pods
23+
working_directory: example/ios
24+
command: pod install --repo-update
25+
726
jobs:
827
danger:
928
docker:
@@ -39,11 +58,7 @@ jobs:
3958
tag: 2022.04.1
4059
steps:
4160
- checkout
42-
- flutter/install_sdk_and_pub:
43-
flutter_version: 3.3.0
44-
- run:
45-
name: Generate Pigeons
46-
command: sh ./scripts/pigeon.sh
61+
- setup_flutter
4762
- android/start-emulator-and-run-tests:
4863
system-image: system-images;android-30;google_apis;x86
4964
additional-avd-args: -d "Nexus 5"
@@ -54,23 +69,47 @@ jobs:
5469
working-directory: example/android
5570
test-command: ./gradlew test
5671

57-
ios_tests:
58-
macos:
59-
xcode: 13.4.1
72+
e2e_android_captain:
73+
executor:
74+
name: android/android-machine
75+
resource-class: xlarge
76+
tag: 2022.04.1
6077
steps:
6178
- checkout
62-
- flutter/install_sdk_and_pub:
63-
flutter_version: 3.3.0
6479
- run:
65-
name: Generate Pigeons
66-
command: sh ./scripts/pigeon.sh
80+
name: Install Appium
81+
command: npm install -g appium
6782
- run:
68-
name: Install CocoaPods
69-
command: sudo gem install cocoapods
83+
name: Launch Appium
84+
command: appium
85+
background: true
86+
- setup_flutter
7087
- run:
71-
name: Install Pods
72-
working_directory: example/ios
73-
command: pod install --repo-update
88+
name: Add Microsoft Packages to APT
89+
command: |
90+
wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
91+
sudo dpkg -i packages-microsoft-prod.deb
92+
rm packages-microsoft-prod.deb
93+
- run:
94+
name: Install .NET
95+
command: |
96+
sudo apt-get update
97+
sudo apt-get install -y dotnet-sdk-6.0
98+
- run:
99+
name: Clone Captain
100+
command: git clone [email protected]:Instabug/Captain.git ../Instabug.Captain
101+
- android/start-emulator-and-run-tests:
102+
system-image: system-images;android-30;google_apis;x86
103+
additional-avd-args: -d "Nexus 5"
104+
post-emulator-launch-assemble-command: cd example || true && flutter build apk --debug
105+
test-command: cd e2e && CAPTAIN_PLATFORM=android dotnet test
106+
107+
test_ios:
108+
macos:
109+
xcode: 13.4.1
110+
steps:
111+
- checkout
112+
- setup_ios
74113
- run:
75114
name: Build and run tests
76115
working_directory: example/ios
@@ -82,6 +121,37 @@ jobs:
82121
-destination 'name=iPhone 12 Pro Max' \
83122
test | xcpretty
84123
124+
e2e_ios_captain:
125+
macos:
126+
xcode: 13.4.1
127+
resource_class: large
128+
steps:
129+
- checkout
130+
- run:
131+
name: Install Appium
132+
command: npm install -g appium
133+
- run:
134+
name: Launch Appium
135+
command: appium
136+
background: true
137+
- setup_ios
138+
- run:
139+
name: Build Example App
140+
working_directory: example
141+
command: flutter build ios --simulator
142+
- run:
143+
name: Install .NET
144+
command: brew install --cask dotnet-sdk
145+
- run:
146+
name: Clone Captain
147+
command: git clone [email protected]:Instabug/Captain.git ../Instabug.Captain
148+
- run:
149+
name: Run E2E Tests
150+
working_directory: e2e
151+
command: dotnet test
152+
environment:
153+
CAPTAIN_PLATFORM: ios
154+
85155
format_flutter:
86156
docker:
87157
- image: cirrusci/flutter
@@ -158,7 +228,9 @@ workflows:
158228
version: 2.10.5
159229
coverage: false
160230
- test_android
161-
- ios_tests
231+
- e2e_android_captain
232+
- test_ios
233+
- e2e_ios_captain
162234
- format_flutter
163235
- lint_flutter:
164236
requires:
@@ -173,7 +245,9 @@ workflows:
173245
- test_flutter-stable
174246
- test_flutter-2.10.5
175247
- test_android
176-
- ios_tests
248+
- e2e_android_captain
249+
- test_ios
250+
- e2e_ios_captain
177251
- verify_pub
178252
filters:
179253
branches:

.pubignore

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Generated files
22
*.mocks.dart
33

4+
# E2E tests
5+
e2e/
6+
47
# Miscellaneous
58
*.class
69
*.log

0 commit comments

Comments
 (0)