Skip to content

fix: enhance E2E workflow script for better organization and clarity #108

fix: enhance E2E workflow script for better organization and clarity

fix: enhance E2E workflow script for better organization and clarity #108

Workflow file for this run

name: E2E Tests
on: [push, pull_request]
jobs:
ios_e2e:
runs-on: macos-latest
env:
CI: true
MAESTRO_CLI_NO_ANALYTICS: true
timeout-minutes: 30
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 21
- name: Install dependencies
run: npm ci
- name: Install Maestro
run: |
curl -Ls "https://get.maestro.mobile.dev" | bash
echo "$HOME/.maestro/bin" >> $GITHUB_PATH
- name: Install applesimutils
run: |
brew tap wix/brew
brew install applesimutils
- name: Install CocoaPods dependencies
run: |
cd ios
pod install
cd ..
- name: Boot iOS Simulator
run: |
xcrun simctl shutdown all
xcrun simctl boot "iPhone 16"
xcrun simctl list devices | grep Booted
sleep 10
- name: Build and install iOS app
run: |
xcodebuild -scheme MyTestLibraryExample \
-workspace ios/MyTestLibraryExample.xcworkspace \
-configuration Debug \
-sdk iphonesimulator \
-derivedDataPath build \
-arch arm64
xcrun simctl install booted build/Build/Products/Debug-iphonesimulator/MyTestLibraryExample.app
- name: Run iOS Maestro tests
run: |
# Create reports directory
mkdir -p e2e/reports
# Start Metro bundler for tests
npm start &
METRO_PID=$!
sleep 10
# Run the app
xcrun simctl launch booted mytestlibrary.example || true
sleep 10
# Run the tests
npm run e2e:test
# Clean up
kill $METRO_PID 2>/dev/null || true
pkill -f "Metro" || true
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: e2e-test-results-ios
path: e2e/reports/
- name: Upload screenshots
uses: actions/upload-artifact@v4
if: failure()
with:
name: e2e-screenshots-ios
path: e2e/reports/screenshots/
android_e2e:
runs-on: ubuntu-latest
env:
CI: true
MAESTRO_CLI_NO_ANALYTICS: true
timeout-minutes: 30
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 21
- name: Install dependencies
run: npm ci
- name: Install Maestro
run: |
curl -Ls "https://get.maestro.mobile.dev" | bash
echo "$HOME/.maestro/bin" >> $GITHUB_PATH
- name: Android SDK
uses: android-actions/setup-android@v3
- name: Setup NDK
uses: nttld/setup-ndk@v1
with:
ndk-version: r26d
- name: Prebuild
run: npm run assets
- name: Enable KVM (faster emulator)
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Free up disk space
run: |
sudo rm -rf /usr/share/dotnet /opt/ghc /usr/local/share/boost
sudo rm -rf $ANDROID_HOME/ndk || true
docker system prune -af || true
- name: Build Debug APK
run: |
npm run build:android
- name: Test Android with Maestro
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 29
target: default
arch: x86_64
disable-animations: true
emulator-options: "-no-snapshot -no-boot-anim -no-window -gpu swiftshader_indirect -memory 2048 -cores 2"
script: |
# Start Metro bundler for tests
npm start & METRO_PID=$!
# Build and install the app
cd android && ./gradlew assembleDebug && cd ..
# Install the app
adb install -r android/app/build/outputs/apk/debug/app-debug.apk
# Run the tests
npm run e2e:test
# Clean up
kill $METRO_PID 2>/dev/null || true && pkill -f "Metro" || true
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: e2e-test-results-android
path: e2e/reports/
- name: Upload screenshots
uses: actions/upload-artifact@v4
if: failure()
with:
name: e2e-screenshots-android
path: e2e/reports/screenshots/