Skip to main content
@qawolf/flows/web defines web flows and optional explicit launch behavior.

Primary Exports

  • flow(...)
  • launch(...)
  • expect
  • isAnonymous(...)
  • isPersistent(...)
  • isElectron(...)
  • testContextDependencies
It also exports web-specific target, launch, callback context, and flow definition types. Example:

Target Model

Web flows accept web targets only. Use the CLI entry point for Basic.
Examples:

Launch Shapes

Browser launch accepts the generated Playwright browser and context launch options, excluding Playwright’s raw persistentContext and userDataDir fields. QA Wolf adds browserContext, reintroduces userDataDir for persistent launches, and maps those options back to the underlying Playwright shape.
QA Wolf maps browserContext: "persistent" to Playwright’s persistent context mode. Pass userDataDir with browserContext: "persistent" when a profile directory should be reused. Browser example:
Electron declarative launch example:
Explicit launch(...) calls are not target-typed. Include kind: "electron" and use firstWindowPage from the result:
Static launch options infer a narrow return type when they determine the result shape:
  • launch({ browserContext: "persistent" }) returns PersistentLaunchResult
  • launch({ browserContext: "incognito" }) returns AnonymousLaunchResult
  • launch({ kind: "electron", executablePath }) returns ElectronLaunchResult
  • launch() returns the full LaunchResult union because startup depends on the active flow target
Use isAnonymous(...), isPersistent(...), and isElectron(...) to narrow dynamic results before reading shape-specific fields.

Flow Callback Context

All web flow callbacks receive:
  • inputs
  • setOutput(...)
  • test(...)
Launch-enabled browser flows also receive:
  • page
  • context
  • optional browser
Electron launch-enabled flows receive the first Electron window as page.
test(...) can be omitted for simple flows where grouping steps into named sub-steps doesn’t add value. For most flows, wrapping steps in test(...) is recommended — the label appears in your results and makes failures easier to locate.

testContextDependencies

testContextDependencies is exported for runner and tooling integration. Flow authors should usually use the public callback parameters above instead of depending on the raw runner dependency list.

expect

The exported expect is the assertion helper for web flows, backed by Playwright’s expect. All Playwright matchers are available — including auto-retrying locator matchers like toBeVisible, toHaveText, toHaveURL, and toHaveScreenshot. See Playwright’s locator assertions reference for the full list. Always import expect from @qawolf/flows/web rather than from @playwright/test directly, so that QA Wolf’s defaults (custom timeout, visual diffing) stay in effect. Example:
For visual regression assertions with expect(page).toHaveScreenshot(...), see Web & Mobile web screenshots.

Defaults

  • default kind is browser launch
  • default browserContext is "incognito"
  • default browser comes from the flow target
  • GPU launch behavior is derived from the flow target
  • Electron declarative launch requires target: "Electron" and executablePath
Example:
Last modified on June 1, 2026