@optivem/optivem-testing
v1.0.12
Published
Optivem Testing Library (TypeScript)
Readme
Optivem Testing (TypeScript)
Composable Playwright helpers for channelized tests.
Installation
npm install @optivem/optivem-testingExports
forChannelsand channel primitives fromchannelbindChannels(test)bindTestEach(test)channelTest(legacy convenience helper)
Example
import { test as base, expect } from '@playwright/test';
import { bindChannels, bindTestEach } from '@optivem/optivem-testing';
const _test = base.extend<{ app: MyApp }>({
app: async ({}, use) => {
const app = createMyApp();
await use(app);
await app.close();
},
});
const test = Object.assign(_test, {
each: bindTestEach(_test),
});
const { forChannels } = bindChannels(test);
forChannels('UI', 'API')(() => {
test.each(['3.5', 'lala'])(
'rejects non-integer quantity ($quantity)',
async ({ app, quantity }) => {
await expect(app.placeOrder(quantity)).resolves.toBeDefined();
},
);
});Notes
- This package does not define domain fixtures like
apporscenario. - Build domain fixtures in your test-infrastructure layer, then compose them with these helpers.
