@qavajs/playwright-runner-adapter 2.3.0 → 2.3.2
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 +16 -0
- package/README.md +347 -39
- package/adapter/PlaywrightWorld.d.ts +9 -16
- package/adapter/PlaywrightWorld.js +11 -13
- package/adapter/PlaywrightWorld.js.map +1 -1
- package/adapter/cucumberAdapter.d.ts +2 -4
- package/adapter/cucumberAdapter.js +16 -31
- package/adapter/cucumberAdapter.js.map +1 -1
- package/adapter/js/PlaywrightWorld.d.ts +9 -16
- package/adapter/js/PlaywrightWorld.js +11 -13
- package/adapter/js/cucumberAdapter.d.ts +2 -4
- package/adapter/js/cucumberAdapter.js +16 -31
- package/adapter/js/loader.d.ts +4 -11
- package/adapter/js/types.d.ts +67 -0
- package/adapter/js/types.js +2 -0
- package/adapter/loader.d.ts +4 -11
- package/adapter/loader.js.map +1 -1
- package/adapter/types.d.ts +67 -0
- package/adapter/types.js +3 -0
- package/adapter/types.js.map +1 -0
- package/package.json +30 -9
- package/src/PlaywrightWorld.ts +0 -53
- package/src/Template.ts +0 -23
- package/src/cucumberAdapter.ts +0 -388
- package/src/filter.ts +0 -53
- package/src/index.ts +0 -5
- package/src/loader.ts +0 -70
- package/tsconfig.js.json +0 -23
- package/tsconfig.json +0 -23
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.defineConfig = defineConfig;
|
|
4
4
|
const loader_1 = require("./loader");
|
|
5
|
-
|
|
5
|
+
const DEBUG = process.env.DEBUG?.split(',').includes('cucumber-adapter') ?? false;
|
|
6
6
|
const ANNOTATION_TYPES = {
|
|
7
7
|
NAME: 'name',
|
|
8
8
|
URI: 'uri',
|
|
@@ -30,9 +30,6 @@ const STEP_ARGUMENT_LABELS = {
|
|
|
30
30
|
DOC_STRING: ' [MultiLine]',
|
|
31
31
|
DATA_TABLE: ' [DataTable]'
|
|
32
32
|
};
|
|
33
|
-
/**
|
|
34
|
-
* Creates a location object from step definition
|
|
35
|
-
*/
|
|
36
33
|
function getLine(step) {
|
|
37
34
|
return {
|
|
38
35
|
location: {
|
|
@@ -42,23 +39,14 @@ function getLine(step) {
|
|
|
42
39
|
}
|
|
43
40
|
};
|
|
44
41
|
}
|
|
45
|
-
/**
|
|
46
|
-
* Logs data to console
|
|
47
|
-
*/
|
|
48
42
|
function log(data) {
|
|
49
43
|
console.log(data);
|
|
50
44
|
}
|
|
51
|
-
/**
|
|
52
|
-
* Attaches content to test report
|
|
53
|
-
*/
|
|
54
45
|
function attach(body, details) {
|
|
55
46
|
const fileName = details?.fileName ?? DEFAULT_VALUES.ATTACHMENT_FILENAME;
|
|
56
47
|
const contentType = details?.mediaType ?? DEFAULT_VALUES.CONTENT_TYPE;
|
|
57
|
-
return this.test.info().attach(fileName, { body, contentType });
|
|
48
|
+
return this.test.info().attach(fileName, { body: body, contentType });
|
|
58
49
|
}
|
|
59
|
-
/**
|
|
60
|
-
* Generates a human-readable step name with argument type indicator
|
|
61
|
-
*/
|
|
62
50
|
function stepName(pickleStep) {
|
|
63
51
|
let step = pickleStep.text;
|
|
64
52
|
if (pickleStep.argument) {
|
|
@@ -76,14 +64,14 @@ function createTestExecutionResult() {
|
|
|
76
64
|
}
|
|
77
65
|
function createHookResult(result) {
|
|
78
66
|
return {
|
|
79
|
-
duration:
|
|
67
|
+
duration: Date.now() - result.start,
|
|
80
68
|
message: result.error?.message,
|
|
81
69
|
status: result.status.toUpperCase(),
|
|
82
70
|
exception: result.error
|
|
83
71
|
};
|
|
84
72
|
}
|
|
85
73
|
function createScenarioAnnotation(testCase) {
|
|
86
|
-
const tag = [...new Set(testCase.tags.map(
|
|
74
|
+
const tag = [...new Set(testCase.tags.map(item => item.name))];
|
|
87
75
|
return [
|
|
88
76
|
{ type: ANNOTATION_TYPES.NAME, description: testCase.name },
|
|
89
77
|
{ type: ANNOTATION_TYPES.URI, description: testCase.uri },
|
|
@@ -91,7 +79,7 @@ function createScenarioAnnotation(testCase) {
|
|
|
91
79
|
];
|
|
92
80
|
}
|
|
93
81
|
function createScenarioTags(testCase) {
|
|
94
|
-
return [...new Set(testCase.tags.map(
|
|
82
|
+
return [...new Set(testCase.tags.map(item => item.name))];
|
|
95
83
|
}
|
|
96
84
|
function createCaseHookPayload(feature, testCase) {
|
|
97
85
|
return {
|
|
@@ -136,20 +124,23 @@ function createCaseHookParameter(feature, testCase, result) {
|
|
|
136
124
|
result: createHookResult(result)
|
|
137
125
|
};
|
|
138
126
|
}
|
|
139
|
-
function findSingleStepDefinition(supportCodeLibrary, pickleStep) {
|
|
127
|
+
function findSingleStepDefinition(supportCodeLibrary, pickleStep, featureUri) {
|
|
140
128
|
const matchingSteps = supportCodeLibrary.stepDefinitions
|
|
141
|
-
.filter(
|
|
129
|
+
.filter(stepDefinition => stepDefinition.matchesStepName(pickleStep.text));
|
|
130
|
+
if (DEBUG) {
|
|
131
|
+
console.log(`[cucumber-adapter] Matching: "${pickleStep.text}" — ${matchingSteps.length} match(es)`);
|
|
132
|
+
}
|
|
142
133
|
if (matchingSteps.length === 0) {
|
|
143
|
-
throw new Error(`Step '${pickleStep.text}' is not defined`);
|
|
134
|
+
throw new Error(`Step '${pickleStep.text}' is not defined\n at ${featureUri}`);
|
|
144
135
|
}
|
|
145
136
|
if (matchingSteps.length > 1) {
|
|
146
|
-
|
|
137
|
+
const locations = matchingSteps
|
|
138
|
+
.map(s => ` ${s.uri}:${s.line}`)
|
|
139
|
+
.join('\n');
|
|
140
|
+
throw new Error(`Step '${pickleStep.text}' matches multiple step definitions:\n${locations}`);
|
|
147
141
|
}
|
|
148
142
|
return matchingSteps[0];
|
|
149
143
|
}
|
|
150
|
-
/**
|
|
151
|
-
* Executes before all hooks
|
|
152
|
-
*/
|
|
153
144
|
function executeBeforeAllHooks(test, hooks) {
|
|
154
145
|
if (hooks.length === 0)
|
|
155
146
|
return;
|
|
@@ -160,9 +151,6 @@ function executeBeforeAllHooks(test, hooks) {
|
|
|
160
151
|
}
|
|
161
152
|
});
|
|
162
153
|
}
|
|
163
|
-
/**
|
|
164
|
-
* Executes after all hooks
|
|
165
|
-
*/
|
|
166
154
|
function executeAfterAllHooks(test, hooks) {
|
|
167
155
|
if (hooks.length === 0)
|
|
168
156
|
return;
|
|
@@ -173,9 +161,6 @@ function executeAfterAllHooks(test, hooks) {
|
|
|
173
161
|
}
|
|
174
162
|
});
|
|
175
163
|
}
|
|
176
|
-
/**
|
|
177
|
-
* Main configuration function that sets up Cucumber adapter for Playwright
|
|
178
|
-
*/
|
|
179
164
|
function defineConfig(config) {
|
|
180
165
|
const { features, supportCodeLibrary } = (0, loader_1.load)(config);
|
|
181
166
|
const fixture = new supportCodeLibrary.World({ config });
|
|
@@ -202,7 +187,7 @@ function defineConfig(config) {
|
|
|
202
187
|
if (result.status !== 'passed') {
|
|
203
188
|
break;
|
|
204
189
|
}
|
|
205
|
-
const step = findSingleStepDefinition(supportCodeLibrary, pickleStep);
|
|
190
|
+
const step = findSingleStepDefinition(supportCodeLibrary, pickleStep, feature.uri);
|
|
206
191
|
const location = getLine(step);
|
|
207
192
|
await test.step(stepName(pickleStep), async () => {
|
|
208
193
|
await executeStepHooks(test, supportCodeLibrary.beforeTestStepHookDefinitions, world, testCase, HOOK_NAMES.BEFORE_STEP, () => ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cucumberAdapter.js","sourceRoot":"","sources":["../src/cucumberAdapter.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"cucumberAdapter.js","sourceRoot":"","sources":["../src/cucumberAdapter.ts"],"names":[],"mappings":";;AA6QA,oCAmGC;AAhXD,qCAA8B;AAc9B,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,kBAAkB,CAAC,IAAI,KAAK,CAAC;AAElF,MAAM,gBAAgB,GAAG;IACrB,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CAAC,CAAC;wBACjB,CAAC;oBACL,CAAC;4BAAS,CAAC;wBACP,MAAM,gBAAgB,CAClB,IAAI,EACJ,kBAAkB,CAAC,4BAA4B,EAC/C,KAAK,EACL,QAAQ,EACR,UAAU,CAAC,KAAK,EAChB,GAAG,EAAE,CAAC,uBAAuB,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,CAC3D,CAAC;oBACN,CAAC;gBAEL,CAAC,CAAC;gBACF,QAAQ,CAAC,QAAQ,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;gBAClD,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAC,GAAG,EAAE,UAAU,EAAC,EAAE,QAAQ,CAAC,CAAC;YACrD,CAAC;QAEL,CAAC,CAAC,CAAC;IACP,CAAC;IAED,oBAAoB,CAAC,IAAI,EAAE,kBAAkB,CAAC,2BAA2B,CAAC,CAAC;AAC/E,CAAC"}
|
|
@@ -1,31 +1,24 @@
|
|
|
1
1
|
import { APIRequestContext, Browser, BrowserContext, Page } from '@playwright/test';
|
|
2
|
-
|
|
3
|
-
* Cucumber world for playwright adapter
|
|
4
|
-
*/
|
|
2
|
+
import type { CucumberAdapterConfig, SupportCodeLibrary, WorldOptions } from './types';
|
|
5
3
|
export declare class TestWorld {
|
|
6
|
-
log: (data:
|
|
7
|
-
attach: (data:
|
|
4
|
+
log: (data: unknown) => void;
|
|
5
|
+
attach: (data: unknown, details?: {
|
|
8
6
|
fileName?: string;
|
|
9
7
|
mediaType: string;
|
|
10
8
|
}) => Promise<void>;
|
|
11
|
-
parameters:
|
|
12
|
-
config:
|
|
13
|
-
supportCodeLibrary:
|
|
9
|
+
parameters: unknown;
|
|
10
|
+
config: CucumberAdapterConfig;
|
|
11
|
+
supportCodeLibrary: SupportCodeLibrary;
|
|
14
12
|
test: import("@playwright/test").TestType<import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions, import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions>;
|
|
15
13
|
expect: import("@playwright/test").Expect<{}>;
|
|
16
|
-
constructor(options:
|
|
17
|
-
executeStep(this:
|
|
14
|
+
constructor(options: WorldOptions);
|
|
15
|
+
executeStep(this: TestWorld, text: string, extraParam?: unknown): Promise<void>;
|
|
18
16
|
}
|
|
19
|
-
/**
|
|
20
|
-
* Cucumber Playwright world for playwright adapter
|
|
21
|
-
*/
|
|
22
17
|
export declare class PlaywrightWorld extends TestWorld {
|
|
23
18
|
page: Page;
|
|
24
19
|
context: BrowserContext;
|
|
25
20
|
browser: Browser;
|
|
26
21
|
browserName: string;
|
|
27
22
|
request: APIRequestContext;
|
|
28
|
-
init: (
|
|
29
|
-
[fixture: string]: any;
|
|
30
|
-
});
|
|
23
|
+
init: (fixtures: any) => void;
|
|
31
24
|
}
|
|
@@ -2,9 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PlaywrightWorld = exports.TestWorld = void 0;
|
|
4
4
|
const test_1 = require("@playwright/test");
|
|
5
|
-
/**
|
|
6
|
-
* Cucumber world for playwright adapter
|
|
7
|
-
*/
|
|
8
5
|
class TestWorld {
|
|
9
6
|
log;
|
|
10
7
|
attach;
|
|
@@ -14,19 +11,22 @@ class TestWorld {
|
|
|
14
11
|
test = test_1.test;
|
|
15
12
|
expect = test_1.expect;
|
|
16
13
|
constructor(options) {
|
|
17
|
-
this.log = options.log;
|
|
14
|
+
this.log = options.log ?? console.log;
|
|
18
15
|
this.attach = options.attach;
|
|
19
16
|
this.parameters = options.parameters;
|
|
20
17
|
this.supportCodeLibrary = options.supportCodeLibrary;
|
|
21
18
|
this.config = options.config;
|
|
22
19
|
}
|
|
23
20
|
async executeStep(text, extraParam) {
|
|
24
|
-
const steps = this.supportCodeLibrary.stepDefinitions
|
|
21
|
+
const steps = this.supportCodeLibrary.stepDefinitions
|
|
22
|
+
.filter(s => s.matchesStepName(text));
|
|
25
23
|
if (steps.length === 0)
|
|
26
24
|
throw new Error(`Step "${text}" is not defined`);
|
|
27
|
-
if (steps.length > 1)
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
if (steps.length > 1) {
|
|
26
|
+
const locations = steps.map(s => ` ${s.uri}:${s.line}`).join('\n');
|
|
27
|
+
throw new Error(`Step "${text}" matches multiple step definitions:\n${locations}`);
|
|
28
|
+
}
|
|
29
|
+
const step = steps[0];
|
|
30
30
|
const { parameters } = await step.getInvocationParameters({ step: { text }, world: this });
|
|
31
31
|
try {
|
|
32
32
|
await step.code.apply(this, [...parameters, extraParam]);
|
|
@@ -37,20 +37,18 @@ class TestWorld {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
exports.TestWorld = TestWorld;
|
|
40
|
-
/**
|
|
41
|
-
* Cucumber Playwright world for playwright adapter
|
|
42
|
-
*/
|
|
43
40
|
class PlaywrightWorld extends TestWorld {
|
|
44
41
|
page;
|
|
45
42
|
context;
|
|
46
43
|
browser;
|
|
47
44
|
browserName;
|
|
48
45
|
request;
|
|
49
|
-
|
|
46
|
+
// Cast preserves the destructured param form that Playwright reads via toString() to discover fixtures
|
|
47
|
+
init = (({ browser, context, page, request }) => {
|
|
50
48
|
this.browser = browser;
|
|
51
49
|
this.context = context;
|
|
52
50
|
this.page = page;
|
|
53
51
|
this.request = request;
|
|
54
|
-
};
|
|
52
|
+
});
|
|
55
53
|
}
|
|
56
54
|
exports.PlaywrightWorld = PlaywrightWorld;
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*/
|
|
4
|
-
export declare function defineConfig(config: any): any;
|
|
1
|
+
import type { CucumberAdapterConfig } from './types';
|
|
2
|
+
export declare function defineConfig(config: CucumberAdapterConfig): void;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.defineConfig = defineConfig;
|
|
4
4
|
const loader_1 = require("./loader");
|
|
5
|
-
|
|
5
|
+
const DEBUG = process.env.DEBUG?.split(',').includes('cucumber-adapter') ?? false;
|
|
6
6
|
const ANNOTATION_TYPES = {
|
|
7
7
|
NAME: 'name',
|
|
8
8
|
URI: 'uri',
|
|
@@ -30,9 +30,6 @@ const STEP_ARGUMENT_LABELS = {
|
|
|
30
30
|
DOC_STRING: ' [MultiLine]',
|
|
31
31
|
DATA_TABLE: ' [DataTable]'
|
|
32
32
|
};
|
|
33
|
-
/**
|
|
34
|
-
* Creates a location object from step definition
|
|
35
|
-
*/
|
|
36
33
|
function getLine(step) {
|
|
37
34
|
return {
|
|
38
35
|
location: {
|
|
@@ -42,23 +39,14 @@ function getLine(step) {
|
|
|
42
39
|
}
|
|
43
40
|
};
|
|
44
41
|
}
|
|
45
|
-
/**
|
|
46
|
-
* Logs data to console
|
|
47
|
-
*/
|
|
48
42
|
function log(data) {
|
|
49
43
|
console.log(data);
|
|
50
44
|
}
|
|
51
|
-
/**
|
|
52
|
-
* Attaches content to test report
|
|
53
|
-
*/
|
|
54
45
|
function attach(body, details) {
|
|
55
46
|
const fileName = details?.fileName ?? DEFAULT_VALUES.ATTACHMENT_FILENAME;
|
|
56
47
|
const contentType = details?.mediaType ?? DEFAULT_VALUES.CONTENT_TYPE;
|
|
57
|
-
return this.test.info().attach(fileName, { body, contentType });
|
|
48
|
+
return this.test.info().attach(fileName, { body: body, contentType });
|
|
58
49
|
}
|
|
59
|
-
/**
|
|
60
|
-
* Generates a human-readable step name with argument type indicator
|
|
61
|
-
*/
|
|
62
50
|
function stepName(pickleStep) {
|
|
63
51
|
let step = pickleStep.text;
|
|
64
52
|
if (pickleStep.argument) {
|
|
@@ -76,14 +64,14 @@ function createTestExecutionResult() {
|
|
|
76
64
|
}
|
|
77
65
|
function createHookResult(result) {
|
|
78
66
|
return {
|
|
79
|
-
duration:
|
|
67
|
+
duration: Date.now() - result.start,
|
|
80
68
|
message: result.error?.message,
|
|
81
69
|
status: result.status.toUpperCase(),
|
|
82
70
|
exception: result.error
|
|
83
71
|
};
|
|
84
72
|
}
|
|
85
73
|
function createScenarioAnnotation(testCase) {
|
|
86
|
-
const tag = [...new Set(testCase.tags.map(
|
|
74
|
+
const tag = [...new Set(testCase.tags.map(item => item.name))];
|
|
87
75
|
return [
|
|
88
76
|
{ type: ANNOTATION_TYPES.NAME, description: testCase.name },
|
|
89
77
|
{ type: ANNOTATION_TYPES.URI, description: testCase.uri },
|
|
@@ -91,7 +79,7 @@ function createScenarioAnnotation(testCase) {
|
|
|
91
79
|
];
|
|
92
80
|
}
|
|
93
81
|
function createScenarioTags(testCase) {
|
|
94
|
-
return [...new Set(testCase.tags.map(
|
|
82
|
+
return [...new Set(testCase.tags.map(item => item.name))];
|
|
95
83
|
}
|
|
96
84
|
function createCaseHookPayload(feature, testCase) {
|
|
97
85
|
return {
|
|
@@ -136,20 +124,23 @@ function createCaseHookParameter(feature, testCase, result) {
|
|
|
136
124
|
result: createHookResult(result)
|
|
137
125
|
};
|
|
138
126
|
}
|
|
139
|
-
function findSingleStepDefinition(supportCodeLibrary, pickleStep) {
|
|
127
|
+
function findSingleStepDefinition(supportCodeLibrary, pickleStep, featureUri) {
|
|
140
128
|
const matchingSteps = supportCodeLibrary.stepDefinitions
|
|
141
|
-
.filter(
|
|
129
|
+
.filter(stepDefinition => stepDefinition.matchesStepName(pickleStep.text));
|
|
130
|
+
if (DEBUG) {
|
|
131
|
+
console.log(`[cucumber-adapter] Matching: "${pickleStep.text}" — ${matchingSteps.length} match(es)`);
|
|
132
|
+
}
|
|
142
133
|
if (matchingSteps.length === 0) {
|
|
143
|
-
throw new Error(`Step '${pickleStep.text}' is not defined`);
|
|
134
|
+
throw new Error(`Step '${pickleStep.text}' is not defined\n at ${featureUri}`);
|
|
144
135
|
}
|
|
145
136
|
if (matchingSteps.length > 1) {
|
|
146
|
-
|
|
137
|
+
const locations = matchingSteps
|
|
138
|
+
.map(s => ` ${s.uri}:${s.line}`)
|
|
139
|
+
.join('\n');
|
|
140
|
+
throw new Error(`Step '${pickleStep.text}' matches multiple step definitions:\n${locations}`);
|
|
147
141
|
}
|
|
148
142
|
return matchingSteps[0];
|
|
149
143
|
}
|
|
150
|
-
/**
|
|
151
|
-
* Executes before all hooks
|
|
152
|
-
*/
|
|
153
144
|
function executeBeforeAllHooks(test, hooks) {
|
|
154
145
|
if (hooks.length === 0)
|
|
155
146
|
return;
|
|
@@ -160,9 +151,6 @@ function executeBeforeAllHooks(test, hooks) {
|
|
|
160
151
|
}
|
|
161
152
|
});
|
|
162
153
|
}
|
|
163
|
-
/**
|
|
164
|
-
* Executes after all hooks
|
|
165
|
-
*/
|
|
166
154
|
function executeAfterAllHooks(test, hooks) {
|
|
167
155
|
if (hooks.length === 0)
|
|
168
156
|
return;
|
|
@@ -173,9 +161,6 @@ function executeAfterAllHooks(test, hooks) {
|
|
|
173
161
|
}
|
|
174
162
|
});
|
|
175
163
|
}
|
|
176
|
-
/**
|
|
177
|
-
* Main configuration function that sets up Cucumber adapter for Playwright
|
|
178
|
-
*/
|
|
179
164
|
function defineConfig(config) {
|
|
180
165
|
const { features, supportCodeLibrary } = (0, loader_1.load)(config);
|
|
181
166
|
const fixture = new supportCodeLibrary.World({ config });
|
|
@@ -202,7 +187,7 @@ function defineConfig(config) {
|
|
|
202
187
|
if (result.status !== 'passed') {
|
|
203
188
|
break;
|
|
204
189
|
}
|
|
205
|
-
const step = findSingleStepDefinition(supportCodeLibrary, pickleStep);
|
|
190
|
+
const step = findSingleStepDefinition(supportCodeLibrary, pickleStep, feature.uri);
|
|
206
191
|
const location = getLine(step);
|
|
207
192
|
await test.step(stepName(pickleStep), async () => {
|
|
208
193
|
await executeStepHooks(test, supportCodeLibrary.beforeTestStepHookDefinitions, world, testCase, HOOK_NAMES.BEFORE_STEP, () => ({
|
package/adapter/js/loader.d.ts
CHANGED
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
type Feature = {
|
|
3
|
-
feature?: string;
|
|
4
|
-
gherkinDocument: GherkinDocument;
|
|
5
|
-
tests: readonly Pickle[];
|
|
6
|
-
uri: string;
|
|
7
|
-
};
|
|
1
|
+
import type { CucumberAdapterConfig, Feature, SupportCodeLibrary } from './types';
|
|
8
2
|
export declare function loadFeatures(globPattern: string[]): Feature[];
|
|
9
|
-
export declare function loadStepDefinitions(globPattern: string[]):
|
|
10
|
-
export declare function load(config:
|
|
3
|
+
export declare function loadStepDefinitions(globPattern: string[]): SupportCodeLibrary;
|
|
4
|
+
export declare function load(config: CucumberAdapterConfig): {
|
|
11
5
|
features: Feature[];
|
|
12
|
-
supportCodeLibrary:
|
|
6
|
+
supportCodeLibrary: SupportCodeLibrary;
|
|
13
7
|
};
|
|
14
|
-
export {};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { GherkinDocument, Pickle } from '@cucumber/messages';
|
|
2
|
+
import type { TestType } from '@playwright/test';
|
|
3
|
+
export interface CucumberAdapterConfig {
|
|
4
|
+
paths: string[];
|
|
5
|
+
require?: string[];
|
|
6
|
+
requireModules?: string[];
|
|
7
|
+
import?: string[];
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
}
|
|
10
|
+
export interface WorldOptions {
|
|
11
|
+
log?: (data: unknown) => void;
|
|
12
|
+
attach?: (data: unknown, details?: {
|
|
13
|
+
fileName?: string;
|
|
14
|
+
mediaType?: string;
|
|
15
|
+
}) => Promise<void>;
|
|
16
|
+
parameters?: unknown;
|
|
17
|
+
supportCodeLibrary?: SupportCodeLibrary;
|
|
18
|
+
config?: CucumberAdapterConfig;
|
|
19
|
+
}
|
|
20
|
+
export interface HookDefinition {
|
|
21
|
+
uri: string;
|
|
22
|
+
line: number;
|
|
23
|
+
name?: string;
|
|
24
|
+
code: (this: unknown, ...args: unknown[]) => Promise<void> | void;
|
|
25
|
+
appliesToTestCase(testCase: Pickle): boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface StepDefinitionMatch {
|
|
28
|
+
uri: string;
|
|
29
|
+
line: number;
|
|
30
|
+
code: (this: unknown, ...args: unknown[]) => Promise<void> | void;
|
|
31
|
+
matchesStepName(text: string): boolean;
|
|
32
|
+
getInvocationParameters(options: {
|
|
33
|
+
step: {
|
|
34
|
+
text: string;
|
|
35
|
+
argument?: unknown;
|
|
36
|
+
};
|
|
37
|
+
world: unknown;
|
|
38
|
+
}): Promise<{
|
|
39
|
+
parameters: unknown[];
|
|
40
|
+
}>;
|
|
41
|
+
}
|
|
42
|
+
export interface HookResult {
|
|
43
|
+
duration: number;
|
|
44
|
+
message: string | undefined;
|
|
45
|
+
status: string;
|
|
46
|
+
exception: Error | undefined;
|
|
47
|
+
}
|
|
48
|
+
export interface WorldBase {
|
|
49
|
+
test: TestType<Record<string, unknown>, Record<string, unknown>>;
|
|
50
|
+
init: (fixtures: Record<string, unknown>) => void;
|
|
51
|
+
}
|
|
52
|
+
export interface SupportCodeLibrary {
|
|
53
|
+
World: new (options: WorldOptions) => WorldBase;
|
|
54
|
+
stepDefinitions: StepDefinitionMatch[];
|
|
55
|
+
beforeTestRunHookDefinitions: HookDefinition[];
|
|
56
|
+
afterTestRunHookDefinitions: HookDefinition[];
|
|
57
|
+
beforeTestCaseHookDefinitions: HookDefinition[];
|
|
58
|
+
afterTestCaseHookDefinitions: HookDefinition[];
|
|
59
|
+
beforeTestStepHookDefinitions: HookDefinition[];
|
|
60
|
+
afterTestStepHookDefinitions: HookDefinition[];
|
|
61
|
+
}
|
|
62
|
+
export interface Feature {
|
|
63
|
+
feature?: string;
|
|
64
|
+
gherkinDocument: GherkinDocument;
|
|
65
|
+
tests: readonly Pickle[];
|
|
66
|
+
uri: string;
|
|
67
|
+
}
|
package/adapter/loader.d.ts
CHANGED
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
type Feature = {
|
|
3
|
-
feature?: string;
|
|
4
|
-
gherkinDocument: GherkinDocument;
|
|
5
|
-
tests: readonly Pickle[];
|
|
6
|
-
uri: string;
|
|
7
|
-
};
|
|
1
|
+
import type { CucumberAdapterConfig, Feature, SupportCodeLibrary } from './types';
|
|
8
2
|
export declare function loadFeatures(globPattern: string[]): Feature[];
|
|
9
|
-
export declare function loadStepDefinitions(globPattern: string[]):
|
|
10
|
-
export declare function load(config:
|
|
3
|
+
export declare function loadStepDefinitions(globPattern: string[]): SupportCodeLibrary;
|
|
4
|
+
export declare function load(config: CucumberAdapterConfig): {
|
|
11
5
|
features: Feature[];
|
|
12
|
-
supportCodeLibrary:
|
|
6
|
+
supportCodeLibrary: SupportCodeLibrary;
|
|
13
7
|
};
|
|
14
|
-
export {};
|
package/adapter/loader.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":";;AA8BA,oCAYC;AAED,kDASC;AAED,oBAQC;AA/DD,qCAAuC;AACvC,yCAAoC;AACpC,6CAAyC;AACzC,+CAA4F;AAC5F,iDAA+D;AAE/D,+BAAgC;AAChC,uDAAoD;AAGpD,MAAM,MAAM,GAAG,GAAG,EAAE,CAAC,IAAA,wBAAU,GAAE,CAAC;AAClC,MAAM,OAAO,GAAG,IAAI,oBAAU,CAAC,MAAM,CAAC,CAAC;AACvC,MAAM,OAAO,GAAG,IAAI,oCAA0B,EAAE,CAAC;AACjD,MAAM,MAAM,GAAG,IAAI,gBAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;AAE3C,SAAS,UAAU,CAAC,KAAwB;IACxC,MAAM,MAAM,GAA2B,EAAE,CAAC;IAC1C,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;QACpB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACvB,IAAI,CAAC,CAAC,IAAI,IAAI,MAAM,CAAC,EAAE,CAAC;YACpB,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACrB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QAAQ,CAAC,CAAC;IACtB,CAAC;IACD,OAAO,oCAAyB,CAAC,QAAQ,EAAmC,CAAC;AACjF,CAAC;AAED,SAAgB,IAAI,CAAC,MAA6B;IAC9C,MAAM,QAAQ,GAAG,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5C,MAAM,kBAAkB,GAAG,mBAAmB,CAAC;QAC3C,GAAG,CAAC,MAAM,CAAC,cAAc,IAAI,EAAE,CAAC;QAChC,GAAG,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;QACzB,GAAG,CAAC,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC;KAC3B,CAAC,CAAC;IACH,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,CAAA;AAC3C,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { GherkinDocument, Pickle } from '@cucumber/messages';
|
|
2
|
+
import type { TestType } from '@playwright/test';
|
|
3
|
+
export interface CucumberAdapterConfig {
|
|
4
|
+
paths: string[];
|
|
5
|
+
require?: string[];
|
|
6
|
+
requireModules?: string[];
|
|
7
|
+
import?: string[];
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
}
|
|
10
|
+
export interface WorldOptions {
|
|
11
|
+
log?: (data: unknown) => void;
|
|
12
|
+
attach?: (data: unknown, details?: {
|
|
13
|
+
fileName?: string;
|
|
14
|
+
mediaType?: string;
|
|
15
|
+
}) => Promise<void>;
|
|
16
|
+
parameters?: unknown;
|
|
17
|
+
supportCodeLibrary?: SupportCodeLibrary;
|
|
18
|
+
config?: CucumberAdapterConfig;
|
|
19
|
+
}
|
|
20
|
+
export interface HookDefinition {
|
|
21
|
+
uri: string;
|
|
22
|
+
line: number;
|
|
23
|
+
name?: string;
|
|
24
|
+
code: (this: unknown, ...args: unknown[]) => Promise<void> | void;
|
|
25
|
+
appliesToTestCase(testCase: Pickle): boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface StepDefinitionMatch {
|
|
28
|
+
uri: string;
|
|
29
|
+
line: number;
|
|
30
|
+
code: (this: unknown, ...args: unknown[]) => Promise<void> | void;
|
|
31
|
+
matchesStepName(text: string): boolean;
|
|
32
|
+
getInvocationParameters(options: {
|
|
33
|
+
step: {
|
|
34
|
+
text: string;
|
|
35
|
+
argument?: unknown;
|
|
36
|
+
};
|
|
37
|
+
world: unknown;
|
|
38
|
+
}): Promise<{
|
|
39
|
+
parameters: unknown[];
|
|
40
|
+
}>;
|
|
41
|
+
}
|
|
42
|
+
export interface HookResult {
|
|
43
|
+
duration: number;
|
|
44
|
+
message: string | undefined;
|
|
45
|
+
status: string;
|
|
46
|
+
exception: Error | undefined;
|
|
47
|
+
}
|
|
48
|
+
export interface WorldBase {
|
|
49
|
+
test: TestType<Record<string, unknown>, Record<string, unknown>>;
|
|
50
|
+
init: (fixtures: Record<string, unknown>) => void;
|
|
51
|
+
}
|
|
52
|
+
export interface SupportCodeLibrary {
|
|
53
|
+
World: new (options: WorldOptions) => WorldBase;
|
|
54
|
+
stepDefinitions: StepDefinitionMatch[];
|
|
55
|
+
beforeTestRunHookDefinitions: HookDefinition[];
|
|
56
|
+
afterTestRunHookDefinitions: HookDefinition[];
|
|
57
|
+
beforeTestCaseHookDefinitions: HookDefinition[];
|
|
58
|
+
afterTestCaseHookDefinitions: HookDefinition[];
|
|
59
|
+
beforeTestStepHookDefinitions: HookDefinition[];
|
|
60
|
+
afterTestStepHookDefinitions: HookDefinition[];
|
|
61
|
+
}
|
|
62
|
+
export interface Feature {
|
|
63
|
+
feature?: string;
|
|
64
|
+
gherkinDocument: GherkinDocument;
|
|
65
|
+
tests: readonly Pickle[];
|
|
66
|
+
uri: string;
|
|
67
|
+
}
|
package/adapter/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|