Skip to main content
Tests should say what the user wants, not which buttons they press. Put the taps and the test ids in a driver of your own, a class with methods in business language (addTodo('Buy milk')). The tests call only the driver. When the UI changes, the driver changes; the tests do not.
The driver works the same with every runner; only how a test gets one differs. The examples use the tutorial’s todo app.

The driver

An interface with what the tests need, and a class that does it through the UI:
  • app is the Driver the runner gives each test.
  • Prefer Quiesco’s assertions inside the driver (expectVisible, expectText): they retry until the app shows the expected state. A plain assertion on a query result checks once, which is fine after an action, because the action already waited for the app to be idle.

Per-platform steps

When one step is done differently per platform, for example a date picker that is inline on iOS and two system dialogs on Android, the driver branches on this.app.platform ('ios' | 'android' | 'web'):
A test for one platform only gets a tag instead (@ios, @android, @web; see tags).

The same tests against the API

Because the tests only see TodoDriver, a second implementation can run them without any UI, against the app’s backend API, in seconds:
Pick the driver with an environment variable. With Cucumber, the API run can leave Quiesco out entirely (API run).

Pick a runner

Vitest

The driver as a test fixture.

Jest

The driver in JavaScript, made in beforeEach.

Cucumber

The driver on the World, steps in business language.