Open MercatoDocsSearch docsAPI reference

CLI

yarn test:integration:ephemeral

Run the integration suite against disposable services. The test environment supplies its own actors and data so that the tests can exercise complete application flows.

yarn test:integration:ephemeral executes yarn mercato test:integration.

The command starts a disposable Postgres container and app runtime, runs the Playwright suite, and tears everything down when tests finish.

Usage

# Preferred script
yarn test:integration:ephemeral

# Code coverage report from integration tests
yarn test:integration:coverage

# Interactive menu (persisted ephemeral environment)
yarn test:integration:ephemeral:interactive

# Direct CLI command (alias form)
yarn mercato test:integration

# Direct CLI command (module/command form)
yarn mercato test integration

# Direct CLI command (interactive menu)
yarn mercato test:integration:interactive
# or
yarn mercato test interactive

# Direct CLI command (coverage)
yarn mercato test:integration:coverage
# or
yarn mercato test coverage

Configured test actors

Native integration helpers read the following optional variables before tests load:

RoleEmailPassword
SuperadminOM_INIT_SUPERADMIN_EMAILOM_INIT_SUPERADMIN_PASSWORD
AdminOM_INIT_ADMIN_EMAILOM_INIT_ADMIN_PASSWORD
EmployeeOM_INIT_EMPLOYEE_EMAILOM_INIT_EMPLOYEE_PASSWORD

Pass the credentials of the actors created in your disposable environment to the test process. These settings select existing actors; they do not change application passwords. Each field resolves independently: process environment first, then the existing apps/mercato/.env or root .env lookup. With no value, helpers retain the seeded role email (<role>@acme.com) and seeded password. Set the variables before starting Playwright because role defaults are captured when the helper module loads.

Both browser login(page, role) and API getAuthToken(request, role) use these defaults. An explicit password argument to getAuthToken continues to take precedence. Keep secrets out of command history, test output, screenshots and committed files.

Coverage command

Use yarn test:integration:coverage to measure real Open Mercato runtime code coverage driven by integration tests.

The command:

Options for yarn test:integration:coverage:

Environment overrides:

If you still need scenario/spec mapping coverage:

yarn test:integration:spec-coverage

Options

OptionDescription
--filter <pattern>Runs only tests matching a Playwright filter (same as positional filter).
<pattern>Positional shorthand for --filter.
--keepKeeps app and database running after tests (for debugging).
--verboseShows detailed bootstrap/build logs.
--screenshotsForces screenshot capture during test runs.
--no-screenshotsDisables screenshot capture during test runs.
--no-reuse-envForces a new ephemeral app+DB instance instead of reusing an existing one.

Examples

# Run everything in ephemeral containers
yarn test:integration:ephemeral

# Run only auth-related tests
yarn mercato test:integration --filter auth/

# Keep environment alive for debugging after tests
yarn mercato test:integration --keep --verbose

# Always start a new ephemeral runtime (no attach/reuse)
yarn mercato test:integration --no-reuse-env

Speed up local runs

yarn test:integration:ephemeral is optimized for clean, fully isolated runs, not for quick iteration. For day-to-day development, use one of these faster patterns:

# 1) Start interactive ephemeral mode once (preferred)
yarn test:integration:ephemeral:interactive --no-screenshots

# 2) Run only the test you are changing against that running environment
BASE_URL=http://127.0.0.1:<port> npx playwright test --config .ai/qa/tests/playwright.config.ts sales/TC-SALES-007.spec.ts --retries=0

# 3) Run with more workers locally when tests are independent
BASE_URL=http://127.0.0.1:<port> npx playwright test --config .ai/qa/tests/playwright.config.ts --workers=4 --retries=0

# 4) Keep ephemeral mode but filter aggressively
yarn test:integration:ephemeral -- --filter sales/TC-SALES-007.spec.ts --no-screenshots

Notes:

Requirements

Notes

Interactive mode

Use interactive mode when you want to keep one ephemeral app/database running and execute multiple tests without re-bootstrapping each time.

yarn test:integration:ephemeral:interactive

The command writes active environment details to .ai/qa/ephemeral-env.json and clears the file when the environment is closed.

Menu actions:

After each test run, the CLI asks whether to:

Supported options:

Previous: yarn test:integration:ephemeral:start