Skip to content

Commit ed27b1f

Browse files
test: Update flutter tests to canonic pytest format (#1179)
1 parent 3677e0c commit ed27b1f

File tree

9 files changed

+400
-318
lines changed

9 files changed

+400
-318
lines changed

.github/workflows/functional-test.yml

Lines changed: 53 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ concurrency:
1313
env:
1414
APPIUM_TEST_SERVER_PORT: '4723'
1515
APPIUM_TEST_SERVER_HOST: '127.0.0.1'
16+
PYTHONUNBUFFERED: 1
1617

1718
jobs:
1819
ios_test:
@@ -46,20 +47,11 @@ jobs:
4647
with:
4748
xcode-version: ${{ env.XCODE_VERSION }}
4849

49-
- run: defaults write com.apple.iphonesimulator PasteboardAutomaticSync -bool false
50-
51-
- name: Prepare iOS simulator
52-
uses: futureware-tech/simulator-action@v4
53-
with:
54-
model: ${{ env.IPHONE_MODEL }}
55-
os_version: ${{ env.IOS_VERSION }}
56-
wait_for_boot: true
57-
shutdown_after_job: false
58-
5950
- name: Install Appium and drivers
6051
run: |
6152
npm install -g appium
6253
appium driver install xcuitest
54+
appium driver run xcuitest download-wda-sim --platform=ios --outdir=$(dirname "$PREBUILT_WDA_PATH")
6355
6456
- name: Start Appium server
6557
uses: ./.github/actions/setup-appium-server
@@ -68,9 +60,20 @@ jobs:
6860
host: ${{ env.APPIUM_TEST_SERVER_HOST }}
6961
server_args: '--relaxed-security'
7062

71-
- name: Downloading prebuilt WDA
63+
- name: Start iOS Simulator UI
7264
run: |
73-
appium driver run xcuitest download-wda-sim --platform=ios --outdir=$(dirname "$PREBUILT_WDA_PATH")
65+
defaults write com.apple.iphonesimulator PasteboardAutomaticSync -bool false
66+
open -Fn "$(xcode-select --print-path)/Applications/Simulator.app"
67+
- name: Prepare iOS simulator
68+
uses: futureware-tech/simulator-action@v4
69+
with:
70+
model: ${{ env.IPHONE_MODEL }}
71+
os_version: ${{ env.IOS_VERSION }}
72+
wait_for_boot: true
73+
shutdown_after_job: false
74+
75+
- name: Finalize iOS simulator boot
76+
run: xcrun --sdk iphonesimulator --show-sdk-version
7477

7578
- name: Set up Python
7679
uses: actions/setup-python@v5
@@ -92,7 +95,7 @@ jobs:
9295

9396
- name: Run Tests
9497
run: |
95-
uv run pytest ${{ matrix.test_targets.target}} \
98+
uv run pytest -v ${{ matrix.test_targets.target}} \
9699
--doctest-modules \
97100
--junitxml=junit/test-results.xml \
98101
--cov=com \
@@ -164,7 +167,7 @@ jobs:
164167
~/.android/avd/*
165168
~/.android/adb*
166169
key: avd-${{ env.API_LEVEL }}
167-
- name: create AVD and generate snapshot for caching
170+
- name: Create AVD and generate snapshot for caching
168171
if: steps.avd-cache.outputs.cache-hit != 'true'
169172
uses: reactivecircus/android-emulator-runner@v2
170173
with:
@@ -191,14 +194,14 @@ jobs:
191194
restore-keys: |
192195
${{ runner.os }}-uv-shared-
193196
194-
- name: run tests
197+
- name: Run tests
195198
uses: reactivecircus/android-emulator-runner@v2
196199
with:
197200
api-level: ${{ env.API_LEVEL }}
198201
arch: ${{ env.ARCH }}
199202
script: |
200203
make install-uv
201-
uv run pytest ${{ matrix.test_targets.target}} --doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html
204+
uv run pytest -v ${{ matrix.test_targets.target}} --doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html
202205
target: google_apis
203206
profile: Nexus 5X
204207
disable-spellchecker: true
@@ -239,6 +242,7 @@ jobs:
239242
IPHONE_MODEL: iPhone 16
240243
FLUTTER_ANDROID_APP: "https://github.com/AppiumTestDistribution/appium-flutter-server/releases/latest/download/app-debug.apk"
241244
FLUTTER_IOS_APP: "https://github.com/AppiumTestDistribution/appium-flutter-server/releases/latest/download/ios.zip"
245+
PREBUILT_WDA_PATH: ${{ github.workspace }}/wda/WebDriverAgentRunner-Runner.app
242246

243247
steps:
244248

@@ -267,21 +271,34 @@ jobs:
267271
with:
268272
node-version: 'lts/*'
269273

274+
- name: Select Xcode
275+
if: matrix.e2e-tests == 'flutter-ios'
276+
uses: maxim-lobanov/setup-xcode@v1
277+
with:
278+
xcode-version: ${{ env.XCODE_VERSION }}
279+
270280
- name: Install Appium and drivers
271281
if: matrix.e2e-tests == 'flutter-android'
272282
run: |
273283
npm install --location=global appium
274284
appium driver install uiautomator2
275285
appium driver install appium-flutter-integration-driver --source npm
276286
277-
- name: Start Appium server for Android
278-
if: matrix.e2e-tests == 'flutter-android'
287+
- name: Install Appium and drivers
288+
if: matrix.e2e-tests == 'flutter-ios'
289+
run: |
290+
npm install --location=global appium
291+
appium driver install xcuitest
292+
appium driver run xcuitest download-wda-sim --platform=ios --outdir=$(dirname "$PREBUILT_WDA_PATH")
293+
appium driver install appium-flutter-integration-driver --source npm
294+
295+
- name: Start Appium server
279296
uses: ./.github/actions/setup-appium-server
280297
with:
281298
port: ${{ env.APPIUM_TEST_SERVER_PORT }}
282299
host: ${{ env.APPIUM_TEST_SERVER_HOST }}
283300
server_args: '--relaxed-security'
284-
log_file: 'appium_flutter_android.log'
301+
log_file: appium-${{ matrix.e2e-tests }}.log
285302

286303
- name: Cache uv modules
287304
uses: actions/cache@v4
@@ -300,23 +317,16 @@ jobs:
300317
api-level: ${{ env.API_LEVEL }}
301318
script: |
302319
make install-uv
303-
uv run pytest test/functional/flutter_integration/*_test.py --doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html
320+
uv run pytest -v test/functional/flutter_integration/*_test.py --doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html
304321
target: default
305322
disable-spellchecker: true
306323
disable-animations: true
307324

308-
- name: Save server output
309-
if: always() && matrix.e2e-tests == 'flutter-android'
310-
uses: actions/upload-artifact@master
311-
with:
312-
name: appium-flutter-android.log
313-
path: appium_flutter_android.log
314-
315-
- name: Select Xcode
325+
- name: Start iOS Simulator UI
316326
if: matrix.e2e-tests == 'flutter-ios'
317-
uses: maxim-lobanov/setup-xcode@v1
318-
with:
319-
xcode-version: ${{ env.XCODE_VERSION }}
327+
run: |
328+
defaults write com.apple.iphonesimulator PasteboardAutomaticSync -bool false
329+
open -Fn "$(xcode-select --print-path)/Applications/Simulator.app"
320330
321331
- uses: futureware-tech/simulator-action@v4
322332
if: matrix.e2e-tests == 'flutter-ios'
@@ -327,31 +337,27 @@ jobs:
327337
wait_for_boot: true
328338
shutdown_after_job: false
329339

330-
- name: Install Appium and drivers
331-
if: matrix.e2e-tests == 'flutter-ios'
332-
run: |
333-
npm install --location=global appium
334-
appium driver install xcuitest
335-
appium driver install appium-flutter-integration-driver --source npm
336-
appium driver run xcuitest build-wda
337-
338-
- name: Start Appium server for iOS
340+
- name: Finalize iOS simulator boot
339341
if: matrix.e2e-tests == 'flutter-ios'
340-
uses: ./.github/actions/setup-appium-server
341-
with:
342-
port: ${{ env.APPIUM_TEST_SERVER_PORT }}
343-
host: ${{ env.APPIUM_TEST_SERVER_HOST }}
344-
server_args: '--relaxed-security'
345-
log_file: 'appium_ios.log'
342+
run: xcrun --sdk iphonesimulator --show-sdk-version
346343

347344
- name: Run IOS tests
348345
if: matrix.e2e-tests == 'flutter-ios'
349346
run: |
350347
make install-uv
351348
export PLATFORM=ios
352-
uv run pytest test/functional/flutter_integration/*_test.py \
349+
uv run pytest -v test/functional/flutter_integration/*_test.py \
353350
--doctest-modules \
354351
--junitxml=junit/test-results.xml \
355352
--cov=com \
356353
--cov-report=xml \
357354
--cov-report=html
355+
env:
356+
LOCAL_PREBUILT_WDA: ${{ env.PREBUILT_WDA_PATH }}
357+
358+
- name: Save server output
359+
if: ${{ always() }}
360+
uses: actions/upload-artifact@master
361+
with:
362+
name: appium-${{ matrix.e2e-tests }}.log
363+
path: appium-${{ matrix.e2e-tests }}.log

0 commit comments

Comments
 (0)