Skip to content

Commit 6d21f99

Browse files
committed
ci: Move execution of E2E tests to GitHub Actions
1 parent 9c18b2f commit 6d21f99

File tree

4 files changed

+94
-83
lines changed

4 files changed

+94
-83
lines changed

.azure-templates/bootstrap_steps.yml

-10
This file was deleted.

.github/workflows/gradle.yml

+93-4
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,112 @@ on:
1414
- 'docs/**'
1515
- '*.md'
1616

17+
env:
18+
ANDROID_SDK_VERSION: 28
19+
ANDROID_EMU_NAME: test
20+
XCODE_VERSION: 14.2
21+
IOS_DEVICE_NAME: iPhone 12
22+
IOS_PLATFORM_VERSION: 16.2
23+
1724
jobs:
1825
build:
1926

20-
runs-on: macOS-latest
21-
2227
strategy:
2328
matrix:
24-
java: [ 8, 11, 17 ]
29+
include:
30+
# TODO: add new LTS Java ( 21 ) once it's released
31+
- java: 8
32+
platform: macos-latest
33+
e2e-tests: android
34+
- java: 11
35+
# Need to use specific (not `-latest`) version of macOS to be sure the required version of Xcode/simulator is available
36+
platform: macos-12
37+
e2e-tests: ios
38+
- java: 17
39+
platform: ubuntu-latest
40+
fail-fast: false
41+
42+
runs-on: ${{ matrix.platform }}
2543

26-
name: JDK ${{ matrix.java }}
44+
name: JDK ${{ matrix.java }} - ${{ matrix.platform }}
2745
steps:
2846
- uses: actions/checkout@v3
47+
2948
- name: Set up JDK ${{ matrix.java }}
3049
uses: actions/setup-java@v3
3150
with:
3251
distribution: 'zulu'
3352
java-version: ${{ matrix.java }}
3453
cache: 'gradle'
54+
3555
- name: Build with Gradle
3656
run: ./gradlew clean build
57+
58+
- name: Install Node.js
59+
if: ${{ matrix.e2e-tests == 'android' || matrix.e2e-tests == 'ios' }}
60+
uses: actions/setup-node@v3
61+
with:
62+
node-version: 'lts/*'
63+
64+
- name: Install Appium
65+
if: matrix.e2e-tests == 'android' || matrix.e2e-tests == 'ios'
66+
run: npm install -g appium@next
67+
68+
- name: Install UIA2 driver
69+
if: matrix.e2e-tests == 'android'
70+
run: appium driver install uiautomator2
71+
72+
- name: AVD cache
73+
if: matrix.e2e-tests == 'android'
74+
uses: actions/cache@v3
75+
id: avd-cache
76+
with:
77+
path: |
78+
~/.android/avd/*
79+
~/.android/adb*
80+
key: avd-${{ env.ANDROID_SDK_VERSION }}
81+
82+
- name: Generate AVD snapshot for caching
83+
if: matrix.e2e-tests == 'android' && steps.avd-cache.outputs.cache-hit != 'true'
84+
uses: reactivecircus/android-emulator-runner@v2
85+
with:
86+
api-level: ${{ env.ANDROID_SDK_VERSION }}
87+
avd-name: ${{ env.ANDROID_EMU_NAME }}
88+
force-avd-creation: false
89+
script: echo "Generated AVD snapshot for caching."
90+
91+
- name: Run Android E2E tests
92+
if: matrix.e2e-tests == 'android'
93+
uses: reactivecircus/android-emulator-runner@v2
94+
with:
95+
api-level: ${{ env.ANDROID_SDK_VERSION }}
96+
avd-name: ${{ env.ANDROID_EMU_NAME }}
97+
force-avd-creation: false
98+
emulator-options: -no-snapshot -delay-adb
99+
script: ./gradlew uiAutomationTest
100+
101+
- name: Select Xcode
102+
if: matrix.e2e-tests == 'ios'
103+
uses: maxim-lobanov/setup-xcode@v1
104+
with:
105+
xcode-version: "${{ env.XCODE_VERSION }}"
106+
107+
- name: Install XCUITest driver
108+
if: matrix.e2e-tests == 'ios'
109+
run: appium driver install xcuitest
110+
111+
- name: Prebuild XCUITest driver
112+
if: matrix.e2e-tests == 'ios'
113+
run: appium driver run xcuitest build-wda
114+
115+
- name: Prepare iOS simulator
116+
if: matrix.e2e-tests == 'ios'
117+
run: |
118+
xcrun simctl list
119+
target_sim_id=$(xcrun simctl list devices available | grep "$IOS_DEVICE_NAME (" | cut -d "(" -f2 | cut -d ")" -f1)
120+
open -Fn "/Applications/Xcode_$XCODE_VERSION.app/Contents/Developer/Applications/Simulator.app"
121+
xcrun simctl bootstatus $target_sim_id -b
122+
123+
- name: Run iOS E2E tests
124+
if: matrix.e2e-tests == 'ios'
125+
run: ./gradlew xcuiTest

azure-pipelines.yml

-69
This file was deleted.

src/test/java/io/appium/java_client/ios/BaseIOSTest.java

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public static AppiumDriverLocalService startAppiumServer() {
4444
service = new AppiumServiceBuilder()
4545
.withIPAddress("127.0.0.1")
4646
.usingPort(PORT)
47+
.withTimeout(Duration.ofSeconds(30))
4748
.build();
4849
service.start();
4950
return service;

0 commit comments

Comments
 (0)