@qavajs/playwright-runner-adapter 1.10.0 → 2.0.1
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/CHANGELOG.md +28 -0
- package/README.md +9 -9
- package/adapter/PlaywrightWorld.d.ts +1 -0
- package/adapter/PlaywrightWorld.js +1 -0
- package/adapter/PlaywrightWorld.js.map +1 -1
- package/adapter/cucumberAdapter.d.ts +4 -0
- package/adapter/cucumberAdapter.js +275 -0
- package/adapter/cucumberAdapter.js.map +1 -0
- package/adapter/index.d.ts +1 -1
- package/adapter/index.js +1 -1
- package/adapter/index.js.map +1 -1
- package/adapter/loader.d.ts +2 -1
- package/adapter/loader.js +6 -8
- package/adapter/loader.js.map +1 -1
- package/package.json +7 -7
- package/src/PlaywrightWorld.ts +1 -0
- package/src/cucumberAdapter.ts +380 -0
- package/src/index.ts +1 -1
- package/src/loader.ts +8 -10
- package/adapter/cucumber.spec.d.ts +0 -1
- package/adapter/cucumber.spec.js +0 -181
- package/adapter/cucumber.spec.js.map +0 -1
- package/adapter/defineCucumber.d.ts +0 -19
- package/adapter/defineCucumber.js +0 -22
- package/adapter/defineCucumber.js.map +0 -1
- package/src/cucumber.spec.ts +0 -219
- package/src/defineCucumber.ts +0 -25
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
import {load} from './loader';
|
|
2
|
+
import type {TestInfo, TestType} from '@playwright/test';
|
|
3
|
+
import type {ITestCaseHookParameter} from '@cucumber/cucumber';
|
|
4
|
+
|
|
5
|
+
// Constants
|
|
6
|
+
const ANNOTATION_TYPES = {
|
|
7
|
+
TEST_ID: 'testId',
|
|
8
|
+
NAME: 'name',
|
|
9
|
+
URI: 'uri',
|
|
10
|
+
TAGS: 'tags'
|
|
11
|
+
} as const;
|
|
12
|
+
|
|
13
|
+
const HOOK_NAMES = {
|
|
14
|
+
BEFORE_ALL: 'Before All',
|
|
15
|
+
AFTER_ALL: 'After All',
|
|
16
|
+
BEFORE: 'Before',
|
|
17
|
+
AFTER: 'After',
|
|
18
|
+
BEFORE_STEP: 'Before Step',
|
|
19
|
+
AFTER_STEP: 'After Step',
|
|
20
|
+
WORLD: 'World',
|
|
21
|
+
BEFORE_HOOKS: 'Before Hooks',
|
|
22
|
+
AFTER_HOOKS: 'After Hooks'
|
|
23
|
+
} as const;
|
|
24
|
+
|
|
25
|
+
const DEFAULT_VALUES = {
|
|
26
|
+
ATTACHMENT_FILENAME: 'attachment',
|
|
27
|
+
CONTENT_TYPE: 'text/plain',
|
|
28
|
+
COLUMN: 1,
|
|
29
|
+
TEST_CASE_ID: '0',
|
|
30
|
+
TEST_STEP_ID: '0'
|
|
31
|
+
} as const;
|
|
32
|
+
|
|
33
|
+
const STEP_ARGUMENT_LABELS = {
|
|
34
|
+
DOC_STRING: ' [MultiLine]',
|
|
35
|
+
DATA_TABLE: ' [DataTable]'
|
|
36
|
+
} as const;
|
|
37
|
+
|
|
38
|
+
// Type definitions
|
|
39
|
+
interface Location {
|
|
40
|
+
file: string;
|
|
41
|
+
line: number;
|
|
42
|
+
column: number;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
interface StepDefinition {
|
|
46
|
+
uri: string;
|
|
47
|
+
line: number;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface TestResult {
|
|
51
|
+
status: string;
|
|
52
|
+
error?: Error;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
interface HookResult {
|
|
56
|
+
duration: number | { nanos: number; seconds: number };
|
|
57
|
+
message?: string;
|
|
58
|
+
status: string;
|
|
59
|
+
exception?: Error;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Extracts the test ID from TestInfo annotations
|
|
64
|
+
*/
|
|
65
|
+
function getTestId(testInfo: TestInfo): string {
|
|
66
|
+
const annotation = testInfo.annotations
|
|
67
|
+
.find((annotation) => annotation.type === ANNOTATION_TYPES.TEST_ID);
|
|
68
|
+
|
|
69
|
+
if (!annotation?.description) {
|
|
70
|
+
throw new Error('Test ID annotation not found');
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return annotation.description;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Converts TestInfo to HookResult format
|
|
78
|
+
*/
|
|
79
|
+
function getResult(testInfo: TestInfo): HookResult {
|
|
80
|
+
const message = testInfo.errors.length > 0
|
|
81
|
+
? testInfo.errors.map((err) => err.message).join('\n')
|
|
82
|
+
: undefined;
|
|
83
|
+
|
|
84
|
+
return {
|
|
85
|
+
duration: testInfo.duration,
|
|
86
|
+
message,
|
|
87
|
+
status: testInfo.status?.toUpperCase() ?? 'UNKNOWN',
|
|
88
|
+
exception: testInfo.error as any
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Creates a location object from step definition
|
|
94
|
+
*/
|
|
95
|
+
function getLine(step: StepDefinition): { location: Location } {
|
|
96
|
+
return {
|
|
97
|
+
location: {
|
|
98
|
+
column: DEFAULT_VALUES.COLUMN,
|
|
99
|
+
file: step.uri,
|
|
100
|
+
line: step.line
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Logs data to console
|
|
107
|
+
*/
|
|
108
|
+
function log(data: unknown): void {
|
|
109
|
+
console.log(data);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Attaches content to test report
|
|
114
|
+
*/
|
|
115
|
+
function attach(
|
|
116
|
+
this: { test: { info: () => TestInfo } },
|
|
117
|
+
body: string | Buffer,
|
|
118
|
+
details?: { fileName?: string; mediaType?: string }
|
|
119
|
+
): void {
|
|
120
|
+
const fileName = details?.fileName ?? DEFAULT_VALUES.ATTACHMENT_FILENAME;
|
|
121
|
+
const contentType = details?.mediaType ?? DEFAULT_VALUES.CONTENT_TYPE;
|
|
122
|
+
this.test.info().attach(fileName, { body, contentType });
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Generates a human-readable step name with argument type indicator
|
|
127
|
+
*/
|
|
128
|
+
function stepName(pickleStep: {
|
|
129
|
+
text: string;
|
|
130
|
+
argument?: { docString?: unknown }
|
|
131
|
+
}): string {
|
|
132
|
+
let step = pickleStep.text;
|
|
133
|
+
|
|
134
|
+
if (pickleStep.argument) {
|
|
135
|
+
step += pickleStep.argument.docString
|
|
136
|
+
? STEP_ARGUMENT_LABELS.DOC_STRING
|
|
137
|
+
: STEP_ARGUMENT_LABELS.DATA_TABLE;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return step;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Executes before all hooks
|
|
145
|
+
*/
|
|
146
|
+
async function executeBeforeAllHooks(
|
|
147
|
+
test: TestType<any, any>,
|
|
148
|
+
hooks: any[]
|
|
149
|
+
): Promise<void> {
|
|
150
|
+
for (const hook of hooks) {
|
|
151
|
+
const location = getLine(hook);
|
|
152
|
+
await test.step(
|
|
153
|
+
HOOK_NAMES.BEFORE_ALL,
|
|
154
|
+
() => hook.code.apply({}),
|
|
155
|
+
location
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Executes after all hooks
|
|
162
|
+
*/
|
|
163
|
+
async function executeAfterAllHooks(
|
|
164
|
+
test: TestType<any, any>,
|
|
165
|
+
hooks: any[]
|
|
166
|
+
): Promise<void> {
|
|
167
|
+
for (const hook of hooks) {
|
|
168
|
+
const location = getLine(hook);
|
|
169
|
+
await test.step(
|
|
170
|
+
HOOK_NAMES.AFTER_ALL,
|
|
171
|
+
() => hook.code.apply({}),
|
|
172
|
+
location
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Creates test annotations from test case data
|
|
179
|
+
*/
|
|
180
|
+
function createTestAnnotations(testCase: any): any[] {
|
|
181
|
+
const tags = [...new Set(testCase.tags.map((tag: { name: string }) => tag.name))];
|
|
182
|
+
|
|
183
|
+
return [
|
|
184
|
+
{ type: ANNOTATION_TYPES.NAME, description: testCase.name },
|
|
185
|
+
{ type: ANNOTATION_TYPES.URI, description: testCase.uri },
|
|
186
|
+
{ type: ANNOTATION_TYPES.TEST_ID, description: testCase.id },
|
|
187
|
+
{ type: ANNOTATION_TYPES.TAGS, description: JSON.stringify(tags) }
|
|
188
|
+
];
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Main configuration function that sets up Cucumber adapter for Playwright
|
|
193
|
+
*/
|
|
194
|
+
export function defineConfig(config: any): any {
|
|
195
|
+
const {features, supportCodeLibrary} = load(config);
|
|
196
|
+
|
|
197
|
+
const fixture = new supportCodeLibrary.World({config});
|
|
198
|
+
const test: TestType<any, any> = fixture.test;
|
|
199
|
+
|
|
200
|
+
test.beforeAll(async () => {
|
|
201
|
+
await executeBeforeAllHooks(test, supportCodeLibrary.beforeTestRunHookDefinitions);
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
const worlds = new Map<string, any>();
|
|
205
|
+
|
|
206
|
+
for (const feature of features) {
|
|
207
|
+
const tests = feature.tests;
|
|
208
|
+
|
|
209
|
+
test.describe(feature.feature as string, async () => {
|
|
210
|
+
/**
|
|
211
|
+
* Factory function to create and register world instances
|
|
212
|
+
*/
|
|
213
|
+
const worldFactory = (fixtures: any): void => {
|
|
214
|
+
const world = new supportCodeLibrary.World({
|
|
215
|
+
log,
|
|
216
|
+
attach,
|
|
217
|
+
supportCodeLibrary,
|
|
218
|
+
config
|
|
219
|
+
});
|
|
220
|
+
world.init(fixtures);
|
|
221
|
+
worlds.set(getTestId(test.info()), world);
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
worldFactory.toString = (): string => fixture.init.toString();
|
|
225
|
+
|
|
226
|
+
test.beforeEach(HOOK_NAMES.WORLD, worldFactory);
|
|
227
|
+
|
|
228
|
+
test.beforeEach(HOOK_NAMES.BEFORE_HOOKS, async () => {
|
|
229
|
+
const testId = getTestId(test.info());
|
|
230
|
+
const world = worlds.get(testId);
|
|
231
|
+
const testCase = tests.find((t: any) => t.id === testId);
|
|
232
|
+
|
|
233
|
+
if (!testCase) {
|
|
234
|
+
throw new Error(`Test case with ID ${testId} not found`);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
for (const beforeHook of supportCodeLibrary.beforeTestCaseHookDefinitions) {
|
|
238
|
+
if (beforeHook.appliesToTestCase(testCase)) {
|
|
239
|
+
const hookName = beforeHook.name ?? HOOK_NAMES.BEFORE;
|
|
240
|
+
const location = getLine(beforeHook);
|
|
241
|
+
await test.step(
|
|
242
|
+
hookName,
|
|
243
|
+
() => beforeHook.code.apply(world, [{
|
|
244
|
+
gherkinDocument: feature.gherkinDocument,
|
|
245
|
+
pickle: testCase
|
|
246
|
+
} as ITestCaseHookParameter]),
|
|
247
|
+
location
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
for (const testCase of tests) {
|
|
254
|
+
const tag = [...new Set(testCase.tags.map((tag: { name: string }) => tag.name))];
|
|
255
|
+
const annotation = createTestAnnotations(testCase);
|
|
256
|
+
|
|
257
|
+
test(testCase.name, {tag, annotation}, async () => {
|
|
258
|
+
const world = worlds.get(testCase.id);
|
|
259
|
+
const result: TestResult = { status: 'passed' };
|
|
260
|
+
|
|
261
|
+
for (const pickleStep of testCase.steps) {
|
|
262
|
+
if (result.status !== 'passed') {
|
|
263
|
+
break;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
const matchingSteps = supportCodeLibrary.stepDefinitions
|
|
267
|
+
.filter((stepDef: any) => stepDef.matchesStepName(pickleStep.text));
|
|
268
|
+
|
|
269
|
+
if (matchingSteps.length === 0) {
|
|
270
|
+
throw new Error(
|
|
271
|
+
`Step definition not found for: "${pickleStep.text}"`
|
|
272
|
+
);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
if (matchingSteps.length > 1) {
|
|
276
|
+
throw new Error(
|
|
277
|
+
`Ambiguous step "${pickleStep.text}" matches ${matchingSteps.length} definitions`
|
|
278
|
+
);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
const [step] = matchingSteps;
|
|
282
|
+
const location = getLine(step);
|
|
283
|
+
await test.step(stepName(pickleStep), async () => {
|
|
284
|
+
for (const beforeStep of supportCodeLibrary.beforeTestStepHookDefinitions) {
|
|
285
|
+
if (beforeStep.appliesToTestCase(testCase)) {
|
|
286
|
+
const location = getLine(beforeStep);
|
|
287
|
+
await test.step(
|
|
288
|
+
HOOK_NAMES.BEFORE_STEP,
|
|
289
|
+
() => beforeStep.code.apply(world, [{
|
|
290
|
+
gherkinDocument: feature.gherkinDocument,
|
|
291
|
+
pickle: testCase,
|
|
292
|
+
pickleStep
|
|
293
|
+
}]),
|
|
294
|
+
location
|
|
295
|
+
);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
const {parameters} = await step.getInvocationParameters({
|
|
299
|
+
step: {
|
|
300
|
+
text: pickleStep.text,
|
|
301
|
+
argument: pickleStep.argument
|
|
302
|
+
},
|
|
303
|
+
world
|
|
304
|
+
} as any);
|
|
305
|
+
|
|
306
|
+
try {
|
|
307
|
+
await step.code.apply(world, parameters);
|
|
308
|
+
} catch (err) {
|
|
309
|
+
result.status = 'failed';
|
|
310
|
+
result.error = err as Error;
|
|
311
|
+
throw err;
|
|
312
|
+
} finally {
|
|
313
|
+
for (const afterStep of supportCodeLibrary.afterTestStepHookDefinitions) {
|
|
314
|
+
if (afterStep.appliesToTestCase(testCase)) {
|
|
315
|
+
const location = getLine(afterStep);
|
|
316
|
+
await test.step(
|
|
317
|
+
HOOK_NAMES.AFTER_STEP,
|
|
318
|
+
() => afterStep.code.apply(world, [{
|
|
319
|
+
gherkinDocument: feature.gherkinDocument,
|
|
320
|
+
testCaseStartedId: DEFAULT_VALUES.TEST_CASE_ID,
|
|
321
|
+
testStepId: DEFAULT_VALUES.TEST_STEP_ID,
|
|
322
|
+
pickle: testCase,
|
|
323
|
+
pickleStep,
|
|
324
|
+
result: {
|
|
325
|
+
duration: 0 as any,
|
|
326
|
+
message: result.error?.message,
|
|
327
|
+
status: result.status.toUpperCase(),
|
|
328
|
+
exception: result.error
|
|
329
|
+
}
|
|
330
|
+
} as any]),
|
|
331
|
+
location
|
|
332
|
+
);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}, location);
|
|
337
|
+
}
|
|
338
|
+
})
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
test.afterEach(HOOK_NAMES.AFTER_HOOKS, async () => {
|
|
342
|
+
const testInfo = test.info();
|
|
343
|
+
const testId = getTestId(testInfo);
|
|
344
|
+
const world = worlds.get(testId);
|
|
345
|
+
const testCase = tests.find((t) => t.id === testId);
|
|
346
|
+
|
|
347
|
+
if (!testCase) {
|
|
348
|
+
throw new Error(`Test case with ID ${testId} not found`);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
for (const afterHook of supportCodeLibrary.afterTestCaseHookDefinitions) {
|
|
352
|
+
if (afterHook.appliesToTestCase(testCase)) {
|
|
353
|
+
const hookName = afterHook.name ?? HOOK_NAMES.AFTER;
|
|
354
|
+
const location = getLine(afterHook);
|
|
355
|
+
await test.step(
|
|
356
|
+
hookName,
|
|
357
|
+
() => afterHook.code.apply(world, [{
|
|
358
|
+
gherkinDocument: feature.gherkinDocument,
|
|
359
|
+
testCaseStartedId: DEFAULT_VALUES.TEST_CASE_ID,
|
|
360
|
+
pickle: testCase,
|
|
361
|
+
result: getResult(testInfo)
|
|
362
|
+
} as any]),
|
|
363
|
+
location
|
|
364
|
+
);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
});
|
|
368
|
+
|
|
369
|
+
test.afterEach(HOOK_NAMES.WORLD, async () => {
|
|
370
|
+
const testId = getTestId(test.info());
|
|
371
|
+
worlds.delete(testId);
|
|
372
|
+
});
|
|
373
|
+
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
test.afterAll(async () => {
|
|
378
|
+
await executeAfterAllHooks(test, supportCodeLibrary.afterTestRunHookDefinitions);
|
|
379
|
+
});
|
|
380
|
+
}
|
package/src/index.ts
CHANGED
package/src/loader.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { readFileSync } from 'node:fs';
|
|
2
|
-
import {
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
3
|
import { randomUUID } from 'node:crypto';
|
|
4
4
|
import { AstBuilder, compile, GherkinClassicTokenMatcher, Parser } from '@cucumber/gherkin';
|
|
5
5
|
import { supportCodeLibraryBuilder } from '@cucumber/cucumber';
|
|
@@ -31,6 +31,7 @@ type Feature = {
|
|
|
31
31
|
feature?: string;
|
|
32
32
|
gherkinDocument: GherkinDocument;
|
|
33
33
|
tests: readonly Pickle[];
|
|
34
|
+
uri: string;
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
export function loadFeatures(globPattern: string[]): Feature[] {
|
|
@@ -40,6 +41,7 @@ export function loadFeatures(globPattern: string[]): Feature[] {
|
|
|
40
41
|
const gherkinDocument = parser.parse(readFileSync(filePath, 'utf-8'));
|
|
41
42
|
return {
|
|
42
43
|
feature: gherkinDocument.feature?.name,
|
|
44
|
+
uri: filePath,
|
|
43
45
|
gherkinDocument,
|
|
44
46
|
tests: duplicates(compile(gherkinDocument, file, uuidFn))
|
|
45
47
|
}
|
|
@@ -57,16 +59,12 @@ export function loadStepDefinitions(globPattern: string[]) {
|
|
|
57
59
|
return supportCodeLibraryBuilder.finalize();
|
|
58
60
|
}
|
|
59
61
|
|
|
60
|
-
export function load() {
|
|
61
|
-
const
|
|
62
|
-
const profile = process.env.PROFILE ?? 'default';
|
|
63
|
-
|
|
64
|
-
const resolvedConfig = config[profile];
|
|
65
|
-
const features = loadFeatures(resolvedConfig.paths);
|
|
62
|
+
export function load(config: any) {
|
|
63
|
+
const features = loadFeatures(config.paths);
|
|
66
64
|
const supportCodeLibrary = loadStepDefinitions([
|
|
67
|
-
...(
|
|
68
|
-
...(
|
|
69
|
-
...(
|
|
65
|
+
...(config.requireModules ?? []),
|
|
66
|
+
...(config.require ?? []),
|
|
67
|
+
...(config.import ?? [])
|
|
70
68
|
]);
|
|
71
69
|
return { features, supportCodeLibrary }
|
|
72
70
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/adapter/cucumber.spec.js
DELETED
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const loader_1 = require("./loader");
|
|
4
|
-
const { features, supportCodeLibrary } = (0, loader_1.load)();
|
|
5
|
-
function getTestId(testInfo) {
|
|
6
|
-
return testInfo
|
|
7
|
-
.annotations
|
|
8
|
-
.find((annotation) => annotation.type === 'testId')
|
|
9
|
-
.description;
|
|
10
|
-
}
|
|
11
|
-
function getResult(testInfo) {
|
|
12
|
-
const message = testInfo.errors.length > 0
|
|
13
|
-
? testInfo.errors.map((err) => err.message).join('\n')
|
|
14
|
-
: undefined;
|
|
15
|
-
return {
|
|
16
|
-
duration: testInfo.duration,
|
|
17
|
-
message,
|
|
18
|
-
status: testInfo.status?.toUpperCase(),
|
|
19
|
-
exception: testInfo.error
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
function getLine(step) {
|
|
23
|
-
return { location: { column: 1, file: step.uri, line: step.line } };
|
|
24
|
-
}
|
|
25
|
-
function log(data) {
|
|
26
|
-
console.log(data);
|
|
27
|
-
}
|
|
28
|
-
function attach(body, details) {
|
|
29
|
-
const fileName = details?.fileName ?? 'attachment';
|
|
30
|
-
const contentType = details?.mediaType ?? 'text/plain';
|
|
31
|
-
this.test.info().attach(fileName, { body, contentType });
|
|
32
|
-
}
|
|
33
|
-
function stepName(pickleStep) {
|
|
34
|
-
let step = pickleStep.text;
|
|
35
|
-
if (pickleStep.argument) {
|
|
36
|
-
step += pickleStep.argument.docString ? ' [MultiLine]' : ' [DataTable]';
|
|
37
|
-
}
|
|
38
|
-
return step;
|
|
39
|
-
}
|
|
40
|
-
const fixture = new supportCodeLibrary.World({});
|
|
41
|
-
const test = fixture.test;
|
|
42
|
-
test.beforeAll(async () => {
|
|
43
|
-
for (const beforeAllHook of supportCodeLibrary.beforeTestRunHookDefinitions) {
|
|
44
|
-
const location = getLine(beforeAllHook);
|
|
45
|
-
await test.step('Before All', () => beforeAllHook.code.apply({}), location);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
const worlds = new Map();
|
|
49
|
-
for (const feature of features) {
|
|
50
|
-
const tests = feature.tests;
|
|
51
|
-
test.describe(feature.feature, async () => {
|
|
52
|
-
const worldFactory = (fixtures) => {
|
|
53
|
-
const world = new supportCodeLibrary.World({
|
|
54
|
-
log,
|
|
55
|
-
attach,
|
|
56
|
-
supportCodeLibrary
|
|
57
|
-
});
|
|
58
|
-
world.init(fixtures);
|
|
59
|
-
worlds.set(getTestId(test.info()), world);
|
|
60
|
-
};
|
|
61
|
-
worldFactory.toString = () => { return fixture.init.toString(); };
|
|
62
|
-
test.beforeEach('World', worldFactory);
|
|
63
|
-
test.beforeEach('Before Hooks', async () => {
|
|
64
|
-
const testId = getTestId(test.info());
|
|
65
|
-
const world = worlds.get(testId);
|
|
66
|
-
const testCase = tests.find(test => test.id === testId);
|
|
67
|
-
for (const beforeHook of supportCodeLibrary.beforeTestCaseHookDefinitions) {
|
|
68
|
-
if (beforeHook.appliesToTestCase(testCase)) {
|
|
69
|
-
const hookName = beforeHook.name ?? 'Before';
|
|
70
|
-
const location = getLine(beforeHook);
|
|
71
|
-
await test.step(hookName, () => beforeHook.code.apply(world, [{
|
|
72
|
-
gherkinDocument: feature.gherkinDocument,
|
|
73
|
-
pickle: testCase
|
|
74
|
-
}]), location);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
for (const testCase of tests) {
|
|
79
|
-
const tag = [...new Set(testCase.tags.map((tag) => tag.name))];
|
|
80
|
-
const annotation = [
|
|
81
|
-
{ type: 'name', description: testCase.name },
|
|
82
|
-
{ type: 'uri', description: testCase.uri },
|
|
83
|
-
{ type: 'testId', description: testCase.id },
|
|
84
|
-
{ type: 'tags', description: JSON.stringify(tag) }
|
|
85
|
-
];
|
|
86
|
-
test(testCase.name, { tag, annotation }, async () => {
|
|
87
|
-
const world = worlds.get(testCase.id);
|
|
88
|
-
const result = { status: 'passed' };
|
|
89
|
-
for (const pickleStep of testCase.steps) {
|
|
90
|
-
if (result.status !== 'passed') {
|
|
91
|
-
break;
|
|
92
|
-
}
|
|
93
|
-
const steps = supportCodeLibrary.stepDefinitions
|
|
94
|
-
.filter(stepDefinition => stepDefinition.matchesStepName(pickleStep.text));
|
|
95
|
-
if (steps.length === 0)
|
|
96
|
-
throw new Error(`Step '${pickleStep.text}' is not defined`);
|
|
97
|
-
if (steps.length > 1)
|
|
98
|
-
throw new Error(`Step '${pickleStep.text}' matches multiple step definitions`);
|
|
99
|
-
const [step] = steps;
|
|
100
|
-
const location = getLine(step);
|
|
101
|
-
await test.step(stepName(pickleStep), async () => {
|
|
102
|
-
for (const beforeStep of supportCodeLibrary.beforeTestStepHookDefinitions) {
|
|
103
|
-
if (beforeStep.appliesToTestCase(testCase)) {
|
|
104
|
-
const location = getLine(beforeStep);
|
|
105
|
-
await test.step('Before Step', () => beforeStep.code.apply(world, [{
|
|
106
|
-
gherkinDocument: feature.gherkinDocument,
|
|
107
|
-
pickle: testCase,
|
|
108
|
-
pickleStep
|
|
109
|
-
}]), location);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
const { parameters } = await step.getInvocationParameters({
|
|
113
|
-
step: {
|
|
114
|
-
text: pickleStep.text,
|
|
115
|
-
argument: pickleStep.argument
|
|
116
|
-
},
|
|
117
|
-
world
|
|
118
|
-
});
|
|
119
|
-
try {
|
|
120
|
-
await step.code.apply(world, parameters);
|
|
121
|
-
}
|
|
122
|
-
catch (err) {
|
|
123
|
-
result.status = 'failed';
|
|
124
|
-
result.error = err;
|
|
125
|
-
throw err;
|
|
126
|
-
}
|
|
127
|
-
finally {
|
|
128
|
-
for (const afterStep of supportCodeLibrary.afterTestStepHookDefinitions) {
|
|
129
|
-
if (afterStep.appliesToTestCase(testCase)) {
|
|
130
|
-
const location = getLine(afterStep);
|
|
131
|
-
await test.step('After Step', () => afterStep.code.apply(world, [{
|
|
132
|
-
gherkinDocument: feature.gherkinDocument,
|
|
133
|
-
testCaseStartedId: '0',
|
|
134
|
-
testStepId: '0',
|
|
135
|
-
pickle: testCase,
|
|
136
|
-
pickleStep,
|
|
137
|
-
result: {
|
|
138
|
-
duration: 0,
|
|
139
|
-
message: result.error?.message,
|
|
140
|
-
status: result.status.toUpperCase(),
|
|
141
|
-
exception: result.error
|
|
142
|
-
}
|
|
143
|
-
}]), location);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}, location);
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
test.afterEach('After Hooks', async () => {
|
|
152
|
-
const testInfo = test.info();
|
|
153
|
-
const testId = getTestId(testInfo);
|
|
154
|
-
const world = worlds.get(testId);
|
|
155
|
-
const testCase = tests.find(test => test.id === testId);
|
|
156
|
-
for (const afterHook of supportCodeLibrary.afterTestCaseHookDefinitions) {
|
|
157
|
-
if (afterHook.appliesToTestCase(testCase)) {
|
|
158
|
-
const hookName = afterHook.name ?? 'After';
|
|
159
|
-
const location = getLine(afterHook);
|
|
160
|
-
await test.step(hookName, () => afterHook.code.apply(world, [{
|
|
161
|
-
gherkinDocument: feature.gherkinDocument,
|
|
162
|
-
testCaseStartedId: '0',
|
|
163
|
-
pickle: testCase,
|
|
164
|
-
result: getResult(testInfo)
|
|
165
|
-
}]), location);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
test.afterEach('World', async () => {
|
|
170
|
-
const testId = getTestId(test.info());
|
|
171
|
-
worlds.delete(testId);
|
|
172
|
-
});
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
test.afterAll(async () => {
|
|
176
|
-
for (const afterAllHook of supportCodeLibrary.afterTestRunHookDefinitions) {
|
|
177
|
-
const location = getLine(afterAllHook);
|
|
178
|
-
await test.step('After All', () => afterAllHook.code.apply({}), location);
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
//# sourceMappingURL=cucumber.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cucumber.spec.js","sourceRoot":"","sources":["../src/cucumber.spec.ts"],"names":[],"mappings":";;AAAA,qCAAgC;AAIhC,MAAM,EAAE,QAAQ,EAAE,kBAAkB,EAAE,GAAG,IAAA,aAAI,GAAE,CAAC;AAEhD,SAAS,SAAS,CAAC,QAAkB;IACjC,OAAO,QAAQ;SACV,WAAW;SACX,IAAI,CAAC,CAAC,UAA4B,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,KAAK,QAAQ,CAAE;SACrE,WAAW,CAAC;AACrB,CAAC;AAED,SAAS,SAAS,CAAC,QAAkB;IACjC,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC;QACtC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAC3D,CAAC,CAAC,SAAS,CAAC;IAChB,OAAO;QACH,QAAQ,EAAE,QAAQ,CAAC,QAAe;QAClC,OAAO;QACP,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,WAAW,EAAE;QACtC,SAAS,EAAE,QAAQ,CAAC,KAAK;KAC5B,CAAC;AACN,CAAC;AAED,SAAS,OAAO,CAAC,IAAmC;IAChD,OAAO,EAAE,QAAQ,EAAE,EA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xE,MAAM,QAAQ,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;QACvC,MAAM,IAAI,CAAC,IAAI,CACX,WAAW,EACX,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,EACjC,QAAQ,CACX,CAAA;IACL,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
type CucumberConfig = {
|
|
2
|
-
config: string;
|
|
3
|
-
profile?: string;
|
|
4
|
-
adapter?: string;
|
|
5
|
-
};
|
|
6
|
-
/**
|
|
7
|
-
* Define cucumber config in playwright config
|
|
8
|
-
* @param {CucumberConfig} config
|
|
9
|
-
* @example
|
|
10
|
-
* export default defineConfig({
|
|
11
|
-
* testDir: defineCucumber({
|
|
12
|
-
* config: 'cucumber.ts',
|
|
13
|
-
* profile: 'chrome', // optional
|
|
14
|
-
* adapter: 'path/to/adapter' // optional
|
|
15
|
-
* }),
|
|
16
|
-
* })
|
|
17
|
-
*/
|
|
18
|
-
export declare function defineCucumber(config: CucumberConfig): string;
|
|
19
|
-
export {};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defineCucumber = defineCucumber;
|
|
4
|
-
const node_path_1 = require("node:path");
|
|
5
|
-
/**
|
|
6
|
-
* Define cucumber config in playwright config
|
|
7
|
-
* @param {CucumberConfig} config
|
|
8
|
-
* @example
|
|
9
|
-
* export default defineConfig({
|
|
10
|
-
* testDir: defineCucumber({
|
|
11
|
-
* config: 'cucumber.ts',
|
|
12
|
-
* profile: 'chrome', // optional
|
|
13
|
-
* adapter: 'path/to/adapter' // optional
|
|
14
|
-
* }),
|
|
15
|
-
* })
|
|
16
|
-
*/
|
|
17
|
-
function defineCucumber(config) {
|
|
18
|
-
process.env.CONFIG = config.config;
|
|
19
|
-
process.env.PROFILE = config.profile ?? 'default';
|
|
20
|
-
return config.adapter ?? (0, node_path_1.resolve)('./node_modules/@qavajs/playwright-runner-adapter/adapter');
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=defineCucumber.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"defineCucumber.js","sourceRoot":"","sources":["../src/defineCucumber.ts"],"names":[],"mappings":";;AAoBA,wCAIC;AAxBD,yCAAoC;AAQpC;;;;;;;;;;;GAWG;AACH,SAAgB,cAAc,CAAC,MAAsB;IACjD,OAAO,CAAC,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IACnC,OAAO,CAAC,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,SAAS,CAAC;IAClD,OAAO,MAAM,CAAC,OAAO,IAAI,IAAA,mBAAO,EAAC,0DAA0D,CAAC,CAAC;AACjG,CAAC"}
|