Skip to content

Commit 2ac6139

Browse files
committed
feat(e2e): native-WebView coverage via Vitest + webdriverio + Appium
Adds e2e-webview/ (Vitest + raw webdriverio + tauri-plugin-webdriver) for real WKWebView/WebView2/WebKitGTK on PR and push:main, and e2e-mobile/ (Vitest + Appium 2 + UiAutomator2) for the Android System WebView nightly. Both gated by continue-on-error until stable; macOS desktop runs on push:main only. Plugin lives behind a default-off Cargo feature so release builds never include it. Removes ~1300 LOC of Chromium-against-localhost specs under tests/e2e/tauri/ and tests/e2e/adapters/tauri/, plus e2e-apps.yml (tauri-e2e is superseded; websocket-e2e referenced a missing dir). Playwright web/PWA/legacy/multi-browser/mobile-viewport coverage is unchanged.
1 parent 412b52a commit 2ac6139

36 files changed

Lines changed: 6894 additions & 2119 deletions

.github/workflows/e2e-apps.yml

Lines changed: 0 additions & 150 deletions
This file was deleted.
Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
name: E2E Mobile (Android)
2+
3+
on:
4+
schedule:
5+
- cron: '0 6 * * *' # 06:00 UTC nightly
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
11+
concurrency:
12+
group: e2e-mobile-android-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
env:
16+
NODE_VERSION: '22'
17+
PNPM_VERSION: '9'
18+
19+
jobs:
20+
android-e2e:
21+
runs-on: ubuntu-22.04
22+
name: Android E2E (API 34, x86_64)
23+
timeout-minutes: 90
24+
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
29+
# KVM acceleration is required for the Android emulator on Linux runners.
30+
# Without it the emulator falls back to software rendering and tests
31+
# take 5–10× longer (and frequently time out).
32+
- name: Enable KVM
33+
run: |
34+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
35+
sudo udevadm control --reload-rules
36+
sudo udevadm trigger --name-match=kvm
37+
38+
- name: Install Linux dependencies
39+
run: |
40+
for i in 1 2 3; do
41+
if sudo apt-get update; then break; fi
42+
sleep $((i*5))
43+
done
44+
sudo apt-get install -y \
45+
libwebkit2gtk-4.1-dev \
46+
libssl-dev \
47+
patchelf
48+
49+
- name: Setup Java
50+
uses: actions/setup-java@v4
51+
with:
52+
distribution: temurin
53+
java-version: '17'
54+
55+
- name: Install Rust toolchain (Android x86_64 only)
56+
uses: dtolnay/rust-toolchain@stable
57+
with:
58+
targets: x86_64-linux-android
59+
60+
- name: Rust cache
61+
uses: swatinem/rust-cache@v2
62+
with:
63+
workspaces: src-tauri -> target
64+
shared-key: e2e-android
65+
66+
- name: Setup Android SDK
67+
uses: android-actions/setup-android@v3
68+
69+
- name: Install Android NDK
70+
run: sdkmanager "ndk;27.0.12077973"
71+
72+
- name: Setup Node.js
73+
uses: actions/setup-node@v4
74+
with:
75+
node-version: ${{ env.NODE_VERSION }}
76+
77+
- name: Setup pnpm
78+
uses: pnpm/action-setup@v4
79+
with:
80+
version: ${{ env.PNPM_VERSION }}
81+
82+
- name: Install root dependencies
83+
run: pnpm install --frozen-lockfile
84+
85+
- name: Install e2e-mobile dependencies
86+
working-directory: e2e-mobile
87+
run: pnpm install --frozen-lockfile
88+
89+
- name: Install Appium 2 + UiAutomator2 driver
90+
run: |
91+
npm install -g appium@^2
92+
appium driver install uiautomator2
93+
94+
- name: Initialize Android project
95+
run: pnpm tauri android init
96+
97+
- name: Build Android APK (debug, x86_64)
98+
env:
99+
NDK_HOME: ${{ env.ANDROID_HOME }}/ndk/27.0.12077973
100+
run: pnpm tauri android build --apk --debug --target x86_64
101+
102+
- name: Run E2E in emulator
103+
id: emulator-test
104+
continue-on-error: true
105+
uses: reactivecircus/android-emulator-runner@v2
106+
with:
107+
api-level: 34
108+
target: google_apis
109+
arch: x86_64
110+
profile: pixel_6
111+
script: |
112+
set -euo pipefail
113+
APK_PATH="$(find src-tauri/gen/android/app/build/outputs/apk -name '*.apk' -path '*x86_64*' | head -n1)"
114+
if [ -z "$APK_PATH" ]; then
115+
echo "::error::No APK found under src-tauri/gen/android/app/build/outputs/apk"
116+
exit 1
117+
fi
118+
APK_PATH="$(realpath "$APK_PATH")"
119+
echo "Using APK: $APK_PATH"
120+
export APK_PATH
121+
122+
appium --port 4723 > appium.log 2>&1 &
123+
APPIUM_PID=$!
124+
trap 'kill $APPIUM_PID 2>/dev/null || true' EXIT
125+
126+
# Wait for Appium to be ready (max 30s).
127+
for i in $(seq 1 30); do
128+
if curl -sf http://127.0.0.1:4723/status > /dev/null; then break; fi
129+
sleep 1
130+
done
131+
132+
cd e2e-mobile
133+
pnpm test
134+
135+
- name: Upload Appium log
136+
if: always()
137+
uses: actions/upload-artifact@v4
138+
with:
139+
name: appium-log
140+
path: appium.log
141+
if-no-files-found: ignore
142+
retention-days: 7
143+
144+
- name: Upload test reports
145+
if: always()
146+
uses: actions/upload-artifact@v4
147+
with:
148+
name: android-e2e-reports-api34
149+
path: e2e-mobile/reports/
150+
if-no-files-found: warn
151+
retention-days: 7
152+
153+
- name: Upload failure screenshots
154+
if: ${{ steps.emulator-test.outcome == 'failure' }}
155+
uses: actions/upload-artifact@v4
156+
with:
157+
name: android-e2e-screenshots-api34
158+
path: e2e-mobile/screenshots/
159+
if-no-files-found: ignore
160+
retention-days: 7

0 commit comments

Comments
 (0)