Skip to content

Commit 3383c5d

Browse files
tune ios tests
1 parent f100ad1 commit 3383c5d

File tree

3 files changed

+20
-14
lines changed

3 files changed

+20
-14
lines changed

.github/workflows/functional-test.yml

Lines changed: 7 additions & 3 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:
@@ -239,6 +240,7 @@ jobs:
239240
IPHONE_MODEL: iPhone 16
240241
FLUTTER_ANDROID_APP: "https://github.com/AppiumTestDistribution/appium-flutter-server/releases/latest/download/app-debug.apk"
241242
FLUTTER_IOS_APP: "https://github.com/AppiumTestDistribution/appium-flutter-server/releases/latest/download/ios.zip"
243+
PREBUILT_WDA_PATH: ${{ github.workspace }}/wda/WebDriverAgentRunner-Runner.app
242244

243245
steps:
244246

@@ -300,7 +302,7 @@ jobs:
300302
api-level: ${{ env.API_LEVEL }}
301303
script: |
302304
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
305+
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
304306
target: default
305307
disable-spellchecker: true
306308
disable-animations: true
@@ -332,8 +334,8 @@ jobs:
332334
run: |
333335
npm install --location=global appium
334336
appium driver install xcuitest
337+
appium driver run xcuitest download-wda-sim --platform=ios --outdir=$(dirname "$PREBUILT_WDA_PATH")
335338
appium driver install appium-flutter-integration-driver --source npm
336-
appium driver run xcuitest build-wda
337339
338340
- name: Start Appium server for iOS
339341
if: matrix.e2e-tests == 'flutter-ios'
@@ -349,9 +351,11 @@ jobs:
349351
run: |
350352
make install-uv
351353
export PLATFORM=ios
352-
uv run pytest test/functional/flutter_integration/*_test.py \
354+
uv run pytest -v test/functional/flutter_integration/*_test.py \
353355
--doctest-modules \
354356
--junitxml=junit/test-results.xml \
355357
--cov=com \
356358
--cov-report=xml \
357359
--cov-report=html
360+
env:
361+
LOCAL_PREBUILT_WDA: ${{ env.PREBUILT_WDA_PATH }}

test/functional/flutter_integration/helper/options.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@
1919
from test.functional.test_helper import get_wda_port, get_worker_info
2020

2121

22-
def PATH(p: str) -> str:
23-
"""Get the absolute path of a file relative to the folder where this file is located."""
24-
return os.path.abspath(os.path.join(os.path.dirname(__file__), p))
25-
26-
2722
def is_platform_android() -> bool:
2823
"""Check if the current platform is Android."""
2924
return os.getenv('PLATFORM', 'android').lower() == 'android'
@@ -55,22 +50,30 @@ def make_options() -> FlutterOptions:
5550
'newCommandTimeout': 120,
5651
'uiautomator2ServerInstallTimeout': 120000,
5752
'adbExecTimeout': 120000,
58-
'app': os.getenv('FLUTTER_ANDROID_APP'),
53+
'app': os.environ['FLUTTER_ANDROID_APP'],
5954
'autoGrantPermissions': True,
6055
}
6156
if is_platform_android()
6257
else {
6358
'deviceName': device_name(),
6459
'platformName': 'iOS',
65-
'platformVersion': os.getenv('IOS_VERSION'),
60+
'platformVersion': os.environ['IOS_VERSION'],
6661
'allowTouchIdEnroll': True,
6762
'wdaLaunchTimeout': 240000,
6863
'wdaLocalPort': get_wda_port(),
6964
'eventTimings': True,
70-
'app': os.getenv('FLUTTER_IOS_APP'),
65+
'app': os.environ['FLUTTER_IOS_APP'],
7166
}
7267
)
7368

69+
if local_prebuilt_wda := os.getenv('LOCAL_PREBUILT_WDA'):
70+
caps.update(
71+
{
72+
'usePreinstalledWDA': True,
73+
'prebuiltWDAPath': local_prebuilt_wda,
74+
}
75+
)
76+
7477
return options.load_capabilities(caps)
7578

7679

@@ -82,7 +85,7 @@ def device_name() -> str:
8285
if is_platform_android():
8386
prefix = 'Android Emulator'
8487
else:
85-
prefix = os.getenv('IPHONE_MODEL') or 'iPhone 15 Plus'
88+
prefix = os.environ['IPHONE_MODEL']
8689

8790
worker_info = get_worker_info()
8891

test/functional/ios/helper/options.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ def make_options(app: Optional[str] = None) -> XCUITestOptions:
3838
if app is not None:
3939
options.app = PATH(os.path.join('..', '..', '..', 'apps', app))
4040

41-
local_prebuilt_wda = os.getenv('LOCAL_PREBUILT_WDA')
42-
if local_prebuilt_wda:
41+
if local_prebuilt_wda := os.getenv('LOCAL_PREBUILT_WDA'):
4342
options.use_preinstalled_wda = True
4443
options.prebuilt_wda_path = local_prebuilt_wda
4544

0 commit comments

Comments
 (0)