@quiesco/core directly from any other runner (Mocha, a
plain script).
Vitest and Jest
@quiesco/vitest and @quiesco/jest behave like the Cucumber adapter. Examples are in
Vitest, Jest and
examples/todo-app/e2e.
Details:
- The innermost level with a platform tag decides, as in Gherkin: a test tagged
@androidin adescribe('… @native')runs on Android only (test tags). - A session that fails to start fails the remaining tests at once, instead of starting again for each.
- With Jest, a config’s own
globalTeardownreplaces the preset’s: call@quiesco/jest/teardownfrom it (see the example app). - The first test of a Vitest run also waits for the session to start, and booting a device can take
minutes:
quiesco()setstestTimeoutto 300 s for that reason.
Lifecycle
Any other runner uses@quiesco/core directly. Lifecycle maps a run onto four calls; the adapters above
are thin layers over it.
new Lifecycle(options?)
LifecycleOptions
beforeAll()
before(tags, name?)
ScenarioTags
Before each test. Returns 'skipped' for a test tagged for another platform or browser (or once the run
bailed out after repeated identical failures, bailOnRepeatedFailure); otherwise it
starts the test’s artifacts and resets the app. Pass the tags grouped by level, outermost (suite / feature)
first, so the innermost platform tag decides.
current
The running session; lifecycle.current.driver is the driver. Throws when beforeAll did not complete.
after({ tags, failed, error? })
ScenarioResult · AfterResult
After each test. On failure it collects the evidence; with the artifacts policy it also keeps video, logs
and timeline. It returns { attachments, files }: attachments for runners with a report that takes them,
the files written for runners that print paths. Pass error (an Error or the runner’s message) so repeated
identical failures can be told apart. A test that passed still fails (after throws) when the app reported
an error after its last step.
afterAll()
titleTags(title)
The session
BelowLifecycle is the session itself, for full control: tags and skipping are then up to you.
createSession({ config, platform, worker?, logger? })
SessionOptions · Session
Starts the server, boots the device, installs and launches the app, and waits until the agent connects.
worker ({ index, count }, default the only worker) gives the session its own device, server port
(server.port + index) and artifacts directory.
startScenario({ name })
ScenarioInfo
Starts a test’s artifacts (timeline, video) in a directory named after it. Call it before beforeScenario,
so the reset is part of the video.
beforeScenario({ tags?, name? })
ScenarioInfo
Undoes the previous test’s runtime sync and device changes, brings a
backgrounded app back or starts a terminated one, then soft resets the app, or terminates and relaunches it
for @hard-reset (or reset.default: 'hard'). If the app crashed or stopped answering, it is started
again.
afterScenario({ failed })
ScenarioArtifacts
Ends the test. On failure: the framed screenshot, element tree and idle state; plus video, logs and
timeline per the artifacts policy. Returns { attachments, files }.
collectEvidence()
Evidence
Returns the failure evidence alone, without writing artifacts: screenshot, tree, elements, idle,
and errors for any piece it could not collect (after a crash, the screenshot and crash only).
dispose()
devices.*.shutdown is set.
Running
One session drives one device; for parallel runs each worker has its own, with itsworker
index. quiesco test --runner cucumber|jest|vitest sets QUIESCO_PLATFORM and starts the runner. For other
runners, set QUIESCO_PLATFORM (or pass the platform to resolvePlatform) and start the runner yourself: