@esimplicity/stack-tests
v0.1.7
Published
Reusable Playwright-BDD fixtures, ports, adapters, and step registrations for API/UI/hybrid/TUI testing.
Downloads
726
Readme
@esimplicity/stack-tests
Reusable Playwright-BDD fixtures, ports, adapters, and step registrations for API, UI, and hybrid testing. Designed to be consumed as a dev dependency across repos.
Install
GitHub Packages (recommended for release builds):
npm config set @kata:registry https://npm.pkg.github.com
npm set //npm.pkg.github.com/:_authToken=YOUR_GITHUB_TOKEN
npm install -D @esimplicity/stack-tests @playwright/test playwright-bddWorkspace/local development (from this monorepo):
bun add -d @esimplicity/stack-tests@"file:../packages/stack-tests" @playwright/test playwright-bddWhat’s included
- Fixtures:
createBddTestwiring world, api/ui/auth/cleanup adapters. - Ports:
ApiPort,UiPort,AuthPort,CleanupPort. - Adapters: Playwright API/UI adapters, default cleanup, example auth adapter.
- Step registrations: API (auth/http/assertions), UI (basic + wizard), shared vars/cleanup, hybrid helpers.
- Config helpers: tag expression helpers for project tagging.
Minimal usage
- Create fixtures (consumer repo):
// features/steps/fixtures.ts
import {
createBddTest,
PlaywrightApiAdapter,
PlaywrightUiAdapter,
UniversalAuthAdapter,
DefaultCleanupAdapter,
} from '@esimplicity/stack-tests';
export const test = createBddTest({
createApi: ({ apiRequest }) => new PlaywrightApiAdapter(apiRequest),
createUi: ({ page }) => new PlaywrightUiAdapter(page),
createAuth: ({ api, ui }) => new UniversalAuthAdapter({ api, ui }),
createCleanup: () => new DefaultCleanupAdapter(),
});- Register steps (thin wrappers):
// features/steps/steps_api/index.ts
import { test } from '../fixtures';
import { registerApiSteps } from '@esimplicity/stack-tests/steps';
registerApiSteps(test);- Configure Playwright projects with your features/steps globs and tag expressions. Keep
@playwright/testandplaywright-bddaligned with peer ranges.
Publishing (GitHub Packages)
- Ensure
.npmrcincludes:@kata:registry=https://npm.pkg.github.com //npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN} - Build then publish:
(Adjust access per your org policy.)npm run build npm publish --access public
Notes
- Peer dependencies:
@playwright/test,playwright-bdd,typescriptmust be installed in the consuming repo. - Defaults (auth/cleanup) are examples; override via
createBddTestoptions for app-specific behavior. - Tagging: supports
@api,@ui,@hybrid, plus your own (@smoke,@slow,@external); combine with Playwright’smaxFailures/reporters as needed.
