Revyl Documentation

Integrations

e2e

Run e2e tests on Revyl iOS simulators, Android emulators and hosted Chrome

e2e is an open-source test runner for web and mobile apps, with plain code steps and AI agent steps side by side. Its @e2e-dev/revyl package runs those tests on Revyl: each worker leases a Revyl iOS simulator or Android emulator with your app installed, or a Revyl-hosted Chrome for web tests. The machine that runs e2e needs only Node.js, so there's no Mac, Xcode or Android SDK in CI.

Set up with an agent

Paste one prompt and your coding agent does the rest.

Setup prompt

Run this project's e2e tests on Revyl devices.

Read https://docs.revyl.com/integrations/e2e.md and follow it. It's the current Revyl guide for this, so prefer it over anything you remember about Revyl.

If `revyl` is missing, install it with `curl -fsSL https://revyl.com/setup | sh` (on Windows, use the PowerShell installer on https://docs.revyl.com/install.md), then put it on the PATH of the shell you run it from with `export PATH="$HOME/.revyl/bin:$PATH"`; if it is already installed, run `revyl upgrade`. If `revyl auth status` shows I am not signed in, run `revyl auth login` in the background (or a second terminal) and give me the approval URL it prints as a clickable link. The request expires after 10 minutes; if it does, run `revyl auth login` again. If browser approval is not possible, ask me for a `REVYL_API_KEY`, export it in your shell, and never write it into a file.

Add `@e2e-dev/revyl` and point one mobile target at a Revyl device with `revyl()`, using a release build of the app and a device name from `revyl device targets`. Start with iOS. Set `assertionTimeout` to 15000.

You're done when one test passes on a Revyl device with `npx e2e run`.

Ask me before anything that needs my login or approval.

If a step fails or is blocked, or I stop or change course partway, also report it to the Revyl team yourself, without asking me: run `revyl feedback --type bug "<report>"` when Revyl broke, or `revyl feedback --type friction "<report>"` when it worked but was harder than it should have been. Name the step you reached, what blocked it, and where I stopped. Report a setup that only succeeded after a workaround as friction. Never include secrets or my app's data or code. If the CLI rejects `--type friction`, use `--type other`; if Revyl is not installed or signed in yet, tell me instead.

Install and authenticate

For mobile apps, install e2e, its mobile engine and the Revyl package:

npm install --save-dev e2e @e2e-dev/mobile @e2e-dev/revyl

Then set REVYL_API_KEY in the environment that runs e2e. In CI, store it as a secret. Authentication shows how to create a key. Without it, the run fails before any device starts.

Run a mobile test

Give the mobile engine device: revyl({ ... }). This config runs the same tests on an iOS simulator and an Android emulator:

e2e.config.ts
import type { E2EConfig } from 'e2e';
import { mobile } from '@e2e-dev/mobile';
import { revyl } from '@e2e-dev/revyl';

export default {
  targets: [
    {
      name: 'ios',
      engine: mobile({
        platform: 'ios',
        device: revyl({ app: 'https://builds.example.com/MyApp-simulator.zip', device: 'iPhone 17 Pro Max' }),
      }),
      app: { bundleId: 'com.example.app' },
    },
    {
      name: 'android',
      engine: mobile({
        platform: 'android',
        device: revyl({ app: 'https://builds.example.com/app-release.apk', device: 'Pixel 7' }),
      }),
      app: { bundleId: 'com.example.app' },
    },
  ],
  workers: 2,
  assertionTimeout: 15_000,
} satisfies E2EConfig;
tests/cart.e2e.ts
import { expect } from 'e2e';
import { test } from '@e2e-dev/mobile';

test('opens the cart', async ({ app, screen }) => {
  await app.open();
  await screen.getByText('Cart').click();
  await expect(screen.getByText('Your cart is empty')).toBeVisible();
  await app.screenshot('cart');
});

Run it with npx e2e run. On Android, bundleId is the app's package name.

A screen read on a Revyl device takes a few seconds, so keep assertionTimeout at 15_000. With e2e's 5 second default, an expect can time out before it reads the screen once.

Pick a device

device and the optional osVersion must match Revyl's names exactly, such as iPhone 17 Pro Max with iOS 27.0, or Pixel 7 with Android 14. To list the current models and the OS versions each one supports, run revyl device targets or read the public https://backend.revyl.ai/api/v1/execution/device-targets endpoint. Without osVersion, Revyl uses its default for that model.

A name that isn't on the list, or an OS version Revyl doesn't run that model on, fails when the device is requested, with a 422 from Revyl.

The first @e2e-dev/revyl release that includes e2e#2425 checks the name before any device starts, and the error lists the names Revyl has for that platform, or the OS versions it runs that model on. If Revyl's device list can't be read at that moment, the 422 above still applies.

Choose the build

Use a release build: an iOS simulator .app, zipped, or an Android .apk. Artifact requirements has the rules. An Expo dev-client build doesn't work here. It waits on "Searching for development servers" for a Metro server the device can't reach, so build a release or preview profile instead.

There are two ways to give Revyl the build. Set one, not both:

  • app URL. Revyl downloads the build from an https URL each time it starts a device. The URL can't carry credentials, but a presigned storage URL works. This suits CI and large builds, because nothing is uploaded from your machine.
  • Local appPath. Leave app out of revyl() and set the target's app.appPath. e2e uploads the file to each device and installs it, so a run with workers: 4 uploads it four times. Don't also call device.installApp() for that build.
e2e.config.ts
{
  name: 'android-local',
  engine: mobile({ platform: 'android', device: revyl({ device: 'Pixel 7' }) }),
  app: { appPath: './android/app/build/outputs/apk/release/app-release.apk', bundleId: 'com.example.app' },
}

Run a web test

revylBrowsers() runs each web test attempt in Chrome on Revyl, attached over CDP, with the same app, screen and expect APIs as a local browser.

revylBrowsers() needs @e2e-dev/revyl 0.0.3 or later.

npm install --save-dev e2e @e2e-dev/web @e2e-dev/revyl

The sessions run under a Revyl Web app. Create one with revyl app create --name "My site" --platform web and pass its id as app. url is the page each session opens on, and it must be a deployed address, not localhost. Set the engine's viewport to null and give the size to revylBrowsers(), because a Revyl browser keeps the size it opened with. With any other engine viewport, the attempt waits until the test times out:

e2e.config.ts
import type { E2EConfig } from 'e2e';
import { web } from '@e2e-dev/web';
import { revylBrowsers } from '@e2e-dev/revyl/web';

export default {
  targets: [
    {
      name: 'web',
      engine: web({
        browser: revylBrowsers({
          app: '<Revyl Web app id>',
          url: 'https://staging.example.com',
          viewport: { width: 1280, height: 800 },
        }),
        viewport: null,
      }),
      app: { url: 'https://staging.example.com' },
    },
  ],
} satisfies E2EConfig;

The run logs session <id>, watch at <link> for each session, so you can watch it live in Revyl.

Record video

Run with --video, or set video in the config, and each attempt saves Revyl's recording as video/recording.mp4 in its results.

  • Web. The file is Revyl's recording of the browser session. Revyl publishes it only when the session ends, so stopping a recording ends the session. In a test with video: 'off' that calls app.startRecording(), the app.stopRecording() call leaves the rest of the test with no browser.
  • Devices. The file is Revyl's screen recording of the device. Revyl stops a recording after 3 minutes or about 160 MiB, whichever comes first, so a longer attempt's video covers only its start. Add app.screenshot() calls for evidence later in a long test.

Device recording needs the first @e2e-dev/revyl release that includes e2e#2425. Until then, --video on a device fails with UNSUPPORTED_CAPABILITY, so use app.screenshot() for evidence.

Agent steps

Steps such as agent.act('add a Goliath Beetle to the cart') and agent.assert(...) need a model in agents.default.model. Tests without agent steps need none. On a device, the model must support tool calls and image input: the agent asks for screenshots when the accessibility tree isn't enough, and a text-only model fails that step with MODEL_PROVIDER_FAILED.

For example, with the Vercel AI Gateway, install the ai package, set AI_GATEWAY_API_KEY, and add the model to the config:

e2e.config.ts
import type { E2EConfig } from 'e2e';
import { gateway } from 'ai';

export default {
  targets: [/* as above */],
  agents: { default: { model: gateway('openai/gpt-6-luna-fast') } },
} satisfies E2EConfig;

e2e's model guide covers every provider. Try a new model on a local web target before you spend device time on it.

Limits and troubleshooting

  • Android starts slowly. The first test on each Android worker waits for the emulator to boot, about two minutes, against about ten seconds on iOS. Later tests on that worker reuse the device, so give the first test enough time and avoid more workers than you need.
  • The first Android read can fail. While an Android app shows its launch screen, a screen read fails with uiautomator dump failed: null root node instead of waiting, and the test fails with it. After app.clearState(), an app can stay on its launch screen for most of a minute. Clear state on Android only in tests that need it, and set retries so an attempt that hits this runs again.
  • A device fails to start with a 422. The device or osVersion isn't in Revyl's list, or Revyl doesn't run that model on that OS version. See Pick a device for the valid names.
  • getByText misses text inside a card on iOS. iOS merges a tappable card's text into one accessibility label, such as HOT, Goliath Beetle, $72.00, +, so getByText('Goliath Beetle') finds nothing with e2e's default exact match. Pass { exact: false } to match part of the label: screen.getByText('Goliath Beetle', { exact: false }).
  • Stuck on "Searching for development servers". The build is a dev client. Use a release build.
  • The app can't reach your server. Devices and browsers run on Revyl's network, so localhost and private hosts are out of reach. Point the app at an https server it can reach.
  • Typing fails with UNSUPPORTED_CAPABILITY. Use fill. Revyl devices don't support pressSequentially or typing into the focused field.
  • Concurrency. Keep workers within the number of concurrent devices your Revyl plan allows.
  • Cleanup. e2e releases each device when the run ends and stops each browser session when its attempt ends. If the runner is killed first, Revyl ends a device session after 5 minutes idle and a web session after idleTimeoutSeconds (600 by default).
  • A worker dies mid-run. When the run ends, e2e stops the browser session of any worker that died before it could. This needs @e2e-dev/revyl 0.0.3 or later.

e2e's Revyl guide lists every option and the device methods each platform supports.

On this page