Frameworks

E2E Launches Desktop Testing Engine to Automate Native macOS App Testing

E2E can now test native Mac apps with the same simple code it uses for the web and mobile. The tests run in the background, so you can keep working on your Mac.

E2E desktop testing engine for automating native macOS app testing
E2E's new desktop engine tests native macOS apps through the system's accessibility features.

E2E has released @e2e-dev/desktop, a new engine for testing native macOS apps. Until now, E2E tested web and mobile apps. With this engine it can test desktop apps too, whatever framework the app is built with.

The tests use the same agent, screen, and expect tools that developers already use on the web and on mobile. The engine is marked experimental, so details may change.

What is the desktop engine?

An engine is the part of E2E that knows how to control one kind of app. The web engine drives browsers, and the mobile engine drives phone apps. The new desktop engine drives native Mac apps.

It does this through the operating system's accessibility tree. This is the list of buttons, text fields, and other controls that macOS shares so that tools such as screen readers can use an app. See Apple's accessibility documentation for more.

Plain idea: the engine does not look at pixels. It asks the Mac, "What controls does this app have?" and then uses them, the way assistive tools do.

How to get started

Install the test runner and the desktop engine:

npm install --save-dev e2e @e2e-dev/desktop

The install adds the native driver for your Mac. In a project with no E2E config, this command creates the config and an example test:

npx e2e init --yes --engine desktop

The app that starts E2E (your terminal, IDE, or CI agent) needs two permissions in System Settings, under Privacy & Security:

  • Accessibility, to read and drive the app.
  • Screen Recording, for screenshots.

Running npx e2e doctor checks both permissions.

Point it at your app

You set a target that points to your built .app bundle:

import type { E2EConfig } from "e2e";
import { desktop } from "@e2e-dev/desktop";

export default {
  targets: [
    {
      name: "mac",
      engine: desktop(),
      app: { appPath: "build/MyApp.app" },
    },
  ],
  credentials: {
    ada: { username: "ada", password: process.env.ADA_PASSWORD ?? "" },
  },
} satisfies E2EConfig;

What a test looks like

A desktop test reads like any other E2E test. This one signs in to an app:

import { test } from "@e2e-dev/desktop";
import { credentials, expect } from "e2e";

test("signs in", async ({ app, screen }) => {
  const ada = credentials.user("ada");
  await app.open();
  await screen.getByRole("textbox", "Username").fill(ada.username);
  await screen.getByRole("textbox", "Password").fill(ada.password);
  await screen.getByRole("combobox", "Plan").selectOption("Team");
  await screen.getByRole("button", "Sign in").tap();
  await expect(screen.getByTestId("status")).toContainText("Signed in as ada");
});

Roles use the same names as the web: textbox, checkbox, combobox, and button. The same agent.act steps work too.

What it does not cover: the desktop engine is for native controls. It does not support browser windows, Electron apps, or web views. Use @e2e-dev/web for web apps and @e2e-dev/electron for Electron apps.

Your Mac stays yours

By default, app.open() leaves the app in the background. Actions go through the macOS Accessibility API, not the real mouse and keyboard, so you can keep using your computer during tests. E2E says XCUITest and Appium bring the app to the front while they run.

This helps most when you build with AI agents. The agent can run the tests while you keep working on the same machine.

Secrets stay out of the app

  • The app under test gets only a minimal environment, so secrets, model keys, and CI tokens do not leak into it.
  • Password fields never expose their value, and they are painted black in screenshots.
  • If a screenshot cannot cover a password field, it fails instead of being saved.

How fast is it?

E2E ran the same sign-in flow with E2E, XCUITest, Appium Mac2, and AppleScript. By default, E2E does not type: fill sets a field's value in one step. To keep the test fair, E2E used physicalInput: true, which types and clicks like the other tools do.

  • E2E (physical input): 1.34 seconds per flow (median)
  • XCUITest: 5.61 seconds
  • Appium Mac2: 5.70 seconds
  • AppleScript: 0.93 seconds

In its default mode, E2E finished the same flow in 1.03 seconds. E2E calls AppleScript "the floor, not a competitor". It uses the same accessibility API but has no auto-waiting, locators, reports, or screenshots.

Read with care: E2E says this is one simple AppKit form on one machine, on macOS only, and it measures speed only. The engine is early and has not been optimized yet. These are the company's own numbers.

How it works under the hood

The driver is written in Rust and loaded into the test process with napi-rs. The test calls it directly, with no separate process in between. That is different from E2E's other engines, which talk over JSON-RPC.

The author, DongYun Kang, who created swc, explains the choice of Rust over Swift:

  • Speed: a Swift driver would need a round trip for every action, even a single tap.
  • Memory: Rust has no garbage collector, so there is only one memory system to manage.
  • Safety: napi-rs wraps most of the unsafe code a native addon needs.
  • Tooling: many languages already work with Rust, which may allow other languages later.

You do not need Rust or Xcode to use the engine. npm installs the right driver for your Mac.

What to know before you try it

  • Desktop support is experimental. Options and behavior can change in any release.
  • Pin @e2e-dev/desktop to an exact version.
  • It runs on macOS 13 or later. E2E says it plans support for other desktop systems.
  • The E2E desktop guide lists what is supported today.

What It Means for Developers

For anyone who builds or tests Mac apps, this adds a new way to write UI tests.

What It Means for Software Developers

  • Reuse the same screen and expect habits across web, mobile, and native Mac tests.
  • Test a macOS app whatever framework it is built with.
  • Work while tests run, because the app stays in the background by default.
  • Compare it with Apple's own UI automation tools and Appium for your project.
  • New to testing? Learn the basics in our JavaScript tutorial.

What It Means for DevOps Engineers

  • Give the CI agent Accessibility and Screen Recording permissions on the Mac that runs the tests.
  • Run npx e2e doctor to check the driver, permissions, and app build.
  • Remember that a run including the desktop target works on macOS only, so plan Mac runners for those tests.
  • Pin the engine version, since changes can arrive even in a patch release.

Bottom line

E2E's desktop engine brings native macOS app testing into the same API as web and mobile. It runs in the background, keeps secrets out of the app, and was quick in the company's first test.

It is still experimental and Mac-only, so try it on a small flow first and pin the version.

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

About the author