skip to content
all examples

e2e with SwiftUI

A native iOS and macOS app, tested on an iPhone simulator and on the Mac.

A SwiftUI greeting app for iOS and macOS with three locator tests and two agent tests. One Xcode target builds both apps, and the same tests run on an iPhone simulator and on the Mac. The test project is in e2e/, next to the Xcode project.

swiftui app with the greeting hello, ada! swiftui app with the error enter a name first.

the macos app with the greeting hello, ada!

Use Node 22.22.3+, 24.8+, or 26+ for the tests. From this folder:

terminal
cd e2e
npm install

Run on iOS

Open HelloApp.xcodeproj in Xcode. Select the HelloApp scheme and an iPhone simulator. Press Run to build and install the app. Stop the Xcode run before you start the tests. From e2e/:

terminal
npx e2e doctor --target ios
npm run test:e2e:ios

e2e doctor checks Node, the config, agent-device, Xcode, and the simulators. With one booted simulator or device (a connected iPhone counts), it also checks that the app is installed.

After app changes, run the app in Xcode again before you run the tests.

Run on macOS

The app needs macOS 14 or later. From e2e/:

terminal
npm run build:macos
npx e2e doctor --target macos
npm run test:e2e:macos

npm run build:macos builds the app with xcodebuild into build/, and npm run test:e2e:macos builds it again before the tests.

The app that starts the tests (your terminal, your IDE, or your CI agent) needs two permissions in System Settings > Privacy & Security: Accessibility to drive the app, and Screen Recording for screenshots. e2e doctor checks both.

Each test launches the app and quits it when it ends. The tests run with --headed: a SwiftUI app launched in the background doesn't always open its window, so the app comes forward and takes the keyboard. Don't type while the tests run.

Agent tests

Set a Vercel AI Gateway key. From e2e/:

terminal
AI_GATEWAY_API_KEY="your-key" npm run test:e2e:ios

Without the key, the agent tests skip. Add -- --no-cache to use fresh model calls. Results are in e2e/.e2e/report.json.

See e2e/e2e.config.ts and e2e/tests/ for the setup. For device setup and CI, see the Mobile guide, and for the Mac, the Desktop guide. Desktop support is experimental: read the release notes before you upgrade @e2e-dev/desktop.

The bundled fonts use the SIL Open Font License.

Last checked on 2026-12-01 with e2e 0.26.0, @e2e-dev/mobile 0.13.0, @e2e-dev/desktop 0.1.0, and Xcode 27.2, on an iOS 27.2 simulator and on macOS 26.6. npx e2e doctor, the locator tests, and the agent tests passed on both. On macOS, the agent tests failed in about 1 of 4 runs, timing out or unable to read the window.

[ get started ]

your verificationlayerstarts withjust one command

npx e2e init