addTodo('Buy milk')). The tests
call only the driver. When the UI changes, the driver changes; the tests do not.
The driver
An interface with what the tests need, and a class that does it through the UI:appis 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 onthis.app.platform ('ios' | 'android' | 'web'):
@ios, @android, @web; see tags).
The same tests against the API
Because the tests only seeTodoDriver, a second implementation can run them without any UI, against
the app’s backend API, in seconds:
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.