Playwright integration
Thin *.smky.spec.js files
// features.smky.spec.js
const path = require('path');
const { test, expect } = require('@playwright/test');
const { registerYamlTests } = require('smky');
registerYamlTests({
test,
expect,
root: path.join(__dirname, 'features'),
});
- Convention: name entry files
*.smky.spec.js. - Split roots: one thin file per YAML tree.
- Coexistence: keep complex flows in ordinary
*.spec.js; configure PlaywrighttestMatch/ projects for both patterns.
registerYamlTests wraps each YAML document in test.describe.serial so document hooks stay on one worker under fullyParallel.
Public API (CommonJS)
const {
loadYamlTests,
runScenario,
expand,
registerHelper,
registerYamlTests,
createSmky,
HOST_HOOK_POLICY,
} = require('smky');
| Export | Role |
|---|---|
loadYamlTests(rootDir) | Discover / parse / filter |
runScenario({ playwright, scenario, context }) | Run steps with injected Playwright deps |
expand / registerHelper | Portable {…} expansion |
registerYamlTests({ test, expect, root, … }) | Module-load registration |
createSmky(test) | Optional test.extend options (does not auto-wire registration) |
Runner contract
- Recursively collect
*.ymlunder a configured root. - Skip docs without
scenarios. - Optional host
setupvia hooks. - Honor
todo/only. - Per scenario: skip on
todo/ failingrequire; resolvevars; optional login via hooks; run steps; optional teardown via hooks. - Coexist with normal Playwright specs.