Skip to content
Public template

About

Example repository to demonstrate how you can use e2e to test a SwiftUI macOS desktop application

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

e2e-macos

A messaging app for macOS, built with SwiftUI, tested end to end through the macOS accessibility tree with e2e.

The chat with Alex Rivera open next to the chat list, with a shared PDF, a reply, and a voice message

How it works

  • App (e2e-macos/App/): the entry point, the window, and the menu commands. ⌘N starts a chat, ⇧⌘N a group, ⌘1 to ⌘4 switch between Chats, Moments, Calls, and Settings, and ⌘, opens Settings.
  • Mock backend (e2e-macos/Backend/): holds the contacts, chats, and messages, and seeds the same data on every launch. There is no real server.
  • State (e2e-macos/Models/, e2e-macos/Store/): the data types, app state, navigation, and settings.
  • Screens (e2e-macos/Views/, e2e-macos/Design/): chats, conversation, chat info, Moments, calls, and settings, with the theme and shared components.

The app has chats and groups with filters, Archived chats, and Saved messages; sending, replying to, forwarding, editing, and deleting messages, with emoji reactions; attachments (photos, camera, documents, location, contacts, and polls); Moments, with stories and streams you can follow; voice and video calls; and search across chats and messages.

Mock backend settings

Contacts reply to your messages, and new messages arrive now and then. Change this in Settings > Mock backend, or with launch arguments:

Argument Effect
-mockAutoReplies NO Contacts don't reply to your messages
-mockRandomIncoming NO No new messages arrive on their own

The same settings page also sets the simulated network latency and can simulate being offline.

Getting started

You need macOS 26.6 or newer and Xcode 27.

npm install
npm run build:macos
open build/DerivedData/Build/Products/Debug/e2e-macos.app

You can also open e2e-macos.xcodeproj in Xcode and run the e2e-macos scheme.

Permissions

e2e drives the app through the desktop engine, so the app that starts it (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. Check your setup with:

npx e2e doctor

End-to-end tests

The tests launch the built app, drive it with the real pointer and keyboard, and quit it after each test, so don't touch them while the tests run. chats and calls use locators only, so they need no model. messages and moments are agentic tests: an agent does the step from a plain-language goal, and locator assertions check the outcome.

Test Expects
Shows the seeded chat list on launch Weekend Hiking and Alex Rivera in the chat list
Opens the first chat on launch The first chat's messages, not "Pick a chat to start messaging"
Finds a message by searching chats "I'll bring sandwiches" in the results, and Alex's chat hidden
Starts and ends a voice call from a chat The call screen, then "Call ended"
Sends a text message in a chat (agent) "Running ten minutes late" sent by you
Follows a suggested stream (agent) Orbit Weekly followed, with no Follow button left

The agent tests need a Vercel AI Gateway key, AI_GATEWAY_API_KEY. The agent's context in e2e.config.ts tells it what the app calls things, and the config launches the app with -mockRandomIncoming NO, so no unexpected messages arrive in the middle of a test. To build the app and run the tests:

npm run test:e2e

Desktop support in e2e is experimental.

Scripts

Command Description
npm run build:macos Build the app with xcodebuild
npm run test:e2e Build the app and run e2e tests
e2e

About

Example repository to demonstrate how you can use e2e to test a SwiftUI macOS desktop application

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages