Skip to main content

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 Playwright testMatch / 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');
ExportRole
loadYamlTests(rootDir)Discover / parse / filter
runScenario({ playwright, scenario, context })Run steps with injected Playwright deps
expand / registerHelperPortable {…} expansion
registerYamlTests({ test, expect, root, … })Module-load registration
createSmky(test)Optional test.extend options (does not auto-wire registration)

Runner contract​

  1. Recursively collect *.yml under a configured root.
  2. Skip docs without scenarios.
  3. Optional host setup via hooks.
  4. Honor todo / only.
  5. Per scenario: skip on todo / failing require; resolve vars; optional login via hooks; run steps; optional teardown via hooks.
  6. Coexist with normal Playwright specs.