Skip to main content

Run Mobile Tests in CI

This guide shows how to run Mobilewright tests against an iOS simulator in GitHub Actions. Android CI setup follows the same pattern with Android-specific setup steps.

Prerequisites: Mobilewright tests already running locally (see Test an iOS App with Mobilewright).

GitHub Actions workflow

Create .github/workflows/mobile-tests.yml:

name: Mobile Tests

on:
push:
branches: [main]
pull_request:

jobs:
test:
runs-on: macos-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: '22'

- name: Install dependencies
run: npm ci

- name: Boot simulator
run: |
xcrun simctl boot "iPhone 16" || true
xcrun simctl bootstatus "iPhone 16" -b

- name: Run Mobilewright tests
run: npx mobilewright test --reporter list

- name: Upload test report
if: always()
uses: actions/upload-artifact@v4
with:
name: mobilewright-report
path: mobilewright-report/

Android CI

Swap the simulator setup step with:

      - name: Start Android emulator
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 35
script: npx mobilewright test --reporter list

Cloud devices

Running on macOS GitHub Actions runners is slower and more expensive than running against cloud devices. With Mobile Next Cloud, your tests run on managed real devices and your CI can use a standard ubuntu-latest runner. See Mobile Next Cloud for setup.