Skip to content

Commit c2fcab9

Browse files
feat: support for appium3 (#146)
BREAKING CHANGE: - Following changes are added - Updated all dependencies to point to appium3 - This version will work only with appium 3 and above
1 parent 5414336 commit c2fcab9

File tree

8 files changed

+113
-156
lines changed

8 files changed

+113
-156
lines changed

.circleci/config.yml

Lines changed: 0 additions & 135 deletions
This file was deleted.

.github/workflows/main.yml renamed to .github/workflows/appium3._android.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
name: Appium Flutter Integration Driver with Appium 3
2+
13
on:
2-
pull_request:
4+
pull_request:
5+
6+
env:
7+
CI: true
38

4-
name: Appium Flutter Integration Driver
59
jobs:
610
Android_E2E_WDIO:
711
runs-on: ubuntu-latest
@@ -22,18 +26,15 @@ jobs:
2226

2327
- name: 'List files'
2428
run: |
25-
release_info=$(curl -s https://api.github.com/repos/AppiumTestDistribution/appium-flutter-server/releases/latest)
26-
asset_urls=$(echo "$release_info" | grep "browser_download_url" | cut -d '"' -f 4)
27-
android_app=$(echo "$asset_urls" | head -n 1)
29+
version=$(grep 'appium_flutter_server:' README.md | awk '{print $2}')
30+
android_app="https://github.com/AppiumTestDistribution/appium-flutter-server/releases/download/$version/app-debug.apk"
2831
echo "$android_app"
29-
ios_app=$(echo "$asset_urls" | tail -n 1)
30-
echo "$ios_app"
3132
curl -LO $android_app
3233
ls ${{ github.workspace }}
3334
echo "APP_PATH=${{ github.workspace }}/app-debug.apk" >> $GITHUB_ENV
3435
- uses: actions/setup-node@v4
3536
with:
36-
node-version: 20
37+
node-version: 22
3738
- name: Enable KVM group perms
3839
run: |
3940
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
@@ -49,7 +50,7 @@ jobs:
4950
npm run build
5051
- name: Install Drivers
5152
run: |
52-
npm install -g appium@2.19.0
53+
npm install -g appium
5354
appium driver list
5455
- name: run tests
5556
uses: reactivecircus/android-emulator-runner@v2

.github/workflows/appium3_ios.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: iOS WDIO Tests with Appium 3
2+
3+
on:
4+
pull_request:
5+
6+
env:
7+
CI: true
8+
SHOW_XCODE_LOG: true
9+
PREBUILT_WDA_PATH: ${{ github.workspace }}/wda/WebDriverAgentRunner-Runner.app
10+
11+
jobs:
12+
wdio_ios:
13+
runs-on: macos-26
14+
name: WDIO iOS (Xcode 16.4)
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Install Node.js 22.x
19+
uses: actions/setup-node@v3
20+
with:
21+
node-version: '22.x'
22+
23+
- name: Select Xcode 16.4
24+
uses: maxim-lobanov/setup-xcode@v1
25+
with:
26+
xcode-version: '16.4'
27+
28+
- name: List Installed Simulators
29+
run: xcrun simctl list devices available
30+
- name: Install jq
31+
run: brew install jq
32+
33+
- run: |
34+
version=$(grep 'appium_flutter_server:' README.md | awk '{print $2}')
35+
ios_app="https://github.com/AppiumTestDistribution/appium-flutter-server/releases/download/$version/ios.zip"
36+
echo "Downloading from: $ios_app"
37+
curl -LO "$ios_app"
38+
echo "APP_PATH=$(pwd)/ios.zip" >> $GITHUB_ENV
39+
name: Download sample iOS app
40+
41+
- name: Start iOS Simulator UI
42+
run: open -Fn "$(xcode-select --print-path)/Applications/Simulator.app"
43+
44+
- name: Boot simulator
45+
id: prepareSimulator
46+
uses: futureware-tech/simulator-action@v4
47+
with:
48+
model: 'iPhone 16'
49+
os_version: '18.5'
50+
shutdown_after_job: false
51+
wait_for_boot: true
52+
53+
- run: |
54+
target_sim_id=$(xcrun simctl list devices available | grep -A 10 "Booted" | cut -d "(" -f2 | cut -d ")" -f1 | head -n 1)
55+
echo "Target sim id: $target_sim_id"
56+
echo "udid=$target_sim_id" >> $GITHUB_ENV
57+
58+
- run: |
59+
npm install -g appium
60+
npm install --no-package-lock
61+
npm run build-flutter-by-service
62+
npm run build
63+
name: Install Appium and deps
64+
65+
- run: |
66+
appium driver list
67+
appium driver doctor xcuitest
68+
appium driver run xcuitest download-wda-sim --platform=ios --outdir=$(dirname "$PREBUILT_WDA_PATH")
69+
echo "WDA path: $PREBUILT_WDA_PATH"
70+
echo "WDA_PATH=$PREBUILT_WDA_PATH" >> $GITHUB_ENV
71+
name: Build WDA with XCUITest driver
72+
73+
- run: |
74+
echo "UDID: $udid"
75+
echo "WDA path: $PREBUILT_WDA_PATH"
76+
xcrun simctl install $udid $PREBUILT_WDA_PATH
77+
xcrun simctl launch $udid "com.facebook.WebDriverAgentRunner.xctrunner"
78+
name: Install and launch WDA on Simulator
79+
80+
- run: |
81+
mkdir -p appium-logs
82+
UDID=$udid APP_PATH=$APP_PATH npm run wdio-ios | tee appium-logs/logs.txt
83+
name: Run WDIO iOS
84+
85+
86+
- name: Upload logs
87+
if: ${{ always() }}
88+
uses: actions/upload-artifact@v4
89+
with:
90+
name: appium-logs
91+
path: appium-logs

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
- uses: actions/checkout@v2
1111
- uses: actions/setup-node@v4
1212
with:
13-
node-version: 20
13+
node-version: 22
1414
- run: npm install --no-package-lock
1515
name: Install dependencies
1616
- run: npm run build

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,14 @@
9090
"webdriverio": "9.19.2"
9191
},
9292
"peerDependencies": {
93-
"appium": "^2.5.4"
93+
"appium": "^3.0.0"
9494
},
9595
"dependencies": {
96-
"@appium/base-driver": "^9.16.4",
97-
"appium-adb": "^12.4.4",
98-
"appium-ios-device": "^2.7.20",
99-
"appium-uiautomator2-driver": "^4.1.5",
100-
"appium-xcuitest-driver": "9.1.2",
96+
"@appium/base-driver": "^10.0.0",
97+
"appium-adb": "^13.0.0",
98+
"appium-ios-device": "^3.0.0",
99+
"appium-uiautomator2-driver": "^5.0.0",
100+
"appium-xcuitest-driver": "^10.0.0",
101101
"async-retry": "^1.3.3",
102102
"asyncbox": "^3.0.0",
103103
"bluebird": "^3.7.2",

src/driver.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ export class AppiumFlutterDriver extends BaseDriver<FlutterDriverConstraints> {
465465
// @ts-ignore
466466
await this.proxydriver.adb.removePortForward(this.flutterPort);
467467
}
468-
await this.proxydriver?.deleteSession();
468+
await this.proxydriver?.deleteSession(this.sessionId);
469469
await super.deleteSession();
470470
}
471471

src/iOS.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import type { AppiumFlutterDriver } from './driver';
22
// @ts-ignore
33
import { XCUITestDriver } from 'appium-xcuitest-driver';
4-
import type { InitialOpts } from '@appium/types';
54
import { DEVICE_CONNECTIONS_FACTORY } from './iProxy';
5+
import { XCUITestDriverOpts } from 'appium-xcuitest-driver/build/lib/driver';
66

77
export async function startIOSSession(
88
this: AppiumFlutterDriver,
99
...args: any[]
1010
): Promise<XCUITestDriver> {
1111
this.log.info(`Starting an IOS proxy session`);
12-
const iosdriver = new XCUITestDriver({} as InitialOpts);
13-
await iosdriver.createSession(...args);
12+
const iosdriver = new XCUITestDriver({} as XCUITestDriverOpts);
13+
await iosdriver.createSession.apply(iosdriver, args);
1414
return iosdriver;
1515
}
1616

wdio.conf.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ export const config: Options.Testrunner = {
126126
basePath: '/wd/hub',
127127
port: 4723,
128128
log: join(process.cwd(), 'appium-logs', 'logs.txt'),
129-
allowInsecure: 'chromedriver_autodownload,adb_shell',
129+
allowInsecure: '*:chromedriver_autodownload,*:adb_shell',
130130
},
131131
},
132132
],

0 commit comments

Comments
 (0)