Skip to main content
With Cucumber, the driver lives on the World, and the steps call it. Features then state what the user wants, not which buttons they press:

The driver on the World

Put the driver in features/support/todo-driver.ts, the code from the overview with one change: the import names the .ts file ('../../src/backdoors.ts'; see below). Give the World a getter for it, and register that World instead of the default one:
registerQuiesco() replaces import '@quiesco/cucumber/register' in features/support/quiesco.ts; do not keep both (registerQuiesco()).

Steps

Steps then read like the feature:
In a step, this.platform is the same as this.app.platform (per-platform steps).

Step files are not compiled

cucumber-js loads step and support files with Node’s type stripping: Node removes the types and runs the rest as JavaScript, without tsc. Two rules follow:
  • Relative imports name the .ts file: import { UiTodoDriver } from './todo-driver.ts'. npx quiesco init adds "allowImportingTsExtensions": true to tsconfig.json, so tsc accepts them.
  • No TypeScript syntax that generates code: parameter properties (constructor(private app: Driver)), enum and namespace fail with ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX. Declare the field and assign it in the constructor; use a union of string literals or an object as const instead of an enum.
npx cucumber-js --dry-run loads every step file without starting the app, so it finds both kinds of mistakes in seconds.

The same features against the API

With an ApiTodoDriver, the same features run without the app. Select the driver with an environment variable or a cucumber profile. The API run does not need Quiesco at all: give it its own World (a plain cucumber World with an ApiTodoDriver) and leave out the Quiesco registration in that profile.

Generic steps

@quiesco/steps offers ready-made steps such as 点击 "add-todo" / "add-todo" をタップする / I tap "add-todo". They are operation scripts — useful to explore an app or sketch a prototype, but they tie features to the UI. Move to business-language steps as soon as the features describe real requirements. See generic steps. More on Cucumber in Cucumber.