executable-stories-playwright 6.0.0 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +169 -0
- package/dist/index.d.ts +83 -17
- package/dist/index.js +69 -9
- package/dist/index.js.map +1 -1
- package/package.json +8 -7
package/README.md
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# executable-stories-playwright
|
|
2
|
+
|
|
3
|
+
BDD-style executable stories for Playwright Test with documentation generation. Uses Playwright’s native `test()`; step markers and optional callbacks register scenario metadata for the reporter.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add -D executable-stories-playwright executable-stories-formatters
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### Required test signature
|
|
14
|
+
|
|
15
|
+
Your test callback **must** accept `testInfo` as the second argument (Playwright provides it). Call `story.init(testInfo)` at the start of each test that should be documented. If you omit `testInfo` or forget to pass it to `story.init()`, the reporter and story API will not work correctly.
|
|
16
|
+
|
|
17
|
+
**When step callbacks need fixtures** (e.g. `async ({ page }) => { ... }`), pass the fixtures into `init` so the library can inject them into callbacks. Use either:
|
|
18
|
+
|
|
19
|
+
- `story.init(fixtures, testInfo)` — pass the test's first argument as the first argument to `init` (recommended).
|
|
20
|
+
- `story.init(testInfo, { fixtures })` — pass fixtures in the options object.
|
|
21
|
+
|
|
22
|
+
If you only call `story.init(testInfo)`, step callbacks are still invoked but do **not** receive a fixtures argument. Use marker-only steps or pass fixtures when you need fixture-aware callbacks.
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
import { test, expect } from '@playwright/test';
|
|
26
|
+
import { story } from 'executable-stories-playwright';
|
|
27
|
+
|
|
28
|
+
// Minimal: no fixtures in step callbacks
|
|
29
|
+
test('my scenario', async ({ page }, testInfo) => {
|
|
30
|
+
story.init(testInfo);
|
|
31
|
+
story.given('user is on page');
|
|
32
|
+
await page.goto('/');
|
|
33
|
+
story.then('page loaded');
|
|
34
|
+
await expect(page).toHaveURL('/');
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// Fixture-aware step callbacks: pass fixtures into init
|
|
38
|
+
test('login flow', async ({ page }, testInfo) => {
|
|
39
|
+
story.init({ page }, testInfo);
|
|
40
|
+
await story.given('user is on login page', async ({ page }) => {
|
|
41
|
+
await page.goto('/login');
|
|
42
|
+
});
|
|
43
|
+
await story.when('user submits credentials', async ({ page }) => {
|
|
44
|
+
await page.getByRole('button', { name: 'Sign in' }).click();
|
|
45
|
+
});
|
|
46
|
+
story.then('user sees dashboard');
|
|
47
|
+
});
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Signature: `test('title', async ({ page }, testInfo) => { ... })` or `test('title', async ({}, testInfo) => { ... })`. Always pass `testInfo` into `story.init(...)`; pass the fixtures object as the first argument to `init` when you want step callbacks to receive it.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Reporter
|
|
55
|
+
|
|
56
|
+
Add the executable-stories reporter to your Playwright config. Use the **reporter module path** (string). You can pass options as the second element of the tuple; the reporter does not require a constructor call at the call site.
|
|
57
|
+
|
|
58
|
+
**Config (`playwright.config.ts`):**
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
import { defineConfig, devices } from '@playwright/test';
|
|
62
|
+
|
|
63
|
+
export default defineConfig({
|
|
64
|
+
testDir: './tests',
|
|
65
|
+
reporter: [
|
|
66
|
+
['list'],
|
|
67
|
+
['html'],
|
|
68
|
+
['executable-stories-playwright/reporter', {
|
|
69
|
+
formats: ['markdown'],
|
|
70
|
+
outputDir: 'docs',
|
|
71
|
+
outputName: 'user-stories',
|
|
72
|
+
output: { mode: 'aggregated' },
|
|
73
|
+
}],
|
|
74
|
+
],
|
|
75
|
+
use: { ...devices['Desktop Chrome'] },
|
|
76
|
+
});
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
If you need a resolved path (e.g. in some setups):
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
import { createRequire } from 'node:module';
|
|
83
|
+
const require = createRequire(import.meta.url);
|
|
84
|
+
const reporterPath = require.resolve('executable-stories-playwright/reporter');
|
|
85
|
+
|
|
86
|
+
export default defineConfig({
|
|
87
|
+
reporter: [
|
|
88
|
+
['list'],
|
|
89
|
+
[reporterPath, { formats: ['markdown'], outputDir: 'docs', outputName: 'user-stories' }],
|
|
90
|
+
],
|
|
91
|
+
});
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Options match [FormatterOptions](https://github.com/jagreehal/executable-stories/tree/main/packages/executable-stories-formatters) (e.g. `formats`, `outputDir`, `outputName`, `output`, `markdown`, `html`). Optional `rawRunPath` writes the raw run JSON for use with the executable-stories CLI.
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Step styles
|
|
99
|
+
|
|
100
|
+
Same two styles as the Vitest package: **marker-only** (code after the marker) and **optional callback** (function as second argument). When you pass a function, it is run and its return value (including a Promise) is returned so `await story.when('...', async () => { ... })` works.
|
|
101
|
+
|
|
102
|
+
**Fixture-aware callbacks:** To have step callbacks receive Playwright fixtures (e.g. `{ page }`), pass fixtures into `story.init`: use `story.init({ page }, testInfo)` (or `story.init(testInfo, { fixtures: { page } })`). Then you can write e.g. `story.given('user is on login page', async ({ page }) => { await page.goto('/login'); });` and the callback will receive the same fixtures object.
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## E2E example
|
|
107
|
+
|
|
108
|
+
Typical browser flow with `page`, navigation, locators, and Playwright `expect`:
|
|
109
|
+
|
|
110
|
+
```ts
|
|
111
|
+
import { test, expect } from '@playwright/test';
|
|
112
|
+
import { story } from 'executable-stories-playwright';
|
|
113
|
+
|
|
114
|
+
test('user can play diagram animation', async ({ page }, testInfo) => {
|
|
115
|
+
story.init(testInfo, { tags: ['e2e', 'animation'] });
|
|
116
|
+
|
|
117
|
+
story.given('the user is on the diagram page');
|
|
118
|
+
await page.goto('/diagrams');
|
|
119
|
+
await page.waitForSelector('.mermaid');
|
|
120
|
+
|
|
121
|
+
story.when('the user clicks Play');
|
|
122
|
+
await page.getByRole('button', { name: 'Play' }).click();
|
|
123
|
+
|
|
124
|
+
story.then('an active node is visible');
|
|
125
|
+
await expect(page.locator('.mf-state-active')).toBeVisible();
|
|
126
|
+
});
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Marker-only keeps the test flat; for async work, the test is `async` and you `await` after each marker. To use step callbacks with fixtures, pass fixtures into `story.init` (see [Required test signature](#required-test-signature)) and then use callbacks that accept the fixtures argument.
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Story options (`story.init(testInfo, options)` or `story.init(fixtures, testInfo, options)`)
|
|
134
|
+
|
|
135
|
+
| Option | Description |
|
|
136
|
+
| -------------------- | ----------- |
|
|
137
|
+
| `tags` | String array for categorization (e.g. `['e2e', 'auth']`). |
|
|
138
|
+
| `ticket` | Ticket/issue ID(s) for traceability. Single string or array (e.g. `'JIRA-123'` or `['JIRA-123', 'JIRA-456']`). Appears in reports and can be linked via `ticketUrlTemplate` in formatter options. |
|
|
139
|
+
| `meta` | Arbitrary key-value metadata. |
|
|
140
|
+
| `traceUrlTemplate` | URL template for OTel trace links; use `{traceId}` placeholder. When set (or via `OTEL_TRACE_URL_TEMPLATE`), the reporter can generate “View Trace” links in reports (e.g. to Grafana or your APM). |
|
|
141
|
+
| `fixtures` | Playwright fixtures object (same as the test callback's first argument). When set, step callbacks receive this as their first argument. You can instead pass fixtures as the first argument: `story.init(fixtures, testInfo)`. |
|
|
142
|
+
|
|
143
|
+
Example:
|
|
144
|
+
|
|
145
|
+
```ts
|
|
146
|
+
story.init(testInfo, {
|
|
147
|
+
tags: ['e2e', 'animations', 'play'],
|
|
148
|
+
ticket: 'JIRA-123',
|
|
149
|
+
traceUrlTemplate: 'https://grafana.example.com/explore?traceId={traceId}',
|
|
150
|
+
});
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## Developer experience
|
|
156
|
+
|
|
157
|
+
- **API:** Top-level step functions: `given`, `when`, `then`, `and`, `but` from `executable-stories-playwright`, plus `story` object with `story.init()` and the same steps on `story` for a consistent entry point. Use `story.init(testInfo)` and then `story.given` / `story.when` / `story.then`, etc.
|
|
158
|
+
- **Modifiers:** Playwright’s `.skip`, `.only`, `.fixme`, `.todo`, `.fail`, `.slow` on tests; use `story.skip` / `story.only` / `story.fixme` / `story.slow` for scenario-level modifiers.
|
|
159
|
+
- **Attach story to a plain test:** Use `doc.story('Title', testInfo)` or `doc.story('Title', (s) => { s.given(...); ... })` inside a normal `test()` so that test still appears in generated docs.
|
|
160
|
+
- **Rich step docs:** `story.note()`, `story.json()`, `story.code()`, `story.mermaid()`, etc., or pass a `StoryDocs` object as the second argument when not using a callback. See the root [Features matrix](https://github.com/jagreehal/executable-stories#features-matrix).
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Exports
|
|
165
|
+
|
|
166
|
+
- **Main:** `story`, types from `executable-stories-playwright`.
|
|
167
|
+
- **Reporter:** default reporter from `executable-stories-playwright/reporter` (use as module path in config); reporter option types are re-exported.
|
|
168
|
+
|
|
169
|
+
For output formats and formatter options, see [executable-stories-formatters](https://github.com/jagreehal/executable-stories/tree/main/packages/executable-stories-formatters).
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _playwright_test from '@playwright/test';
|
|
2
|
+
import { TestInfo, PlaywrightTestArgs, PlaywrightTestOptions } from '@playwright/test';
|
|
2
3
|
import { StepKeyword } from 'executable-stories-formatters';
|
|
3
4
|
export { DocEntry, StepKeyword, StoryMeta, StoryStep } from 'executable-stories-formatters';
|
|
4
5
|
|
|
@@ -68,6 +69,8 @@ interface StoryOptions {
|
|
|
68
69
|
meta?: Record<string, unknown>;
|
|
69
70
|
/** URL template for OTel trace links. Uses {traceId} placeholder. Also settable via OTEL_TRACE_URL_TEMPLATE env var. */
|
|
70
71
|
traceUrlTemplate?: string;
|
|
72
|
+
/** Playwright fixtures (first argument of the test callback). When set, step callbacks receive this as their first argument. */
|
|
73
|
+
fixtures?: unknown;
|
|
71
74
|
}
|
|
72
75
|
/** Options for story.attach(). */
|
|
73
76
|
interface AttachmentOptions {
|
|
@@ -105,12 +108,15 @@ interface AttachmentOptions {
|
|
|
105
108
|
* ```
|
|
106
109
|
*/
|
|
107
110
|
|
|
108
|
-
|
|
111
|
+
/** Fixture type for step callbacks: Playwright test args + options; custom extend() fixtures as unknown. */
|
|
112
|
+
type PlaywrightFixtures = PlaywrightTestArgs & PlaywrightTestOptions & Record<string, unknown>;
|
|
113
|
+
/** init(testInfo) or init(fixtures, testInfo) or init(testInfo, { fixtures }). */
|
|
114
|
+
declare function init(first: TestInfo | unknown, second?: StoryOptions | TestInfo, third?: StoryOptions): void;
|
|
109
115
|
/**
|
|
110
116
|
* Wrap a function as a step with timing and error capture.
|
|
111
117
|
* Records the step with `wrapped: true` and `durationMs`.
|
|
112
118
|
*/
|
|
113
|
-
declare function fn<T>(keyword: StepKeyword, text: string, body: () => T): T;
|
|
119
|
+
declare function fn<T>(keyword: StepKeyword, text: string, body: (fixtures: PlaywrightFixtures) => T): T;
|
|
114
120
|
/**
|
|
115
121
|
* Wrap an assertion as a Then step with timing and error capture.
|
|
116
122
|
* Shorthand for `story.fn('Then', text, body)`.
|
|
@@ -119,19 +125,58 @@ declare function storyExpect<T>(text: string, body: () => T): T;
|
|
|
119
125
|
declare function playwrightAttach(options: AttachmentOptions): void;
|
|
120
126
|
declare const story: {
|
|
121
127
|
init: typeof init;
|
|
122
|
-
given:
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
128
|
+
given: {
|
|
129
|
+
(text: string, docs?: StoryDocs): void;
|
|
130
|
+
<T>(text: string, body: (fixtures: PlaywrightFixtures) => T): T;
|
|
131
|
+
};
|
|
132
|
+
when: {
|
|
133
|
+
(text: string, docs?: StoryDocs): void;
|
|
134
|
+
<T>(text: string, body: (fixtures: PlaywrightFixtures) => T): T;
|
|
135
|
+
};
|
|
136
|
+
then: {
|
|
137
|
+
(text: string, docs?: StoryDocs): void;
|
|
138
|
+
<T>(text: string, body: (fixtures: PlaywrightFixtures) => T): T;
|
|
139
|
+
};
|
|
140
|
+
and: {
|
|
141
|
+
(text: string, docs?: StoryDocs): void;
|
|
142
|
+
<T>(text: string, body: (fixtures: PlaywrightFixtures) => T): T;
|
|
143
|
+
};
|
|
144
|
+
but: {
|
|
145
|
+
(text: string, docs?: StoryDocs): void;
|
|
146
|
+
<T>(text: string, body: (fixtures: PlaywrightFixtures) => T): T;
|
|
147
|
+
};
|
|
148
|
+
arrange: {
|
|
149
|
+
(text: string, docs?: StoryDocs): void;
|
|
150
|
+
<T>(text: string, body: (fixtures: PlaywrightFixtures) => T): T;
|
|
151
|
+
};
|
|
152
|
+
act: {
|
|
153
|
+
(text: string, docs?: StoryDocs): void;
|
|
154
|
+
<T>(text: string, body: (fixtures: PlaywrightFixtures) => T): T;
|
|
155
|
+
};
|
|
156
|
+
assert: {
|
|
157
|
+
(text: string, docs?: StoryDocs): void;
|
|
158
|
+
<T>(text: string, body: (fixtures: PlaywrightFixtures) => T): T;
|
|
159
|
+
};
|
|
160
|
+
setup: {
|
|
161
|
+
(text: string, docs?: StoryDocs): void;
|
|
162
|
+
<T>(text: string, body: (fixtures: PlaywrightFixtures) => T): T;
|
|
163
|
+
};
|
|
164
|
+
context: {
|
|
165
|
+
(text: string, docs?: StoryDocs): void;
|
|
166
|
+
<T>(text: string, body: (fixtures: PlaywrightFixtures) => T): T;
|
|
167
|
+
};
|
|
168
|
+
execute: {
|
|
169
|
+
(text: string, docs?: StoryDocs): void;
|
|
170
|
+
<T>(text: string, body: (fixtures: PlaywrightFixtures) => T): T;
|
|
171
|
+
};
|
|
172
|
+
action: {
|
|
173
|
+
(text: string, docs?: StoryDocs): void;
|
|
174
|
+
<T>(text: string, body: (fixtures: PlaywrightFixtures) => T): T;
|
|
175
|
+
};
|
|
176
|
+
verify: {
|
|
177
|
+
(text: string, docs?: StoryDocs): void;
|
|
178
|
+
<T>(text: string, body: (fixtures: PlaywrightFixtures) => T): T;
|
|
179
|
+
};
|
|
135
180
|
note(text: string): void;
|
|
136
181
|
tag(name: string | string[]): void;
|
|
137
182
|
kv(options: KvOptions): void;
|
|
@@ -151,4 +196,25 @@ declare const story: {
|
|
|
151
196
|
};
|
|
152
197
|
type Story = typeof story;
|
|
153
198
|
|
|
154
|
-
|
|
199
|
+
declare const given: {
|
|
200
|
+
(text: string, docs?: StoryDocs): void;
|
|
201
|
+
<T>(text: string, body: (fixtures: _playwright_test.PlaywrightTestArgs & _playwright_test.PlaywrightTestOptions & Record<string, unknown>) => T): T;
|
|
202
|
+
};
|
|
203
|
+
declare const when: {
|
|
204
|
+
(text: string, docs?: StoryDocs): void;
|
|
205
|
+
<T>(text: string, body: (fixtures: _playwright_test.PlaywrightTestArgs & _playwright_test.PlaywrightTestOptions & Record<string, unknown>) => T): T;
|
|
206
|
+
};
|
|
207
|
+
declare const then: {
|
|
208
|
+
(text: string, docs?: StoryDocs): void;
|
|
209
|
+
<T>(text: string, body: (fixtures: _playwright_test.PlaywrightTestArgs & _playwright_test.PlaywrightTestOptions & Record<string, unknown>) => T): T;
|
|
210
|
+
};
|
|
211
|
+
declare const and: {
|
|
212
|
+
(text: string, docs?: StoryDocs): void;
|
|
213
|
+
<T>(text: string, body: (fixtures: _playwright_test.PlaywrightTestArgs & _playwright_test.PlaywrightTestOptions & Record<string, unknown>) => T): T;
|
|
214
|
+
};
|
|
215
|
+
declare const but: {
|
|
216
|
+
(text: string, docs?: StoryDocs): void;
|
|
217
|
+
<T>(text: string, body: (fixtures: _playwright_test.PlaywrightTestArgs & _playwright_test.PlaywrightTestOptions & Record<string, unknown>) => T): T;
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
export { type CodeOptions, type CustomOptions, type JsonOptions, type KvOptions, type LinkOptions, type MermaidOptions, type ScreenshotOptions, type SectionOptions, type Story, type StoryDocs, type StoryOptions, type TableOptions, and, but, given, story, then, when };
|
package/dist/index.js
CHANGED
|
@@ -121,20 +121,66 @@ function extractSuitePath(testInfo) {
|
|
|
121
121
|
return suitePath.length > 0 ? suitePath : void 0;
|
|
122
122
|
}
|
|
123
123
|
function createStepMarker(keyword) {
|
|
124
|
-
|
|
124
|
+
function stepMarker(text, docsOrBody) {
|
|
125
125
|
const ctx = getContext();
|
|
126
|
+
const isCallback = typeof docsOrBody === "function";
|
|
127
|
+
const resolvedKeyword = (keyword === "Given" || keyword === "When" || keyword === "Then") && ctx.meta.steps.some((s) => s.keyword === keyword) ? "And" : keyword;
|
|
126
128
|
const step = {
|
|
127
129
|
id: `step-${ctx.stepCounter++}`,
|
|
128
|
-
keyword,
|
|
130
|
+
keyword: resolvedKeyword,
|
|
129
131
|
text,
|
|
130
|
-
docs:
|
|
132
|
+
docs: !isCallback && docsOrBody ? convertStoryDocsToEntries(docsOrBody) : [],
|
|
133
|
+
...isCallback ? { wrapped: true } : {}
|
|
131
134
|
};
|
|
132
135
|
ctx.meta.steps.push(step);
|
|
133
136
|
ctx.currentStep = step;
|
|
134
137
|
syncAnnotationToTest();
|
|
135
|
-
|
|
138
|
+
if (!isCallback) return;
|
|
139
|
+
const body = docsOrBody;
|
|
140
|
+
const start = performance.now();
|
|
141
|
+
try {
|
|
142
|
+
const result = ctx.fixtures !== void 0 ? body(ctx.fixtures) : body();
|
|
143
|
+
if (result instanceof Promise) {
|
|
144
|
+
return result.then(
|
|
145
|
+
(val) => {
|
|
146
|
+
step.durationMs = performance.now() - start;
|
|
147
|
+
syncAnnotationToTest();
|
|
148
|
+
return val;
|
|
149
|
+
},
|
|
150
|
+
(err) => {
|
|
151
|
+
step.durationMs = performance.now() - start;
|
|
152
|
+
syncAnnotationToTest();
|
|
153
|
+
throw err;
|
|
154
|
+
}
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
step.durationMs = performance.now() - start;
|
|
158
|
+
syncAnnotationToTest();
|
|
159
|
+
return result;
|
|
160
|
+
} catch (err) {
|
|
161
|
+
step.durationMs = performance.now() - start;
|
|
162
|
+
syncAnnotationToTest();
|
|
163
|
+
throw err;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return stepMarker;
|
|
167
|
+
}
|
|
168
|
+
function isTestInfo(x) {
|
|
169
|
+
return typeof x === "object" && x !== null && "title" in x && "annotations" in x && Array.isArray(x.annotations);
|
|
136
170
|
}
|
|
137
|
-
function init(
|
|
171
|
+
function init(first, second, third) {
|
|
172
|
+
let testInfo;
|
|
173
|
+
let options;
|
|
174
|
+
let fixtures;
|
|
175
|
+
if (second !== void 0 && isTestInfo(second)) {
|
|
176
|
+
fixtures = first;
|
|
177
|
+
testInfo = second;
|
|
178
|
+
options = third;
|
|
179
|
+
} else {
|
|
180
|
+
testInfo = first;
|
|
181
|
+
options = second;
|
|
182
|
+
fixtures = options?.fixtures;
|
|
183
|
+
}
|
|
138
184
|
const meta = {
|
|
139
185
|
scenario: testInfo.title,
|
|
140
186
|
steps: [],
|
|
@@ -180,7 +226,8 @@ function init(testInfo, options) {
|
|
|
180
226
|
stepCounter: 0,
|
|
181
227
|
attachments: [],
|
|
182
228
|
activeTimers: /* @__PURE__ */ new Map(),
|
|
183
|
-
timerCounter: 0
|
|
229
|
+
timerCounter: 0,
|
|
230
|
+
fixtures
|
|
184
231
|
};
|
|
185
232
|
activeTestInfo = testInfo;
|
|
186
233
|
}
|
|
@@ -195,9 +242,10 @@ function syncAnnotationToTest() {
|
|
|
195
242
|
}
|
|
196
243
|
function fn(keyword, text, body) {
|
|
197
244
|
const ctx = getContext();
|
|
245
|
+
const resolvedKeyword = (keyword === "Given" || keyword === "When" || keyword === "Then") && ctx.meta.steps.some((s) => s.keyword === keyword) ? "And" : keyword;
|
|
198
246
|
const step = {
|
|
199
247
|
id: `step-${ctx.stepCounter++}`,
|
|
200
|
-
keyword,
|
|
248
|
+
keyword: resolvedKeyword,
|
|
201
249
|
text,
|
|
202
250
|
docs: [],
|
|
203
251
|
wrapped: true
|
|
@@ -207,7 +255,7 @@ function fn(keyword, text, body) {
|
|
|
207
255
|
syncAnnotationToTest();
|
|
208
256
|
const start = performance.now();
|
|
209
257
|
try {
|
|
210
|
-
const result = body();
|
|
258
|
+
const result = ctx.fixtures !== void 0 ? body(ctx.fixtures) : body();
|
|
211
259
|
if (result instanceof Promise) {
|
|
212
260
|
return result.then(
|
|
213
261
|
(val) => {
|
|
@@ -355,7 +403,19 @@ var story = {
|
|
|
355
403
|
fn,
|
|
356
404
|
expect: storyExpect
|
|
357
405
|
};
|
|
406
|
+
|
|
407
|
+
// src/index.ts
|
|
408
|
+
var given = story.given;
|
|
409
|
+
var when = story.when;
|
|
410
|
+
var then = story.then;
|
|
411
|
+
var and = story.and;
|
|
412
|
+
var but = story.but;
|
|
358
413
|
export {
|
|
359
|
-
|
|
414
|
+
and,
|
|
415
|
+
but,
|
|
416
|
+
given,
|
|
417
|
+
story,
|
|
418
|
+
then,
|
|
419
|
+
when
|
|
360
420
|
};
|
|
361
421
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/story-api.ts"],"sourcesContent":["/**\n * Playwright story.* API for executable-stories.\n *\n * Uses native Playwright test() with opt-in documentation:\n *\n * @example\n * ```ts\n * import { test, expect } from '@playwright/test';\n * import { story } from 'executable-stories-playwright';\n *\n * test.describe('Calculator', () => {\n * test('adds two numbers', async ({ page }, testInfo) => {\n * story.init(testInfo);\n *\n * story.given('two numbers 5 and 3');\n * const a = 5;\n * const b = 3;\n *\n * story.when('I add them together');\n * const result = a + b;\n *\n * story.then('the result is 8');\n * expect(result).toBe(8);\n * });\n * });\n * ```\n */\n\nimport { createRequire } from 'node:module';\nimport type { TestInfo } from '@playwright/test';\nimport {\n tryGetActiveOtelContext,\n resolveTraceUrl,\n} from 'executable-stories-formatters';\nimport type {\n StepKeyword,\n StoryMeta,\n StoryStep,\n DocEntry,\n} from './types';\nimport type {\n StoryDocs,\n StoryOptions,\n AttachmentOptions,\n ScopedAttachment,\n KvOptions,\n JsonOptions,\n CodeOptions,\n TableOptions,\n LinkOptions,\n SectionOptions,\n MermaidOptions,\n ScreenshotOptions,\n CustomOptions,\n} from './types';\n\n// Re-export types for consumers\nexport type {\n StoryMeta,\n StoryStep,\n DocEntry,\n StepKeyword,\n StoryDocs,\n StoryOptions,\n AttachmentOptions,\n} from './types';\n\n// ============================================================================\n// Internal types\n// ============================================================================\n\ninterface TimerEntry {\n start: number;\n stepIndex?: number;\n stepId?: string;\n consumed: boolean;\n}\n\ninterface StoryContext {\n meta: StoryMeta;\n currentStep: StoryStep | null;\n stepCounter: number;\n attachments: ScopedAttachment[];\n activeTimers: Map<number, TimerEntry>;\n timerCounter: number;\n}\n\n// ============================================================================\n// Playwright-specific context\n// ============================================================================\n\n/** Active story context - set by story.init() */\nlet activeContext: StoryContext | null = null;\n\n/** Reference to testInfo for attaching metadata */\nlet activeTestInfo: TestInfo | null = null;\n\n/** Counter to track source order of stories (increments on each story.init call) */\nlet sourceOrderCounter = 0;\n\n/**\n * Get the current story context. Throws if story.init() wasn't called.\n */\nfunction getContext(): StoryContext {\n if (!activeContext) {\n throw new Error(\n \"story.init(testInfo) must be called first. Use: test('name', async ({ page }, testInfo) => { story.init(testInfo); ... });\",\n );\n }\n return activeContext;\n}\n\n// ============================================================================\n// Helper functions (inlined from core)\n// ============================================================================\n\nfunction normalizeTickets(ticket: string | string[] | undefined): string[] | undefined {\n if (!ticket) return undefined;\n return Array.isArray(ticket) ? ticket : [ticket];\n}\n\nfunction convertStoryDocsToEntries(docs: StoryDocs): DocEntry[] {\n const entries: DocEntry[] = [];\n\n if (docs.note) {\n entries.push({ kind: 'note', text: docs.note, phase: 'runtime' });\n }\n if (docs.tag) {\n const names = Array.isArray(docs.tag) ? docs.tag : [docs.tag];\n entries.push({ kind: 'tag', names, phase: 'runtime' });\n }\n if (docs.kv) {\n for (const [label, value] of Object.entries(docs.kv)) {\n entries.push({ kind: 'kv', label, value, phase: 'runtime' });\n }\n }\n if (docs.code) {\n entries.push({\n kind: 'code',\n label: docs.code.label,\n content: docs.code.content,\n lang: docs.code.lang,\n phase: 'runtime',\n });\n }\n if (docs.json) {\n entries.push({\n kind: 'code',\n label: docs.json.label,\n content: JSON.stringify(docs.json.value, null, 2),\n lang: 'json',\n phase: 'runtime',\n });\n }\n if (docs.table) {\n entries.push({\n kind: 'table',\n label: docs.table.label,\n columns: docs.table.columns,\n rows: docs.table.rows,\n phase: 'runtime',\n });\n }\n if (docs.link) {\n entries.push({\n kind: 'link',\n label: docs.link.label,\n url: docs.link.url,\n phase: 'runtime',\n });\n }\n if (docs.section) {\n entries.push({\n kind: 'section',\n title: docs.section.title,\n markdown: docs.section.markdown,\n phase: 'runtime',\n });\n }\n if (docs.mermaid) {\n entries.push({\n kind: 'mermaid',\n code: docs.mermaid.code,\n title: docs.mermaid.title,\n phase: 'runtime',\n });\n }\n if (docs.screenshot) {\n entries.push({\n kind: 'screenshot',\n path: docs.screenshot.path,\n alt: docs.screenshot.alt,\n phase: 'runtime',\n });\n }\n if (docs.custom) {\n entries.push({\n kind: 'custom',\n type: docs.custom.type,\n data: docs.custom.data,\n phase: 'runtime',\n });\n }\n\n return entries;\n}\n\nfunction attachDoc(entry: DocEntry): void {\n const ctx = getContext();\n if (ctx.currentStep) {\n ctx.currentStep.docs ??= [];\n ctx.currentStep.docs.push(entry);\n } else {\n ctx.meta.docs ??= [];\n ctx.meta.docs.push(entry);\n }\n}\n\n// ============================================================================\n// Suite path extraction\n// ============================================================================\n\n/**\n * Extract the suite path from testInfo.titlePath.\n * Playwright's titlePath includes: [projectName, ...describeTitles, testTitle]\n * We want just the describe titles (excluding project and test name).\n */\nfunction extractSuitePath(testInfo: TestInfo): string[] | undefined {\n const titlePath = testInfo.titlePath;\n if (titlePath.length <= 2) {\n return undefined;\n }\n const suitePath = titlePath.slice(1, -1);\n return suitePath.length > 0 ? suitePath : undefined;\n}\n\n// ============================================================================\n// Step markers\n// ============================================================================\n\nfunction createStepMarker(keyword: StepKeyword) {\n return function stepMarker(text: string, docs?: StoryDocs): void {\n const ctx = getContext();\n const step: StoryStep = {\n id: `step-${ctx.stepCounter++}`,\n keyword,\n text,\n docs: docs ? convertStoryDocsToEntries(docs) : [],\n };\n ctx.meta.steps.push(step);\n ctx.currentStep = step;\n syncAnnotationToTest();\n };\n}\n\n// ============================================================================\n// story.init() - Playwright-specific\n// ============================================================================\n\nfunction init(testInfo: TestInfo, options?: StoryOptions): void {\n const meta: StoryMeta = {\n scenario: testInfo.title,\n steps: [],\n suitePath: extractSuitePath(testInfo),\n tags: options?.tags,\n tickets: normalizeTickets(options?.ticket),\n meta: options?.meta,\n sourceOrder: sourceOrderCounter++,\n };\n\n // OTel bridge: detect active span, flow data bidirectionally\n const otelCtx = tryGetActiveOtelContext();\n if (otelCtx) {\n // OTel -> Story: capture traceId in structured meta\n meta.meta = { ...meta.meta, otel: { traceId: otelCtx.traceId, spanId: otelCtx.spanId } };\n\n // OTel -> Story: inject human-readable doc entries\n meta.docs = meta.docs ?? [];\n meta.docs.push({ kind: 'kv', label: 'Trace ID', value: otelCtx.traceId, phase: 'runtime' });\n\n const template = options?.traceUrlTemplate ?? process.env.OTEL_TRACE_URL_TEMPLATE;\n const url = resolveTraceUrl(template, otelCtx.traceId);\n if (url) {\n meta.docs.push({ kind: 'link', label: 'View Trace', url, phase: 'runtime' });\n }\n\n // Story -> OTel: enrich active span with story attributes\n try {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n const reqUrl = import.meta.url\n ?? (typeof __filename !== 'undefined' ? `file://${__filename}` : undefined);\n const req = createRequire(reqUrl!);\n const api = req('@opentelemetry/api');\n const span = api.trace?.getActiveSpan?.();\n if (span) {\n span.setAttribute('story.scenario', testInfo.title);\n if (options?.tags?.length) span.setAttribute('story.tags', options.tags);\n if (options?.ticket) {\n const tickets = Array.isArray(options.ticket) ? options.ticket : [options.ticket];\n span.setAttribute('story.tickets', tickets);\n }\n }\n } catch { /* OTel not available */ }\n }\n\n testInfo.annotations.push({\n type: 'story-meta',\n description: JSON.stringify(meta),\n });\n\n activeContext = {\n meta,\n currentStep: null,\n stepCounter: 0,\n attachments: [],\n activeTimers: new Map(),\n timerCounter: 0,\n };\n activeTestInfo = testInfo;\n}\n\n/**\n * Update the story-meta annotation on testInfo with the current meta (including steps).\n * Called after each step/doc so the reporter sees the full story in onTestEnd.\n */\nfunction syncAnnotationToTest(): void {\n if (!activeTestInfo || !activeContext) return;\n const annotation = activeTestInfo.annotations.find(\n (a) => a.type === 'story-meta',\n );\n if (annotation) {\n annotation.description = JSON.stringify(activeContext.meta);\n }\n}\n\n// ============================================================================\n// story.fn() and story.expect()\n// ============================================================================\n\n/**\n * Wrap a function as a step with timing and error capture.\n * Records the step with `wrapped: true` and `durationMs`.\n */\nfunction fn<T>(keyword: StepKeyword, text: string, body: () => T): T {\n const ctx = getContext();\n const step: StoryStep = {\n id: `step-${ctx.stepCounter++}`,\n keyword,\n text,\n docs: [],\n wrapped: true,\n };\n ctx.meta.steps.push(step);\n ctx.currentStep = step;\n syncAnnotationToTest();\n\n const start = performance.now();\n try {\n const result = body();\n if (result instanceof Promise) {\n return result.then(\n (val) => {\n step.durationMs = performance.now() - start;\n syncAnnotationToTest();\n return val;\n },\n (err) => {\n step.durationMs = performance.now() - start;\n syncAnnotationToTest();\n throw err;\n },\n ) as T;\n }\n step.durationMs = performance.now() - start;\n syncAnnotationToTest();\n return result;\n } catch (err) {\n step.durationMs = performance.now() - start;\n syncAnnotationToTest();\n throw err;\n }\n}\n\n/**\n * Wrap an assertion as a Then step with timing and error capture.\n * Shorthand for `story.fn('Then', text, body)`.\n */\nfunction storyExpect<T>(text: string, body: () => T): T {\n return fn('Then', text, body);\n}\n\n// ============================================================================\n// Playwright-specific attach\n// ============================================================================\n\nfunction playwrightAttach(options: AttachmentOptions): void {\n const ctx = getContext();\n const stepIndex = ctx.currentStep\n ? ctx.meta.steps.indexOf(ctx.currentStep)\n : undefined;\n ctx.attachments.push({\n ...options,\n stepId: ctx.currentStep?.id,\n });\n syncAnnotationToTest();\n\n if (activeTestInfo) {\n const attachOptions: { name: string; contentType: string; path?: string; body?: string | Buffer } = {\n name: options.name,\n contentType: options.mediaType,\n };\n if (options.path) attachOptions.path = options.path;\n if (options.body) attachOptions.body = options.body;\n activeTestInfo.attach(options.name, attachOptions);\n }\n}\n\n// ============================================================================\n// Export story object\n// ============================================================================\n\nexport const story = {\n init,\n\n // BDD step markers\n given: createStepMarker('Given'),\n when: createStepMarker('When'),\n then: createStepMarker('Then'),\n and: createStepMarker('And'),\n but: createStepMarker('But'),\n\n // AAA pattern aliases\n arrange: createStepMarker('Given'),\n act: createStepMarker('When'),\n assert: createStepMarker('Then'),\n\n // Additional aliases\n setup: createStepMarker('Given'),\n context: createStepMarker('Given'),\n execute: createStepMarker('When'),\n action: createStepMarker('When'),\n verify: createStepMarker('Then'),\n\n // Standalone doc methods\n note(text: string): void {\n attachDoc({ kind: 'note', text, phase: 'runtime' });\n syncAnnotationToTest();\n },\n\n tag(name: string | string[]): void {\n const names = Array.isArray(name) ? name : [name];\n attachDoc({ kind: 'tag', names, phase: 'runtime' });\n syncAnnotationToTest();\n },\n\n kv(options: KvOptions): void {\n attachDoc({ kind: 'kv', label: options.label, value: options.value, phase: 'runtime' });\n syncAnnotationToTest();\n },\n\n json(options: JsonOptions): void {\n const content = JSON.stringify(options.value, null, 2);\n attachDoc({ kind: 'code', label: options.label, content, lang: 'json', phase: 'runtime' });\n syncAnnotationToTest();\n },\n\n code(options: CodeOptions): void {\n attachDoc({ kind: 'code', label: options.label, content: options.content, lang: options.lang, phase: 'runtime' });\n syncAnnotationToTest();\n },\n\n table(options: TableOptions): void {\n attachDoc({ kind: 'table', label: options.label, columns: options.columns, rows: options.rows, phase: 'runtime' });\n syncAnnotationToTest();\n },\n\n link(options: LinkOptions): void {\n attachDoc({ kind: 'link', label: options.label, url: options.url, phase: 'runtime' });\n syncAnnotationToTest();\n },\n\n section(options: SectionOptions): void {\n attachDoc({ kind: 'section', title: options.title, markdown: options.markdown, phase: 'runtime' });\n syncAnnotationToTest();\n },\n\n mermaid(options: MermaidOptions): void {\n attachDoc({ kind: 'mermaid', code: options.code, title: options.title, phase: 'runtime' });\n syncAnnotationToTest();\n },\n\n screenshot(options: ScreenshotOptions): void {\n attachDoc({ kind: 'screenshot', path: options.path, alt: options.alt, phase: 'runtime' });\n syncAnnotationToTest();\n },\n\n custom(options: CustomOptions): void {\n attachDoc({ kind: 'custom', type: options.type, data: options.data, phase: 'runtime' });\n syncAnnotationToTest();\n },\n\n // Attachments\n attach: playwrightAttach,\n\n // Step timing\n startTimer(): number {\n const ctx = getContext();\n const token = ctx.timerCounter++;\n const stepIndex = ctx.currentStep\n ? ctx.meta.steps.indexOf(ctx.currentStep)\n : undefined;\n ctx.activeTimers.set(token, {\n start: performance.now(),\n stepIndex: stepIndex !== undefined && stepIndex >= 0 ? stepIndex : undefined,\n stepId: ctx.currentStep?.id,\n consumed: false,\n });\n syncAnnotationToTest();\n return token;\n },\n\n endTimer(token: number): void {\n const ctx = getContext();\n const entry = ctx.activeTimers.get(token);\n if (!entry || entry.consumed) return;\n\n entry.consumed = true;\n const durationMs = performance.now() - entry.start;\n\n let step: StoryStep | undefined;\n if (entry.stepId) {\n step = ctx.meta.steps.find((s) => s.id === entry.stepId);\n }\n if (!step && entry.stepIndex !== undefined) {\n step = ctx.meta.steps[entry.stepIndex];\n }\n\n if (step) {\n step.durationMs = durationMs;\n }\n syncAnnotationToTest();\n },\n\n // Step wrappers\n fn,\n expect: storyExpect,\n};\n\nexport type Story = typeof story;\n"],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MAAM,WAAW;AACvB,UAAM,QAAQ,IAAI,aAAa,IAAI,KAAK;AACxC,QAAI,CAAC,SAAS,MAAM,SAAU;AAE9B,UAAM,WAAW;AACjB,UAAM,aAAa,YAAY,IAAI,IAAI,MAAM;AAE7C,QAAI;AACJ,QAAI,MAAM,QAAQ;AAChB,aAAO,IAAI,KAAK,MAAM,KAAK,CAAC,MAAM,EAAE,OAAO,MAAM,MAAM;AAAA,IACzD;AACA,QAAI,CAAC,QAAQ,MAAM,cAAc,QAAW;AAC1C,aAAO,IAAI,KAAK,MAAM,MAAM,SAAS;AAAA,IACvC;AAEA,QAAI,MAAM;AACR,WAAK,aAAa;AAAA,IACpB;AACA,yBAAqB;AAAA,EACvB;AAAA;AAAA,EAGA;AAAA,EACA,QAAQ;AACV;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/story-api.ts","../src/index.ts"],"sourcesContent":["/**\n * Playwright story.* API for executable-stories.\n *\n * Uses native Playwright test() with opt-in documentation:\n *\n * @example\n * ```ts\n * import { test, expect } from '@playwright/test';\n * import { story } from 'executable-stories-playwright';\n *\n * test.describe('Calculator', () => {\n * test('adds two numbers', async ({ page }, testInfo) => {\n * story.init(testInfo);\n *\n * story.given('two numbers 5 and 3');\n * const a = 5;\n * const b = 3;\n *\n * story.when('I add them together');\n * const result = a + b;\n *\n * story.then('the result is 8');\n * expect(result).toBe(8);\n * });\n * });\n * ```\n */\n\nimport { createRequire } from 'node:module';\nimport type { TestInfo, PlaywrightTestArgs, PlaywrightTestOptions } from '@playwright/test';\nimport {\n tryGetActiveOtelContext,\n resolveTraceUrl,\n} from 'executable-stories-formatters';\nimport type {\n StepKeyword,\n StoryMeta,\n StoryStep,\n DocEntry,\n} from './types';\nimport type {\n StoryDocs,\n StoryOptions,\n AttachmentOptions,\n ScopedAttachment,\n KvOptions,\n JsonOptions,\n CodeOptions,\n TableOptions,\n LinkOptions,\n SectionOptions,\n MermaidOptions,\n ScreenshotOptions,\n CustomOptions,\n} from './types';\n\n// Re-export types for consumers\nexport type {\n StoryMeta,\n StoryStep,\n DocEntry,\n StepKeyword,\n StoryDocs,\n StoryOptions,\n AttachmentOptions,\n} from './types';\n\n// ============================================================================\n// Internal types\n// ============================================================================\n\n/** Fixture type for step callbacks: Playwright test args + options; custom extend() fixtures as unknown. */\ntype PlaywrightFixtures = PlaywrightTestArgs & PlaywrightTestOptions & Record<string, unknown>;\n\ninterface TimerEntry {\n start: number;\n stepIndex?: number;\n stepId?: string;\n consumed: boolean;\n}\n\ninterface StoryContext {\n meta: StoryMeta;\n currentStep: StoryStep | null;\n stepCounter: number;\n attachments: ScopedAttachment[];\n activeTimers: Map<number, TimerEntry>;\n timerCounter: number;\n fixtures?: Record<string, unknown>;\n}\n\n// ============================================================================\n// Playwright-specific context\n// ============================================================================\n\n/** Active story context - set by story.init() */\nlet activeContext: StoryContext | null = null;\n\n/** Reference to testInfo for attaching metadata */\nlet activeTestInfo: TestInfo | null = null;\n\n/** Counter to track source order of stories (increments on each story.init call) */\nlet sourceOrderCounter = 0;\n\n/**\n * Get the current story context. Throws if story.init() wasn't called.\n */\nfunction getContext(): StoryContext {\n if (!activeContext) {\n throw new Error(\n \"story.init(testInfo) must be called first. Use: test('name', async ({ page }, testInfo) => { story.init(testInfo); ... });\",\n );\n }\n return activeContext;\n}\n\n// ============================================================================\n// Helper functions (inlined from core)\n// ============================================================================\n\nfunction normalizeTickets(ticket: string | string[] | undefined): string[] | undefined {\n if (!ticket) return undefined;\n return Array.isArray(ticket) ? ticket : [ticket];\n}\n\nfunction convertStoryDocsToEntries(docs: StoryDocs): DocEntry[] {\n const entries: DocEntry[] = [];\n\n if (docs.note) {\n entries.push({ kind: 'note', text: docs.note, phase: 'runtime' });\n }\n if (docs.tag) {\n const names = Array.isArray(docs.tag) ? docs.tag : [docs.tag];\n entries.push({ kind: 'tag', names, phase: 'runtime' });\n }\n if (docs.kv) {\n for (const [label, value] of Object.entries(docs.kv)) {\n entries.push({ kind: 'kv', label, value, phase: 'runtime' });\n }\n }\n if (docs.code) {\n entries.push({\n kind: 'code',\n label: docs.code.label,\n content: docs.code.content,\n lang: docs.code.lang,\n phase: 'runtime',\n });\n }\n if (docs.json) {\n entries.push({\n kind: 'code',\n label: docs.json.label,\n content: JSON.stringify(docs.json.value, null, 2),\n lang: 'json',\n phase: 'runtime',\n });\n }\n if (docs.table) {\n entries.push({\n kind: 'table',\n label: docs.table.label,\n columns: docs.table.columns,\n rows: docs.table.rows,\n phase: 'runtime',\n });\n }\n if (docs.link) {\n entries.push({\n kind: 'link',\n label: docs.link.label,\n url: docs.link.url,\n phase: 'runtime',\n });\n }\n if (docs.section) {\n entries.push({\n kind: 'section',\n title: docs.section.title,\n markdown: docs.section.markdown,\n phase: 'runtime',\n });\n }\n if (docs.mermaid) {\n entries.push({\n kind: 'mermaid',\n code: docs.mermaid.code,\n title: docs.mermaid.title,\n phase: 'runtime',\n });\n }\n if (docs.screenshot) {\n entries.push({\n kind: 'screenshot',\n path: docs.screenshot.path,\n alt: docs.screenshot.alt,\n phase: 'runtime',\n });\n }\n if (docs.custom) {\n entries.push({\n kind: 'custom',\n type: docs.custom.type,\n data: docs.custom.data,\n phase: 'runtime',\n });\n }\n\n return entries;\n}\n\nfunction attachDoc(entry: DocEntry): void {\n const ctx = getContext();\n if (ctx.currentStep) {\n ctx.currentStep.docs ??= [];\n ctx.currentStep.docs.push(entry);\n } else {\n ctx.meta.docs ??= [];\n ctx.meta.docs.push(entry);\n }\n}\n\n// ============================================================================\n// Suite path extraction\n// ============================================================================\n\n/**\n * Extract the suite path from testInfo.titlePath.\n * Playwright's titlePath includes: [projectName, ...describeTitles, testTitle]\n * We want just the describe titles (excluding project and test name).\n */\nfunction extractSuitePath(testInfo: TestInfo): string[] | undefined {\n const titlePath = testInfo.titlePath;\n if (titlePath.length <= 2) {\n return undefined;\n }\n const suitePath = titlePath.slice(1, -1);\n return suitePath.length > 0 ? suitePath : undefined;\n}\n\n// ============================================================================\n// Step markers\n// ============================================================================\n\nfunction createStepMarker(keyword: StepKeyword) {\n function stepMarker(text: string, docs?: StoryDocs): void;\n function stepMarker<T>(text: string, body: (fixtures: PlaywrightFixtures) => T): T;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n function stepMarker<T>(text: string, docsOrBody?: StoryDocs | ((...args: any[]) => T)): T | void {\n const ctx = getContext();\n const isCallback = typeof docsOrBody === 'function';\n\n const resolvedKeyword: StepKeyword =\n (keyword === 'Given' || keyword === 'When' || keyword === 'Then') &&\n ctx.meta.steps.some((s) => s.keyword === keyword)\n ? 'And'\n : keyword;\n\n const step: StoryStep = {\n id: `step-${ctx.stepCounter++}`,\n keyword: resolvedKeyword,\n text,\n docs: (!isCallback && docsOrBody) ? convertStoryDocsToEntries(docsOrBody) : [],\n ...(isCallback ? { wrapped: true } : {}),\n };\n\n ctx.meta.steps.push(step);\n ctx.currentStep = step;\n syncAnnotationToTest();\n\n if (!isCallback) return;\n\n const body = docsOrBody as (fixtures?: PlaywrightFixtures) => T;\n const start = performance.now();\n\n try {\n const result = ctx.fixtures !== undefined ? body(ctx.fixtures as PlaywrightFixtures) : body();\n if (result instanceof Promise) {\n return result.then(\n (val) => { step.durationMs = performance.now() - start; syncAnnotationToTest(); return val; },\n (err) => { step.durationMs = performance.now() - start; syncAnnotationToTest(); throw err; },\n ) as T;\n }\n step.durationMs = performance.now() - start;\n syncAnnotationToTest();\n return result;\n } catch (err) {\n step.durationMs = performance.now() - start;\n syncAnnotationToTest();\n throw err;\n }\n }\n return stepMarker;\n}\n\n// ============================================================================\n// story.init() - Playwright-specific\n// ============================================================================\n\nfunction isTestInfo(x: unknown): x is TestInfo {\n return (\n typeof x === 'object' &&\n x !== null &&\n 'title' in x &&\n 'annotations' in x &&\n Array.isArray((x as TestInfo).annotations)\n );\n}\n\n/** init(testInfo) or init(fixtures, testInfo) or init(testInfo, { fixtures }). */\nfunction init(\n first: TestInfo | unknown,\n second?: StoryOptions | TestInfo,\n third?: StoryOptions,\n): void {\n let testInfo: TestInfo;\n let options: StoryOptions | undefined;\n let fixtures: unknown;\n\n if (second !== undefined && isTestInfo(second)) {\n fixtures = first;\n testInfo = second;\n options = third;\n } else {\n testInfo = first as TestInfo;\n options = second;\n fixtures = options?.fixtures;\n }\n\n const meta: StoryMeta = {\n scenario: testInfo.title,\n steps: [],\n suitePath: extractSuitePath(testInfo),\n tags: options?.tags,\n tickets: normalizeTickets(options?.ticket),\n meta: options?.meta,\n sourceOrder: sourceOrderCounter++,\n };\n\n // OTel bridge: detect active span, flow data bidirectionally\n const otelCtx = tryGetActiveOtelContext();\n if (otelCtx) {\n // OTel -> Story: capture traceId in structured meta\n meta.meta = { ...meta.meta, otel: { traceId: otelCtx.traceId, spanId: otelCtx.spanId } };\n\n // OTel -> Story: inject human-readable doc entries\n meta.docs = meta.docs ?? [];\n meta.docs.push({ kind: 'kv', label: 'Trace ID', value: otelCtx.traceId, phase: 'runtime' });\n\n const template = options?.traceUrlTemplate ?? process.env.OTEL_TRACE_URL_TEMPLATE;\n const url = resolveTraceUrl(template, otelCtx.traceId);\n if (url) {\n meta.docs.push({ kind: 'link', label: 'View Trace', url, phase: 'runtime' });\n }\n\n // Story -> OTel: enrich active span with story attributes\n try {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n const reqUrl = import.meta.url\n ?? (typeof __filename !== 'undefined' ? `file://${__filename}` : undefined);\n const req = createRequire(reqUrl!);\n const api = req('@opentelemetry/api');\n const span = api.trace?.getActiveSpan?.();\n if (span) {\n span.setAttribute('story.scenario', testInfo.title);\n if (options?.tags?.length) span.setAttribute('story.tags', options.tags);\n if (options?.ticket) {\n const tickets = Array.isArray(options.ticket) ? options.ticket : [options.ticket];\n span.setAttribute('story.tickets', tickets);\n }\n }\n } catch { /* OTel not available */ }\n }\n\n testInfo.annotations.push({\n type: 'story-meta',\n description: JSON.stringify(meta),\n });\n\n activeContext = {\n meta,\n currentStep: null,\n stepCounter: 0,\n attachments: [],\n activeTimers: new Map(),\n timerCounter: 0,\n fixtures: fixtures as Record<string, unknown> | undefined,\n };\n activeTestInfo = testInfo;\n}\n\n/**\n * Update the story-meta annotation on testInfo with the current meta (including steps).\n * Called after each step/doc so the reporter sees the full story in onTestEnd.\n */\nfunction syncAnnotationToTest(): void {\n if (!activeTestInfo || !activeContext) return;\n const annotation = activeTestInfo.annotations.find(\n (a) => a.type === 'story-meta',\n );\n if (annotation) {\n annotation.description = JSON.stringify(activeContext.meta);\n }\n}\n\n// ============================================================================\n// story.fn() and story.expect()\n// ============================================================================\n\n/**\n * Wrap a function as a step with timing and error capture.\n * Records the step with `wrapped: true` and `durationMs`.\n */\nfunction fn<T>(keyword: StepKeyword, text: string, body: (fixtures: PlaywrightFixtures) => T): T;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction fn<T>(keyword: StepKeyword, text: string, body: (...args: any[]) => T): T {\n const ctx = getContext();\n const resolvedKeyword: StepKeyword =\n (keyword === 'Given' || keyword === 'When' || keyword === 'Then') &&\n ctx.meta.steps.some((s) => s.keyword === keyword)\n ? 'And'\n : keyword;\n const step: StoryStep = {\n id: `step-${ctx.stepCounter++}`,\n keyword: resolvedKeyword,\n text,\n docs: [],\n wrapped: true,\n };\n ctx.meta.steps.push(step);\n ctx.currentStep = step;\n syncAnnotationToTest();\n\n const start = performance.now();\n try {\n const result = ctx.fixtures !== undefined ? body(ctx.fixtures as PlaywrightFixtures) : body();\n if (result instanceof Promise) {\n return result.then(\n (val) => {\n step.durationMs = performance.now() - start;\n syncAnnotationToTest();\n return val;\n },\n (err) => {\n step.durationMs = performance.now() - start;\n syncAnnotationToTest();\n throw err;\n },\n ) as T;\n }\n step.durationMs = performance.now() - start;\n syncAnnotationToTest();\n return result;\n } catch (err) {\n step.durationMs = performance.now() - start;\n syncAnnotationToTest();\n throw err;\n }\n}\n\n/**\n * Wrap an assertion as a Then step with timing and error capture.\n * Shorthand for `story.fn('Then', text, body)`.\n */\nfunction storyExpect<T>(text: string, body: () => T): T {\n return fn('Then', text, body);\n}\n\n// ============================================================================\n// Playwright-specific attach\n// ============================================================================\n\nfunction playwrightAttach(options: AttachmentOptions): void {\n const ctx = getContext();\n const stepIndex = ctx.currentStep\n ? ctx.meta.steps.indexOf(ctx.currentStep)\n : undefined;\n ctx.attachments.push({\n ...options,\n stepId: ctx.currentStep?.id,\n });\n syncAnnotationToTest();\n\n if (activeTestInfo) {\n const attachOptions: { name: string; contentType: string; path?: string; body?: string | Buffer } = {\n name: options.name,\n contentType: options.mediaType,\n };\n if (options.path) attachOptions.path = options.path;\n if (options.body) attachOptions.body = options.body;\n activeTestInfo.attach(options.name, attachOptions);\n }\n}\n\n// ============================================================================\n// Export story object\n// ============================================================================\n\nexport const story = {\n init,\n\n // BDD step markers\n given: createStepMarker('Given'),\n when: createStepMarker('When'),\n then: createStepMarker('Then'),\n and: createStepMarker('And'),\n but: createStepMarker('But'),\n\n // AAA pattern aliases\n arrange: createStepMarker('Given'),\n act: createStepMarker('When'),\n assert: createStepMarker('Then'),\n\n // Additional aliases\n setup: createStepMarker('Given'),\n context: createStepMarker('Given'),\n execute: createStepMarker('When'),\n action: createStepMarker('When'),\n verify: createStepMarker('Then'),\n\n // Standalone doc methods\n note(text: string): void {\n attachDoc({ kind: 'note', text, phase: 'runtime' });\n syncAnnotationToTest();\n },\n\n tag(name: string | string[]): void {\n const names = Array.isArray(name) ? name : [name];\n attachDoc({ kind: 'tag', names, phase: 'runtime' });\n syncAnnotationToTest();\n },\n\n kv(options: KvOptions): void {\n attachDoc({ kind: 'kv', label: options.label, value: options.value, phase: 'runtime' });\n syncAnnotationToTest();\n },\n\n json(options: JsonOptions): void {\n const content = JSON.stringify(options.value, null, 2);\n attachDoc({ kind: 'code', label: options.label, content, lang: 'json', phase: 'runtime' });\n syncAnnotationToTest();\n },\n\n code(options: CodeOptions): void {\n attachDoc({ kind: 'code', label: options.label, content: options.content, lang: options.lang, phase: 'runtime' });\n syncAnnotationToTest();\n },\n\n table(options: TableOptions): void {\n attachDoc({ kind: 'table', label: options.label, columns: options.columns, rows: options.rows, phase: 'runtime' });\n syncAnnotationToTest();\n },\n\n link(options: LinkOptions): void {\n attachDoc({ kind: 'link', label: options.label, url: options.url, phase: 'runtime' });\n syncAnnotationToTest();\n },\n\n section(options: SectionOptions): void {\n attachDoc({ kind: 'section', title: options.title, markdown: options.markdown, phase: 'runtime' });\n syncAnnotationToTest();\n },\n\n mermaid(options: MermaidOptions): void {\n attachDoc({ kind: 'mermaid', code: options.code, title: options.title, phase: 'runtime' });\n syncAnnotationToTest();\n },\n\n screenshot(options: ScreenshotOptions): void {\n attachDoc({ kind: 'screenshot', path: options.path, alt: options.alt, phase: 'runtime' });\n syncAnnotationToTest();\n },\n\n custom(options: CustomOptions): void {\n attachDoc({ kind: 'custom', type: options.type, data: options.data, phase: 'runtime' });\n syncAnnotationToTest();\n },\n\n // Attachments\n attach: playwrightAttach,\n\n // Step timing\n startTimer(): number {\n const ctx = getContext();\n const token = ctx.timerCounter++;\n const stepIndex = ctx.currentStep\n ? ctx.meta.steps.indexOf(ctx.currentStep)\n : undefined;\n ctx.activeTimers.set(token, {\n start: performance.now(),\n stepIndex: stepIndex !== undefined && stepIndex >= 0 ? stepIndex : undefined,\n stepId: ctx.currentStep?.id,\n consumed: false,\n });\n syncAnnotationToTest();\n return token;\n },\n\n endTimer(token: number): void {\n const ctx = getContext();\n const entry = ctx.activeTimers.get(token);\n if (!entry || entry.consumed) return;\n\n entry.consumed = true;\n const durationMs = performance.now() - entry.start;\n\n let step: StoryStep | undefined;\n if (entry.stepId) {\n step = ctx.meta.steps.find((s) => s.id === entry.stepId);\n }\n if (!step && entry.stepIndex !== undefined) {\n step = ctx.meta.steps[entry.stepIndex];\n }\n\n if (step) {\n step.durationMs = durationMs;\n }\n syncAnnotationToTest();\n },\n\n // Step wrappers\n fn,\n expect: storyExpect,\n};\n\nexport type Story = typeof story;\n","/**\n * Playwright Executable Stories\n *\n * BDD-style executable documentation for Playwright Test.\n *\n * @example\n * ```ts\n * import { test, expect } from '@playwright/test';\n * import { story } from 'executable-stories-playwright';\n *\n * test.describe('Calculator', () => {\n * test('adds two numbers', async ({ page }, testInfo) => {\n * story.init(testInfo);\n *\n * story.given('two numbers 5 and 3');\n * const a = 5;\n * const b = 3;\n *\n * story.when('I add them together');\n * const result = a + b;\n *\n * story.then('the result is 8');\n * expect(result).toBe(8);\n * });\n * });\n * ```\n */\n\n// Story API\nimport { story } from './story-api';\nexport { story };\nexport type { Story } from './story-api';\n\n// Top-level step helpers (framework contract)\nexport const given = story.given;\nexport const when = story.when;\nexport const then = story.then;\nexport const and = story.and;\nexport const but = story.but;\n\n// Re-export types from local types module\nexport type {\n StoryMeta,\n StoryStep,\n DocEntry,\n StepKeyword,\n StoryDocs,\n StoryOptions,\n KvOptions,\n JsonOptions,\n CodeOptions,\n TableOptions,\n LinkOptions,\n SectionOptions,\n MermaidOptions,\n ScreenshotOptions,\n CustomOptions,\n} from './types';\n"],"mappings":";AA4BA,SAAS,qBAAqB;AAE9B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AA+DP,IAAI,gBAAqC;AAGzC,IAAI,iBAAkC;AAGtC,IAAI,qBAAqB;AAKzB,SAAS,aAA2B;AAClC,MAAI,CAAC,eAAe;AAClB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;AAMA,SAAS,iBAAiB,QAA6D;AACrF,MAAI,CAAC,OAAQ,QAAO;AACpB,SAAO,MAAM,QAAQ,MAAM,IAAI,SAAS,CAAC,MAAM;AACjD;AAEA,SAAS,0BAA0B,MAA6B;AAC9D,QAAM,UAAsB,CAAC;AAE7B,MAAI,KAAK,MAAM;AACb,YAAQ,KAAK,EAAE,MAAM,QAAQ,MAAM,KAAK,MAAM,OAAO,UAAU,CAAC;AAAA,EAClE;AACA,MAAI,KAAK,KAAK;AACZ,UAAM,QAAQ,MAAM,QAAQ,KAAK,GAAG,IAAI,KAAK,MAAM,CAAC,KAAK,GAAG;AAC5D,YAAQ,KAAK,EAAE,MAAM,O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,MAAM,MAAM;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "executable-stories-playwright",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "BDD-style executable stories for Playwright Test with documentation generation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -19,12 +19,13 @@
|
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
21
|
"files": [
|
|
22
|
-
"dist"
|
|
22
|
+
"dist",
|
|
23
|
+
"README.md"
|
|
23
24
|
],
|
|
24
25
|
"peerDependencies": {
|
|
25
26
|
"@playwright/test": ">=1.58.2",
|
|
26
|
-
"executable-stories-formatters": "^0.
|
|
27
|
-
"autotel": ">=
|
|
27
|
+
"executable-stories-formatters": "^0.6.0",
|
|
28
|
+
"autotel": ">=2.20.0"
|
|
28
29
|
},
|
|
29
30
|
"peerDependenciesMeta": {
|
|
30
31
|
"autotel": {
|
|
@@ -34,11 +35,11 @@
|
|
|
34
35
|
"dependencies": {},
|
|
35
36
|
"devDependencies": {
|
|
36
37
|
"@opentelemetry/api": "^1.9.0",
|
|
37
|
-
"@playwright/test": "^1.58.
|
|
38
|
-
"@types/node": "^25.
|
|
38
|
+
"@playwright/test": "^1.58.2",
|
|
39
|
+
"@types/node": "^25.3.0",
|
|
39
40
|
"tsup": "^8.5.1",
|
|
40
41
|
"typescript": "~5.9.3",
|
|
41
|
-
"executable-stories-formatters": "0.
|
|
42
|
+
"executable-stories-formatters": "0.6.0"
|
|
42
43
|
},
|
|
43
44
|
"repository": {
|
|
44
45
|
"type": "git",
|