@qavajs/playwright-runner-adapter 2.3.2 → 2.4.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/CHANGELOG.md +19 -0
- package/README.md +38 -0
- package/adapter/PlaywrightWorld.d.ts +1 -1
- package/adapter/PlaywrightWorld.js +1 -1
- package/adapter/PlaywrightWorld.js.map +1 -1
- package/adapter/Template.d.ts +1 -1
- package/adapter/Template.js.map +1 -1
- package/adapter/cucumberAdapter.js +8 -24
- package/adapter/cucumberAdapter.js.map +1 -1
- package/adapter/filter.js +2 -5
- package/adapter/filter.js.map +1 -1
- package/adapter/index.d.ts +1 -0
- package/adapter/index.js +1 -0
- package/adapter/index.js.map +1 -1
- package/adapter/js/PlaywrightWorld.d.ts +1 -1
- package/adapter/js/PlaywrightWorld.js +1 -1
- package/adapter/js/Template.d.ts +1 -1
- package/adapter/js/cucumberAdapter.js +8 -24
- package/adapter/js/filter.js +2 -5
- package/adapter/js/index.d.ts +1 -0
- package/adapter/js/index.js +1 -0
- package/adapter/js/testDetails.d.ts +18 -0
- package/adapter/js/testDetails.js +52 -0
- package/adapter/js/types.d.ts +2 -2
- package/adapter/loader.js.map +1 -1
- package/adapter/testDetails.d.ts +18 -0
- package/adapter/testDetails.js +53 -0
- package/adapter/testDetails.js.map +1 -0
- package/adapter/types.d.ts +2 -2
- package/package.json +9 -8
package/CHANGELOG.md
CHANGED
|
@@ -14,6 +14,25 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
|
|
|
14
14
|
|
|
15
15
|
:microscope: - experimental
|
|
16
16
|
|
|
17
|
+
## [2.4.0]
|
|
18
|
+
- :rocket: added `@lock(name)` tag mapped to playwright test locks (`@lock(-exclusive-)` for the built-in exclusive lock)
|
|
19
|
+
- :rocket: added `@skip(reason)`, `@fixme(reason)`, `@fail(reason)`, `@slow(reason)` tags mapped to playwright test modifiers (reason is optional: `@skip()`)
|
|
20
|
+
- :rocket: added `@annotation(type,description)` tag mapped to playwright test annotations
|
|
21
|
+
- :pencil: special tags (`@lock(...)`, `@annotation(...)`, `@skip(...)`, `@fixme(...)`, `@fail(...)`, `@slow(...)`) are removed from playwright tags
|
|
22
|
+
- :pencil: updated `@cucumber/cucumber` to 13, `@cucumber/gherkin` to 42, `@cucumber/tag-expressions` to 11 and `glob` to 14
|
|
23
|
+
- :pencil: updated dev dependencies: `@playwright/test` 1.65, `@types/node` 26, `typescript` 7
|
|
24
|
+
- :pencil: switched `module` and `moduleResolution` to `nodenext` in `tsconfig.json` and `tsconfig.js.json`
|
|
25
|
+
- :x: dropped Node.js 20 support (`engines.node` is now `>=22`); CI tests against Node.js 22, 24 and 26
|
|
26
|
+
- :pencil: CI: updated `actions/checkout` and `actions/setup-node` to v7, `mikepenz/action-junit-report` to v6; tests also run on push to `main`, `npm audit` gate for production dependencies, junit report requires tests, e2e tests gate npm publish, publish with provenance
|
|
27
|
+
|
|
28
|
+
## [2.3.3]
|
|
29
|
+
- :beetle: fixed named import for `parse` from `@cucumber/tag-expressions` in `filter.ts`
|
|
30
|
+
- :beetle: fixed `attach` method assignment in `PlaywrightWorld` constructor
|
|
31
|
+
- :beetle: made `uri` optional in `HookDefinition` and `StepDefinitionMatch` interfaces
|
|
32
|
+
- :beetle: improved `executeStep` error handling to preserve original error as `cause`
|
|
33
|
+
- :pencil: made `mediaType` optional in `attach` method signature
|
|
34
|
+
- :pencil: removed debug log statements from `cucumberAdapter.ts`
|
|
35
|
+
|
|
17
36
|
## [2.3.2]
|
|
18
37
|
- :beetle: fixed fixture type cast in `PlaywrightWorld` to use `any` instead of `Record<string, unknown>`
|
|
19
38
|
|
package/README.md
CHANGED
|
@@ -19,6 +19,7 @@ Adapter to run [Cucumber](https://cucumber.io/) BDD tests via the [Playwright](h
|
|
|
19
19
|
- [Filtering Tests](#filtering-tests)
|
|
20
20
|
- [Tag Expressions](#tag-expressions)
|
|
21
21
|
- [Predicate Filter](#predicate-filter)
|
|
22
|
+
- [Annotations, Modifiers and Locks](#annotations-modifiers-and-locks)
|
|
22
23
|
- [Parallelism](#parallelism)
|
|
23
24
|
- [JavaScript / CommonJS Support](#javascript--commonjs-support)
|
|
24
25
|
- [Limitations](#limitations)
|
|
@@ -348,6 +349,43 @@ The predicate receives the full test name (feature + scenario title + tags) and
|
|
|
348
349
|
|
|
349
350
|
---
|
|
350
351
|
|
|
352
|
+
## Annotations, Modifiers and Locks
|
|
353
|
+
|
|
354
|
+
Gherkin tags are translated into Playwright [test details](https://playwright.dev/docs/test-annotations). The special tags below are consumed: they are removed from the scenario's Playwright tags (and the `tags` annotation), so they don't show up as tags in reports and can't be matched with `grep` / `tags()`. All other tags are kept as Playwright tags.
|
|
355
|
+
|
|
356
|
+
| Tag | Playwright equivalent |
|
|
357
|
+
|---|---|
|
|
358
|
+
| `@skip()` / `@skip(reason)` | skips the scenario — fixtures are not set up |
|
|
359
|
+
| `@fixme()` / `@fixme(reason)` | same as skip, marks the scenario as to be fixed |
|
|
360
|
+
| `@fail()` / `@fail(reason)` | scenario passes only if it fails |
|
|
361
|
+
| `@slow()` / `@slow(reason)` | triples the timeout |
|
|
362
|
+
| `@lock(name)` | `lock: 'name'` — scenarios sharing a lock never run concurrently |
|
|
363
|
+
| `@lock(-exclusive-)` | built-in exclusive lock — runs only when no other test is running |
|
|
364
|
+
| `@annotation(type,description)` | `annotation: { type, description }` — description is optional: `@annotation(flaky)` |
|
|
365
|
+
|
|
366
|
+
Modifiers are passed as annotations of type `skip`, `fixme`, `fail`, `slow`, which Playwright applies like `test.skip()` and the other modifiers, and the optional reason is shown in the report. Plain tags such as `@skip` or `@slow` are ordinary tags and do nothing. Tags set on a `Feature` or `Rule` apply to all its scenarios.
|
|
367
|
+
|
|
368
|
+
> Gherkin tags may not contain whitespace, so write `@annotation(issue,JIRA-123)` without a space after the comma. Everything after the first comma is the description.
|
|
369
|
+
|
|
370
|
+
```gherkin
|
|
371
|
+
@lock(user-settings)
|
|
372
|
+
Feature: user settings
|
|
373
|
+
|
|
374
|
+
@annotation(issue,JIRA-123)
|
|
375
|
+
Scenario: update settings
|
|
376
|
+
When I update settings
|
|
377
|
+
|
|
378
|
+
@lock(-exclusive-) @slow(full-reset)
|
|
379
|
+
Scenario: reset all data
|
|
380
|
+
When I reset the database
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
Locks are a lighter alternative to splitting scenarios into a separate serial project (see [Parallelism](#parallelism)): only scenarios sharing the same lock are serialized, everything else stays parallel. Locks require `@playwright/test` 1.65+.
|
|
384
|
+
|
|
385
|
+
Runtime annotations can be added from steps via `this.test.info().annotations.push({ type, description })`.
|
|
386
|
+
|
|
387
|
+
---
|
|
388
|
+
|
|
351
389
|
## Parallelism
|
|
352
390
|
|
|
353
391
|
Playwright projects let you run subsets of scenarios in parallel or serially:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlaywrightWorld.js","sourceRoot":"","sources":["../src/PlaywrightWorld.ts"],"names":[],"mappings":";;;AAAA,2CAAkG;AAGlG
|
|
1
|
+
{"version":3,"file":"PlaywrightWorld.js","sourceRoot":"","sources":["../src/PlaywrightWorld.ts"],"names":[],"mappings":";;;AAAA,2CAAkG;AAGlG;IACI,GAAG,CAA2B;IAC9B,MAAM,CAAyF;IAC/F,UAAU,CAAW;IACrB,MAAM,CAAyB;IAC/B,kBAAkB,CAAsB;IACxC,IAAI,GAAG,WAAI,CAAC;IACZ,MAAM,GAAG,aAAM,CAAC;IAEhB,YAAY,OAAqB;QAC7B,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC;QACtC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAO,CAAC;QAC9B,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QACrC,IAAI,CAAC,kBAAkB,GAAG,OAAO,CAAC,kBAAmB,CAAC;QACtD,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAO,CAAC;IAClC,CAAC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IAE5B,uGAAuG;IACvG,IAAI,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAyF,EAAE,EAAE;QACnI,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC,CAA4B,CAAC;CACjC"}
|
package/adapter/Template.d.ts
CHANGED
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* I expect '${locator} > Value' to equal '${expected}'
|
|
8
8
|
* `));
|
|
9
9
|
*/
|
|
10
|
-
export declare function Template(scenario: (...args:
|
|
10
|
+
export declare function Template(scenario: (...args: unknown[]) => string): (...args: unknown[]) => string;
|
package/adapter/Template.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Template.js","sourceRoot":"","sources":["../src/Template.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Template.js","sourceRoot":"","sources":["../src/Template.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;GAQG;AACH,kBAAyB,QAAwC;IAC7D,OAAO,IAAI,KAAK,CAAC,QAAQ,EAAE;QACvB,KAAK,EAAE,KAAK,WAAW,QAAwC,EAAE,KAAgB,EAAE,IAAe;YAC9F,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,IAAI,CAAC,CAAC;YACnC,MAAM,KAAK,GAAG,QAAQ;iBACjB,KAAK,CAAC,IAAI,CAAC;iBACX,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;iBACxB,MAAM,CAAC,OAAO,CAAC,CAAC;YACrB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;gBACvB,MAAM,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;YAClC,CAAC;QACL,CAAC;KACJ,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -2,12 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.defineConfig = defineConfig;
|
|
4
4
|
const loader_1 = require("./loader");
|
|
5
|
-
const
|
|
6
|
-
const ANNOTATION_TYPES = {
|
|
7
|
-
NAME: 'name',
|
|
8
|
-
URI: 'uri',
|
|
9
|
-
TAGS: 'tags'
|
|
10
|
-
};
|
|
5
|
+
const testDetails_1 = require("./testDetails");
|
|
11
6
|
const HOOK_NAMES = {
|
|
12
7
|
BEFORE_ALL: 'Before All',
|
|
13
8
|
AFTER_ALL: 'After All',
|
|
@@ -31,6 +26,8 @@ const STEP_ARGUMENT_LABELS = {
|
|
|
31
26
|
DATA_TABLE: ' [DataTable]'
|
|
32
27
|
};
|
|
33
28
|
function getLine(step) {
|
|
29
|
+
if (!step.uri)
|
|
30
|
+
return {};
|
|
34
31
|
return {
|
|
35
32
|
location: {
|
|
36
33
|
column: DEFAULT_VALUES.COLUMN,
|
|
@@ -70,21 +67,11 @@ function createHookResult(result) {
|
|
|
70
67
|
exception: result.error
|
|
71
68
|
};
|
|
72
69
|
}
|
|
73
|
-
function createScenarioAnnotation(testCase) {
|
|
74
|
-
const tag = [...new Set(testCase.tags.map(item => item.name))];
|
|
75
|
-
return [
|
|
76
|
-
{ type: ANNOTATION_TYPES.NAME, description: testCase.name },
|
|
77
|
-
{ type: ANNOTATION_TYPES.URI, description: testCase.uri },
|
|
78
|
-
{ type: ANNOTATION_TYPES.TAGS, description: JSON.stringify(tag) }
|
|
79
|
-
];
|
|
80
|
-
}
|
|
81
|
-
function createScenarioTags(testCase) {
|
|
82
|
-
return [...new Set(testCase.tags.map(item => item.name))];
|
|
83
|
-
}
|
|
84
70
|
function createCaseHookPayload(feature, testCase) {
|
|
85
71
|
return {
|
|
86
72
|
gherkinDocument: feature.gherkinDocument,
|
|
87
|
-
pickle: testCase
|
|
73
|
+
pickle: testCase,
|
|
74
|
+
testCaseStartedId: DEFAULT_VALUES.TEST_CASE_ID
|
|
88
75
|
};
|
|
89
76
|
}
|
|
90
77
|
async function executeCaseHooks(test, hooks, world, testCase, defaultHookName, createPayload) {
|
|
@@ -127,9 +114,6 @@ function createCaseHookParameter(feature, testCase, result) {
|
|
|
127
114
|
function findSingleStepDefinition(supportCodeLibrary, pickleStep, featureUri) {
|
|
128
115
|
const matchingSteps = supportCodeLibrary.stepDefinitions
|
|
129
116
|
.filter(stepDefinition => stepDefinition.matchesStepName(pickleStep.text));
|
|
130
|
-
if (DEBUG) {
|
|
131
|
-
console.log(`[cucumber-adapter] Matching: "${pickleStep.text}" — ${matchingSteps.length} match(es)`);
|
|
132
|
-
}
|
|
133
117
|
if (matchingSteps.length === 0) {
|
|
134
118
|
throw new Error(`Step '${pickleStep.text}' is not defined\n at ${featureUri}`);
|
|
135
119
|
}
|
|
@@ -170,8 +154,7 @@ function defineConfig(config) {
|
|
|
170
154
|
const tests = feature.tests;
|
|
171
155
|
test.describe(feature.feature, () => {
|
|
172
156
|
for (const testCase of tests) {
|
|
173
|
-
const tag =
|
|
174
|
-
const annotation = createScenarioAnnotation(testCase);
|
|
157
|
+
const { tag, annotation, lock } = (0, testDetails_1.resolveTestDetails)(testCase);
|
|
175
158
|
const testBody = async (fixtures) => {
|
|
176
159
|
const world = new supportCodeLibrary.World({
|
|
177
160
|
log,
|
|
@@ -221,7 +204,8 @@ function defineConfig(config) {
|
|
|
221
204
|
}
|
|
222
205
|
};
|
|
223
206
|
testBody.toString = () => fixture.init.toString();
|
|
224
|
-
|
|
207
|
+
const details = lock.length > 0 ? { tag, annotation, lock } : { tag, annotation };
|
|
208
|
+
test(testCase.name, details, testBody);
|
|
225
209
|
}
|
|
226
210
|
});
|
|
227
211
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cucumberAdapter.js","sourceRoot":"","sources":["../src/cucumberAdapter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"c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CAAC"}
|
package/adapter/filter.js
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.tags = tags;
|
|
7
4
|
exports.filter = filter;
|
|
8
|
-
const tag_expressions_1 =
|
|
5
|
+
const tag_expressions_1 = require("@cucumber/tag-expressions");
|
|
9
6
|
class TagExpression extends RegExp {
|
|
10
7
|
tagExpression;
|
|
11
8
|
expressionNode;
|
|
12
9
|
constructor(tagExpression) {
|
|
13
10
|
super('');
|
|
14
11
|
this.tagExpression = tagExpression;
|
|
15
|
-
this.expressionNode = (0, tag_expressions_1.
|
|
12
|
+
this.expressionNode = (0, tag_expressions_1.parse)(this.tagExpression);
|
|
16
13
|
}
|
|
17
14
|
test(testName) {
|
|
18
15
|
const tokens = testName.split(/\s+/);
|
package/adapter/filter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter.js","sourceRoot":"","sources":["../src/filter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"filter.js","sourceRoot":"","sources":["../src/filter.ts"],"names":[],"mappings":";;;;AAAA,+DAAkD;AAElD,MAAM,aAAc,SAAQ,MAAM;IAKV,aAAa;IAJzB,cAAc,CAEpB;IAEF,YAAoB,aAAqB;QACrC,KAAK,CAAC,EAAE,CAAC,CAAC;6BADM,aAAa;QAE7B,IAAI,CAAC,cAAc,GAAG,IAAA,uBAAK,EAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IACpD,CAAC;IAED,IAAI,CAAC,QAAgB;QACjB,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACrC,OAAO,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAChD,CAAC;CACJ;AAED;;;;;;;;GAQG;AACH,cAAqB,aAAqB;IACtC,OAAO,IAAI,aAAa,CAAC,aAAa,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,MAAO,SAAQ,MAAM;IACH,SAAS;IAA7B,YAAoB,SAAwC;QACxD,KAAK,CAAC,EAAE,CAAC,CAAC;yBADM,SAAS;QAEzB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC/B,CAAC;IAED,IAAI,CAAC,QAAgB;QACjB,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IACpC,CAAC;CACJ;AAED;;;;;;;GAOG;AACH,gBAAuB,SAAwC;IAC3D,OAAO,IAAI,MAAM,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC"}
|
package/adapter/index.d.ts
CHANGED
package/adapter/index.js
CHANGED
|
@@ -19,4 +19,5 @@ __exportStar(require("./filter"), exports);
|
|
|
19
19
|
__exportStar(require("./Template"), exports);
|
|
20
20
|
__exportStar(require("@cucumber/cucumber"), exports);
|
|
21
21
|
__exportStar(require("./cucumberAdapter"), exports);
|
|
22
|
+
__exportStar(require("./testDetails"), exports);
|
|
22
23
|
//# sourceMappingURL=index.js.map
|
package/adapter/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,2CAAyB;AACzB,6CAA2B;AAC3B,qDAAmC;AACnC,oDAAkC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,2CAAyB;AACzB,6CAA2B;AAC3B,qDAAmC;AACnC,oDAAkC;AAAA,gDAA8B"}
|
package/adapter/js/Template.d.ts
CHANGED
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* I expect '${locator} > Value' to equal '${expected}'
|
|
8
8
|
* `));
|
|
9
9
|
*/
|
|
10
|
-
export declare function Template(scenario: (...args:
|
|
10
|
+
export declare function Template(scenario: (...args: unknown[]) => string): (...args: unknown[]) => string;
|
|
@@ -2,12 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.defineConfig = defineConfig;
|
|
4
4
|
const loader_1 = require("./loader");
|
|
5
|
-
const
|
|
6
|
-
const ANNOTATION_TYPES = {
|
|
7
|
-
NAME: 'name',
|
|
8
|
-
URI: 'uri',
|
|
9
|
-
TAGS: 'tags'
|
|
10
|
-
};
|
|
5
|
+
const testDetails_1 = require("./testDetails");
|
|
11
6
|
const HOOK_NAMES = {
|
|
12
7
|
BEFORE_ALL: 'Before All',
|
|
13
8
|
AFTER_ALL: 'After All',
|
|
@@ -31,6 +26,8 @@ const STEP_ARGUMENT_LABELS = {
|
|
|
31
26
|
DATA_TABLE: ' [DataTable]'
|
|
32
27
|
};
|
|
33
28
|
function getLine(step) {
|
|
29
|
+
if (!step.uri)
|
|
30
|
+
return {};
|
|
34
31
|
return {
|
|
35
32
|
location: {
|
|
36
33
|
column: DEFAULT_VALUES.COLUMN,
|
|
@@ -70,21 +67,11 @@ function createHookResult(result) {
|
|
|
70
67
|
exception: result.error
|
|
71
68
|
};
|
|
72
69
|
}
|
|
73
|
-
function createScenarioAnnotation(testCase) {
|
|
74
|
-
const tag = [...new Set(testCase.tags.map(item => item.name))];
|
|
75
|
-
return [
|
|
76
|
-
{ type: ANNOTATION_TYPES.NAME, description: testCase.name },
|
|
77
|
-
{ type: ANNOTATION_TYPES.URI, description: testCase.uri },
|
|
78
|
-
{ type: ANNOTATION_TYPES.TAGS, description: JSON.stringify(tag) }
|
|
79
|
-
];
|
|
80
|
-
}
|
|
81
|
-
function createScenarioTags(testCase) {
|
|
82
|
-
return [...new Set(testCase.tags.map(item => item.name))];
|
|
83
|
-
}
|
|
84
70
|
function createCaseHookPayload(feature, testCase) {
|
|
85
71
|
return {
|
|
86
72
|
gherkinDocument: feature.gherkinDocument,
|
|
87
|
-
pickle: testCase
|
|
73
|
+
pickle: testCase,
|
|
74
|
+
testCaseStartedId: DEFAULT_VALUES.TEST_CASE_ID
|
|
88
75
|
};
|
|
89
76
|
}
|
|
90
77
|
async function executeCaseHooks(test, hooks, world, testCase, defaultHookName, createPayload) {
|
|
@@ -127,9 +114,6 @@ function createCaseHookParameter(feature, testCase, result) {
|
|
|
127
114
|
function findSingleStepDefinition(supportCodeLibrary, pickleStep, featureUri) {
|
|
128
115
|
const matchingSteps = supportCodeLibrary.stepDefinitions
|
|
129
116
|
.filter(stepDefinition => stepDefinition.matchesStepName(pickleStep.text));
|
|
130
|
-
if (DEBUG) {
|
|
131
|
-
console.log(`[cucumber-adapter] Matching: "${pickleStep.text}" — ${matchingSteps.length} match(es)`);
|
|
132
|
-
}
|
|
133
117
|
if (matchingSteps.length === 0) {
|
|
134
118
|
throw new Error(`Step '${pickleStep.text}' is not defined\n at ${featureUri}`);
|
|
135
119
|
}
|
|
@@ -170,8 +154,7 @@ function defineConfig(config) {
|
|
|
170
154
|
const tests = feature.tests;
|
|
171
155
|
test.describe(feature.feature, () => {
|
|
172
156
|
for (const testCase of tests) {
|
|
173
|
-
const tag =
|
|
174
|
-
const annotation = createScenarioAnnotation(testCase);
|
|
157
|
+
const { tag, annotation, lock } = (0, testDetails_1.resolveTestDetails)(testCase);
|
|
175
158
|
const testBody = async (fixtures) => {
|
|
176
159
|
const world = new supportCodeLibrary.World({
|
|
177
160
|
log,
|
|
@@ -221,7 +204,8 @@ function defineConfig(config) {
|
|
|
221
204
|
}
|
|
222
205
|
};
|
|
223
206
|
testBody.toString = () => fixture.init.toString();
|
|
224
|
-
|
|
207
|
+
const details = lock.length > 0 ? { tag, annotation, lock } : { tag, annotation };
|
|
208
|
+
test(testCase.name, details, testBody);
|
|
225
209
|
}
|
|
226
210
|
});
|
|
227
211
|
}
|
package/adapter/js/filter.js
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.tags = tags;
|
|
7
4
|
exports.filter = filter;
|
|
8
|
-
const tag_expressions_1 =
|
|
5
|
+
const tag_expressions_1 = require("@cucumber/tag-expressions");
|
|
9
6
|
class TagExpression extends RegExp {
|
|
10
7
|
tagExpression;
|
|
11
8
|
expressionNode;
|
|
12
9
|
constructor(tagExpression) {
|
|
13
10
|
super('');
|
|
14
11
|
this.tagExpression = tagExpression;
|
|
15
|
-
this.expressionNode = (0, tag_expressions_1.
|
|
12
|
+
this.expressionNode = (0, tag_expressions_1.parse)(this.tagExpression);
|
|
16
13
|
}
|
|
17
14
|
test(testName) {
|
|
18
15
|
const tokens = testName.split(/\s+/);
|
package/adapter/js/index.d.ts
CHANGED
package/adapter/js/index.js
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Pickle } from '@cucumber/messages';
|
|
2
|
+
import type { TestDetailsAnnotation } from '@playwright/test';
|
|
3
|
+
export interface ResolvedTestDetails {
|
|
4
|
+
tag: string[];
|
|
5
|
+
annotation: TestDetailsAnnotation[];
|
|
6
|
+
lock: string[];
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Translate gherkin tags of a pickle into playwright test details.
|
|
10
|
+
*
|
|
11
|
+
* - special tags below are consumed and not passed as playwright `tag`; all other tags are kept
|
|
12
|
+
* - `@lock(name)` → `lock: 'name'`; `@lock(-exclusive-)` → built-in exclusive lock
|
|
13
|
+
* - `@annotation(type,description)` → `annotation: { type, description }`
|
|
14
|
+
* - `@skip()` / `@fixme()` / `@fail()` / `@slow()` → playwright modifier with optional description, e.g. `@fixme(JIRA-1)`
|
|
15
|
+
*
|
|
16
|
+
* Note: gherkin tags may not contain whitespace, so write `@annotation(issue,JIRA-1)` without spaces.
|
|
17
|
+
*/
|
|
18
|
+
export declare function resolveTestDetails(pickle: Pickle): ResolvedTestDetails;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveTestDetails = resolveTestDetails;
|
|
4
|
+
const LOCK_TAG = /^@lock\(([^)]+)\)$/;
|
|
5
|
+
const ANNOTATION_TAG = /^@annotation\(([^,)]+)(?:,(.*))?\)$/;
|
|
6
|
+
/**
|
|
7
|
+
* Playwright applies annotations of these types as test modifiers
|
|
8
|
+
* (skip/fixme before fixtures are set up, fail/slow at test start).
|
|
9
|
+
*/
|
|
10
|
+
const MODIFIER_TAG = /^@(skip|fixme|fail|slow)\((.*)\)$/;
|
|
11
|
+
function unique(items) {
|
|
12
|
+
return [...new Set(items)];
|
|
13
|
+
}
|
|
14
|
+
function createAnnotation(type, description) {
|
|
15
|
+
const trimmed = description?.trim();
|
|
16
|
+
return trimmed ? { type, description: trimmed } : { type };
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Translate gherkin tags of a pickle into playwright test details.
|
|
20
|
+
*
|
|
21
|
+
* - special tags below are consumed and not passed as playwright `tag`; all other tags are kept
|
|
22
|
+
* - `@lock(name)` → `lock: 'name'`; `@lock(-exclusive-)` → built-in exclusive lock
|
|
23
|
+
* - `@annotation(type,description)` → `annotation: { type, description }`
|
|
24
|
+
* - `@skip()` / `@fixme()` / `@fail()` / `@slow()` → playwright modifier with optional description, e.g. `@fixme(JIRA-1)`
|
|
25
|
+
*
|
|
26
|
+
* Note: gherkin tags may not contain whitespace, so write `@annotation(issue,JIRA-1)` without spaces.
|
|
27
|
+
*/
|
|
28
|
+
function resolveTestDetails(pickle) {
|
|
29
|
+
const tag = [];
|
|
30
|
+
const extraAnnotation = [];
|
|
31
|
+
const lock = [];
|
|
32
|
+
for (const name of unique(pickle.tags.map(item => item.name))) {
|
|
33
|
+
const lockMatch = LOCK_TAG.exec(name);
|
|
34
|
+
if (lockMatch) {
|
|
35
|
+
lock.push(lockMatch[1].trim());
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
const annotationMatch = ANNOTATION_TAG.exec(name) ?? MODIFIER_TAG.exec(name);
|
|
39
|
+
if (annotationMatch) {
|
|
40
|
+
extraAnnotation.push(createAnnotation(annotationMatch[1].trim(), annotationMatch[2]));
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
tag.push(name);
|
|
44
|
+
}
|
|
45
|
+
const annotation = [
|
|
46
|
+
{ type: 'name', description: pickle.name },
|
|
47
|
+
{ type: 'uri', description: pickle.uri },
|
|
48
|
+
{ type: 'tags', description: JSON.stringify(tag) },
|
|
49
|
+
...extraAnnotation
|
|
50
|
+
];
|
|
51
|
+
return { tag, annotation, lock: unique(lock) };
|
|
52
|
+
}
|
package/adapter/js/types.d.ts
CHANGED
|
@@ -18,14 +18,14 @@ export interface WorldOptions {
|
|
|
18
18
|
config?: CucumberAdapterConfig;
|
|
19
19
|
}
|
|
20
20
|
export interface HookDefinition {
|
|
21
|
-
uri
|
|
21
|
+
uri?: string;
|
|
22
22
|
line: number;
|
|
23
23
|
name?: string;
|
|
24
24
|
code: (this: unknown, ...args: unknown[]) => Promise<void> | void;
|
|
25
25
|
appliesToTestCase(testCase: Pickle): boolean;
|
|
26
26
|
}
|
|
27
27
|
export interface StepDefinitionMatch {
|
|
28
|
-
uri
|
|
28
|
+
uri?: string;
|
|
29
29
|
line: number;
|
|
30
30
|
code: (this: unknown, ...args: unknown[]) => Promise<void> | void;
|
|
31
31
|
matchesStepName(text: string): boolean;
|
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":";;;;;AAAA,qCAAuC;AACvC,yC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CAAC;QACtE,OAAO;YACH,OAAO,EAAE,eAAe,CAAC,OAAO,EAAE,IAAI;YACtC,GAAG,EAAE,QAAQ;YACb,eAAe;YACf,KAAK,EAAE,UAAU,CAAC,IAAA,iBAAO,EAAC,eAAe,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;SAC5D,CAAA;IACL,CAAC,CAAC,CAAC;AACP,CAAC;AAED,6BAAoC,WAAqB;IACrD,oCAAyB,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,CAAC,CAAC;IACvD,oCAAyB,CAAC,OAAO,CAAC,mBAAmB,CAAC,iCAAe,CAAC,CAAC;IACvE,MAAM,KAAK,GAAG,IAAA,eAAQ,EAAC,WAAW,CAAC,CAAC;IACpC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACvB,MAAM,QAAQ,GAAG,IAAA,mBAAO,EAAC,IAAI,CAAC,CAAC;QAC/B,OAAO,CAAC,QAAQ,CAAC,CAAC;IACtB,CAAC;IACD,OAAO,oCAAyB,CAAC,QAAQ,EAAmC,CAAC;AACjF,CAAC;AAED,cAAqB,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,18 @@
|
|
|
1
|
+
import type { Pickle } from '@cucumber/messages';
|
|
2
|
+
import type { TestDetailsAnnotation } from '@playwright/test';
|
|
3
|
+
export interface ResolvedTestDetails {
|
|
4
|
+
tag: string[];
|
|
5
|
+
annotation: TestDetailsAnnotation[];
|
|
6
|
+
lock: string[];
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Translate gherkin tags of a pickle into playwright test details.
|
|
10
|
+
*
|
|
11
|
+
* - special tags below are consumed and not passed as playwright `tag`; all other tags are kept
|
|
12
|
+
* - `@lock(name)` → `lock: 'name'`; `@lock(-exclusive-)` → built-in exclusive lock
|
|
13
|
+
* - `@annotation(type,description)` → `annotation: { type, description }`
|
|
14
|
+
* - `@skip()` / `@fixme()` / `@fail()` / `@slow()` → playwright modifier with optional description, e.g. `@fixme(JIRA-1)`
|
|
15
|
+
*
|
|
16
|
+
* Note: gherkin tags may not contain whitespace, so write `@annotation(issue,JIRA-1)` without spaces.
|
|
17
|
+
*/
|
|
18
|
+
export declare function resolveTestDetails(pickle: Pickle): ResolvedTestDetails;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveTestDetails = resolveTestDetails;
|
|
4
|
+
const LOCK_TAG = /^@lock\(([^)]+)\)$/;
|
|
5
|
+
const ANNOTATION_TAG = /^@annotation\(([^,)]+)(?:,(.*))?\)$/;
|
|
6
|
+
/**
|
|
7
|
+
* Playwright applies annotations of these types as test modifiers
|
|
8
|
+
* (skip/fixme before fixtures are set up, fail/slow at test start).
|
|
9
|
+
*/
|
|
10
|
+
const MODIFIER_TAG = /^@(skip|fixme|fail|slow)\((.*)\)$/;
|
|
11
|
+
function unique(items) {
|
|
12
|
+
return [...new Set(items)];
|
|
13
|
+
}
|
|
14
|
+
function createAnnotation(type, description) {
|
|
15
|
+
const trimmed = description?.trim();
|
|
16
|
+
return trimmed ? { type, description: trimmed } : { type };
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Translate gherkin tags of a pickle into playwright test details.
|
|
20
|
+
*
|
|
21
|
+
* - special tags below are consumed and not passed as playwright `tag`; all other tags are kept
|
|
22
|
+
* - `@lock(name)` → `lock: 'name'`; `@lock(-exclusive-)` → built-in exclusive lock
|
|
23
|
+
* - `@annotation(type,description)` → `annotation: { type, description }`
|
|
24
|
+
* - `@skip()` / `@fixme()` / `@fail()` / `@slow()` → playwright modifier with optional description, e.g. `@fixme(JIRA-1)`
|
|
25
|
+
*
|
|
26
|
+
* Note: gherkin tags may not contain whitespace, so write `@annotation(issue,JIRA-1)` without spaces.
|
|
27
|
+
*/
|
|
28
|
+
function resolveTestDetails(pickle) {
|
|
29
|
+
const tag = [];
|
|
30
|
+
const extraAnnotation = [];
|
|
31
|
+
const lock = [];
|
|
32
|
+
for (const name of unique(pickle.tags.map(item => item.name))) {
|
|
33
|
+
const lockMatch = LOCK_TAG.exec(name);
|
|
34
|
+
if (lockMatch) {
|
|
35
|
+
lock.push(lockMatch[1].trim());
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
const annotationMatch = ANNOTATION_TAG.exec(name) ?? MODIFIER_TAG.exec(name);
|
|
39
|
+
if (annotationMatch) {
|
|
40
|
+
extraAnnotation.push(createAnnotation(annotationMatch[1].trim(), annotationMatch[2]));
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
tag.push(name);
|
|
44
|
+
}
|
|
45
|
+
const annotation = [
|
|
46
|
+
{ type: 'name', description: pickle.name },
|
|
47
|
+
{ type: 'uri', description: pickle.uri },
|
|
48
|
+
{ type: 'tags', description: JSON.stringify(tag) },
|
|
49
|
+
...extraAnnotation
|
|
50
|
+
];
|
|
51
|
+
return { tag, annotation, lock: unique(lock) };
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=testDetails.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testDetails.js","sourceRoot":"","sources":["../src/testDetails.ts"],"names":[],"mappings":";;;AASA,MAAM,QAAQ,GAAG,oBAAoB,CAAC;AACtC,MAAM,cAAc,GAAG,qCAAqC,CAAC;AAC7D;;;GAGG;AACH,MAAM,YAAY,GAAG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GAA4B;QACxC,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,CAAC,IAAI,EAAE;QAC1C,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,CAAC,GAAG,EAAE;QACxC,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE;QAClD,GAAG,eAAe;KACrB,CAAC;IAEF,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;AACnD,CAAC"}
|
package/adapter/types.d.ts
CHANGED
|
@@ -18,14 +18,14 @@ export interface WorldOptions {
|
|
|
18
18
|
config?: CucumberAdapterConfig;
|
|
19
19
|
}
|
|
20
20
|
export interface HookDefinition {
|
|
21
|
-
uri
|
|
21
|
+
uri?: string;
|
|
22
22
|
line: number;
|
|
23
23
|
name?: string;
|
|
24
24
|
code: (this: unknown, ...args: unknown[]) => Promise<void> | void;
|
|
25
25
|
appliesToTestCase(testCase: Pickle): boolean;
|
|
26
26
|
}
|
|
27
27
|
export interface StepDefinitionMatch {
|
|
28
|
-
uri
|
|
28
|
+
uri?: string;
|
|
29
29
|
line: number;
|
|
30
30
|
code: (this: unknown, ...args: unknown[]) => Promise<void> | void;
|
|
31
31
|
matchesStepName(text: string): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qavajs/playwright-runner-adapter",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "adapter for playwright test runner",
|
|
5
5
|
"main": "adapter/index.js",
|
|
6
6
|
"types": "adapter/index.d.ts",
|
|
@@ -40,15 +40,16 @@
|
|
|
40
40
|
"url": "https://github.com/qavajs/playwright-runner-adapter/issues"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@cucumber/
|
|
44
|
-
"@cucumber/
|
|
45
|
-
"
|
|
46
|
-
"
|
|
43
|
+
"@cucumber/cucumber": "^13.3.0",
|
|
44
|
+
"@cucumber/gherkin": "^42.0.1",
|
|
45
|
+
"@cucumber/tag-expressions": "^11.0.1",
|
|
46
|
+
"glob": "^14.0.4"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@playwright/test": "^1.
|
|
50
|
-
"@
|
|
51
|
-
"
|
|
49
|
+
"@playwright/test": "^1.65.0",
|
|
50
|
+
"@qavajs/playwright-console-reporter": "^0.1.0",
|
|
51
|
+
"@types/node": "^26.6.6",
|
|
52
|
+
"typescript": "^7.0.2"
|
|
52
53
|
},
|
|
53
54
|
"keywords": [
|
|
54
55
|
"test",
|