-
Notifications
You must be signed in to change notification settings - Fork 32
165 lines (139 loc) · 4.66 KB
/
flutter_emulator_tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: Build and Test Flutter App
on:
push:
branches:
- main
- automated-tests
pull_request:
branches:
- main
jobs:
build-test-android:
name: Build and Test Flutter App on Android
runs-on: ubuntu-latest
defaults:
run:
working-directory: packages/passkeys/passkeys/example
steps:
# Step 1: Checkout the code
- name: Checkout Code
uses: actions/checkout@v4
# Step 2: Set up Flutter
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.27.1'
# Step 3: Install Node.js (for Appium)
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
# Step 4: Install Appium and Dependencies
- name: Install Appium and Test Dependencies
run: |
npm install -g appium
appium driver install --source=npm appium-flutter-driver
appium driver install uiautomator2
appium driver install --source npm appium-flutter-integration-driver
# Step 5: Install Flutter Dependencies
- name: Install Flutter Dependencies
run: |
flutter pub get
# Step 6: Set up Java (Java 17)
- name: Setup Java 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
# Step 7: Start Appium
- name: Start Appium Server
run: |
appium > appium.log 2>&1 &
# Step 7: Start the Emulator & run the tests
- name: Set Up Android Emulator & Run Tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 29
target: google_apis
arch: x86_64
profile: Nexus 5
script: |
adb shell input keyevent 82 &
flutter --version
cd packages/passkeys/passkeys/example && flutter build apk --debug --dart-define=CORBADO_PROJECT_ID=pro-8751299119685489253 && adb install -r build/app/outputs/flutter-apk/app-debug.apk
cd packages/passkeys/passkeys/example/tests && npm i && node main.js android
#Print Appium Logs (if tests fail)
- name: Print Appium Logs
if: failure()
run: |
echo "Printing Appium logs..."
cat appium.log
build-test-ios:
name: Build and Test Flutter App on iOS
runs-on: macos-latest
defaults:
run:
working-directory: packages/passkeys/passkeys/example
steps:
# Step 1: Checkout the code
- name: Checkout Code
uses: actions/checkout@v3
# Step 2: Set up Flutter
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.27.1'
# Step 3: Install Node.js (for Appium)
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
# Step 4: Install Appium and Dependencies
- name: Install Appium and Test Dependencies
run: |
npm install -g appium
appium driver install --source=npm appium-flutter-driver
appium driver install uiautomator2
appium driver install --source npm appium-flutter-integration-driver
# Step 5: Install Flutter Dependencies
- name: Install Flutter Dependencies
run: flutter pub get
# Step 6: Set up Xcode
- name: Set Up Xcode
run: |
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -license accept
# Step 7: Launch the iOS Simulator
- name: Launch iOS Simulator
run: |
xcrun simctl boot "iPhone 16 Pro"
while ! xcrun simctl list devices | grep "iPhone 16 Pro" | grep -q "(Booted)"; do
echo "Simulator is still booting..."
sleep 5
done
xcrun simctl list devices
# Step 8: Build the Flutter App
- name: Build Flutter App
run: |
flutter build ios --no-codesign --simulator --dart-define=CORBADO_PROJECT_ID=pro-8751299119685489253
# Step 9: Install and Launch the App
- name: Install and Launch App
run: |
xcrun simctl install booted build/ios/iphonesimulator/Runner.app
# Step 10: Start Appium Server
- name: Start Appium Server
run: |
nohup appium > appium.log 2>&1 &
sleep 10
# Step 11: Run Tests
- name: Run Appium Tests
run: |
cd tests
npm i
node main.js ios
# Step 12: Print Appium Logs (if tests fail)
- name: Print Appium Logs
if: failure()
run: |
echo "Printing Appium logs..."
cat appium.log