Heal

SDK reference

Reference for the Heal SDK, an SDK to write stable end-to-end tests with LLMs and playwright.

SDK reference

Heal.init(options?)

Creates a new Heal instance with an auto-healing browser context.

OptionTypeDescription
headlessbooleanRun browser in headless mode
extensionPathsstring[]Browser extension paths to load
localestringBrowser locale
extraHttpHeadersRecord<string, string>Extra HTTP headers for all requests
storageStatePathstringPath to storage state JSON for auth/cookies

Instance methods

  • getPage(): Returns { page, agent } with Heal's self-healing proxy.
  • newPage(): Opens a new page in the browser context.
  • getBrowserContext(): Returns the underlying Playwright BrowserContext.
  • waitForNewPage(action, timeoutMS?): Waits for a new page to open as a result of an action.
  • close(): Closes the browser and cleans up resources.

HealPageAgent methods

  • agent.healClick(description): Click an element described in natural language.
  • agent.healType(description, value): Type into an element described in natural language.
  • agent.healSelectOption(description, option): Select an option from a dropdown described in natural language.
  • agent.healHover(description): Hover over an element described in natural language.
  • agent.healLocator(description): Returns a Playwright Locator for an element described in natural language.
  • agent.healAssert(assertion): Assert a condition on the page described in natural language.
  • agent.healScreenshot(): Takes a screenshot of the current page and returns it as a base64 string.

Supported Playwright features

Configuration (playwright.config.ts)

  • testDir: root test directory
  • projects: array of project configurations with name, testMatch, testDir, and dependencies
  • Project dependency graph with cycle detection and topological ordering

Test patterns

  • test() and it() declarations
  • test.describe() with nesting
  • test.afterEach() (scope-aware)
  • Custom fixtures via base.extend() — function-style, array-style with { auto: true }, and { option: true }
  • Fixture teardown via use() boundary detection
  • Fixture dependency resolution and topological sorting
  • test.use() overrides (scope-aware within describe blocks)
  • Built-in fixtures auto-provided when needed: page, context, browser, request

Test file extensions

*.spec.ts, *.spec.js, *.test.ts, *.test.js, *.spec.tsx, *.spec.jsx, *.test.tsx, *.test.jsx

Code patterns

  • Control flow blocks (if/else, for, while, try/catch, switch) treated as atomic executable units
  • File-level and describe-block-level variable declarations
  • Import statements preserved for execution context

Blocks (reusable helper functions)

  • import * as blocks from './blocks' pattern
  • Automatic inlining of await blocks.functionName(...) calls
  • Parameter binding, return value capture, and setup/teardown support

On this page