@natl/adapter-playwright
v1.0.0
Published
Official Playwright engine adapter for NATL
Maintainers
Readme
@natl/adapter-playwright
Official Playwright UI adapter for NATL.
Status: supported — default engine for production pilots. NATL scenarios stay in compact YAML; this package is the default EngineAdapter implementation. Browser choice (chromium / firefox / webkit) is a capability of this adapter — set via browser: in natl.config (opaque string to @natl/core).
Logo assets: brand/.
Install
npm install @natl/core @natl/adapter-playwright
npx playwright install chromium
# optional: firefox / webkit — see Playwright docsUse with the CLI:
npm install -g @natl/cli @natl/adapter-playwright
natl run tests/ --engine playwrightConfig (factory opts)
# natl.config.yaml
engine: playwright
browser: firefox # chromium | firefox | webkit (this adapter)
headless: true
viewport: # optional session hint
width: 390
height: 844
timeout: 15000
trace: on-fail
video: offUnknown browser values throw a clear error (no silent fallback to Chromium).
Develop
pnpm install
pnpm build@natl/core is a peer dependency (^0.1.0). For local work against a sibling checkout:
# from ../core
pnpm link --global
# from this repo
pnpm link --global @natl/core
pnpm install
pnpm buildOr use pnpm overrides:
{
"pnpm": {
"overrides": {
"@natl/core": "link:../core"
}
}
}Exports
| Export | Purpose |
|--------|---------|
| engine | "playwright" |
| createAdapter | AdapterFactory (timeout, headless, browser, viewport, trace, video) |
| PlaywrightAdapter | Class |
| resolvePlaywrightBrowser | Map browser string → Playwright browser type |
| resolvePlaywrightLocator | Map LocatorRef (css | xpath) → Playwright locator |
Breaking (EngineAdapter v2)
Custom adapters must implement scroll / swipe / longPress and accept LocatorRef ({ strategy, value }) instead of bare strings. Factory options are typed as AdapterFactoryOptions. See @natl/core / architecture docs; noted for the next npm publish (task 01).
