@qavajs/playwright-runner-adapter 1.0.1 → 1.1.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 +4 -0
- package/adapter/cucumber.spec.js +16 -24
- package/adapter/cucumber.spec.js.map +1 -1
- package/package.json +2 -2
- package/src/cucumber.spec.ts +19 -26
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,10 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
|
|
|
10
10
|
:pencil: - chore
|
|
11
11
|
:microscope: - experimental
|
|
12
12
|
|
|
13
|
+
## [1.1.0]
|
|
14
|
+
- :rocket: improved BeforeStep/AfterStep logging
|
|
15
|
+
- :beetle: fixed BeforeAll/AfterAll behavior
|
|
16
|
+
|
|
13
17
|
## [1.0.1]
|
|
14
18
|
- :pencil: updated dependencies
|
|
15
19
|
- :rocket: renamed adapter spec to cucumber.spec.ts
|
package/adapter/cucumber.spec.js
CHANGED
|
@@ -13,14 +13,12 @@ function attach(body, details) {
|
|
|
13
13
|
}
|
|
14
14
|
const fixture = new supportCodeLibrary.World({});
|
|
15
15
|
const test = fixture.test;
|
|
16
|
+
for (const beforeAllHook of supportCodeLibrary.beforeTestRunHookDefinitions) {
|
|
17
|
+
test.beforeAll(() => beforeAllHook.code.apply({}));
|
|
18
|
+
}
|
|
16
19
|
for (const feature of features) {
|
|
17
20
|
const tests = feature.tests;
|
|
18
21
|
test.describe(feature.feature, async () => {
|
|
19
|
-
for (const beforeAllHook of supportCodeLibrary.beforeTestRunHookDefinitions) {
|
|
20
|
-
test.beforeAll(async () => {
|
|
21
|
-
await beforeAllHook.code.apply({});
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
22
|
const world = new supportCodeLibrary.World({
|
|
25
23
|
log,
|
|
26
24
|
attach,
|
|
@@ -35,21 +33,19 @@ for (const feature of features) {
|
|
|
35
33
|
for (const beforeHook of supportCodeLibrary.beforeTestCaseHookDefinitions) {
|
|
36
34
|
if (beforeHook.appliesToTestCase(testCase)) {
|
|
37
35
|
const hookName = (_a = beforeHook.name) !== null && _a !== void 0 ? _a : 'Before';
|
|
38
|
-
await test.step(hookName,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}]);
|
|
42
|
-
});
|
|
36
|
+
await test.step(hookName, () => beforeHook.code.apply(world, [{
|
|
37
|
+
pickle: testCase
|
|
38
|
+
}]));
|
|
43
39
|
}
|
|
44
40
|
}
|
|
45
41
|
for (const pickleStep of testCase.steps) {
|
|
46
42
|
await test.step(pickleStep.text, async () => {
|
|
47
43
|
for (const beforeStep of supportCodeLibrary.beforeTestStepHookDefinitions) {
|
|
48
44
|
if (beforeStep.appliesToTestCase(testCase)) {
|
|
49
|
-
await beforeStep.code.apply(world, [{
|
|
45
|
+
await test.step('Before Step', () => beforeStep.code.apply(world, [{
|
|
50
46
|
pickle: testCase,
|
|
51
47
|
pickleStep
|
|
52
|
-
}]);
|
|
48
|
+
}]));
|
|
53
49
|
}
|
|
54
50
|
}
|
|
55
51
|
const steps = supportCodeLibrary.stepDefinitions
|
|
@@ -75,11 +71,11 @@ for (const feature of features) {
|
|
|
75
71
|
}
|
|
76
72
|
for (const afterStep of supportCodeLibrary.afterTestStepHookDefinitions) {
|
|
77
73
|
if (afterStep.appliesToTestCase(testCase)) {
|
|
78
|
-
await afterStep.code.apply(world, [{
|
|
74
|
+
await test.step('After Step', () => afterStep.code.apply(world, [{
|
|
79
75
|
pickle: testCase,
|
|
80
76
|
pickleStep,
|
|
81
77
|
result
|
|
82
|
-
}]);
|
|
78
|
+
}]));
|
|
83
79
|
}
|
|
84
80
|
}
|
|
85
81
|
if (result.error)
|
|
@@ -89,20 +85,16 @@ for (const feature of features) {
|
|
|
89
85
|
for (const afterHook of supportCodeLibrary.afterTestCaseHookDefinitions) {
|
|
90
86
|
if (afterHook.appliesToTestCase(testCase)) {
|
|
91
87
|
const hookName = (_b = afterHook.name) !== null && _b !== void 0 ? _b : 'After';
|
|
92
|
-
await test.step(hookName,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}]);
|
|
96
|
-
});
|
|
88
|
+
await test.step(hookName, () => afterHook.code.apply(world, [{
|
|
89
|
+
pickle: testCase, result
|
|
90
|
+
}]));
|
|
97
91
|
}
|
|
98
92
|
}
|
|
99
93
|
});
|
|
100
94
|
}
|
|
101
|
-
for (const afterAllHook of supportCodeLibrary.afterTestRunHookDefinitions) {
|
|
102
|
-
test.afterAll(async function () {
|
|
103
|
-
await afterAllHook.code.apply({});
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
95
|
});
|
|
107
96
|
}
|
|
97
|
+
for (const afterAllHook of supportCodeLibrary.afterTestRunHookDefinitions) {
|
|
98
|
+
test.afterAll(() => afterAllHook.code.apply({}));
|
|
99
|
+
}
|
|
108
100
|
//# sourceMappingURL=cucumber.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cucumber.spec.js","sourceRoot":"","sources":["../src/cucumber.spec.ts"],"names":[],"mappings":";;AAAA,qCAAgC;AAEhC,MAAM,EAAE,QAAQ,EAAE,kBAAkB,EAAE,GAAG,IAAA,aAAI,GAAE,CAAC;AAEhD,SAAS,GAAG,CAAC,IAAS;IAClB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACtB,CAAC;AAED,SAAS,MAAM,CAAsB,IAAS,EAAE,OAAY;;IACxD,MAAM,QAAQ,GAAG,MAAA,OAAO,CAAC,QAAQ,mCAAI,YAAY,CAAC;IAClD,MAAM,WAAW,GAAG,MAAA,OAAO,CAAC,SAAS,mCAAI,YAAY,CAAC;IACtD,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC;AAC7D,CAAC;AAED,MAAM,OAAO,GAAG,IAAI,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AACjD,MAAM,IAAI,GAAG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CAAC,CAAC,CAAC;4BACT,CAAC;wBACL,CAAC;wBACD,IAAI,MAAM,CAAC,KAAK;4BAAE,MAAM,MAAM,CAAC,KAAK,CAAC;oBACzC,CAAC,CAAC,CAAC;gBACP,CAAC;gBACD,KAAK,MAAM,SAAS,IAAI,kBAAkB,CAAC,4BAA4B,EAAE,CAAC;oBACtE,IAAI,SAAS,CAAC,iBAAiB,CAAC,QAAQ,CAAC,EAAE,CAAC;wBACxC,MAAM,QAAQ,GAAG,MAAA,SAAS,CAAC,IAAI,mCAAI,OAAO,CAAC;wBAC3C,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;gCACzD,MAAM,EAAE,QAAQ,EAAE,MAAM;6BAC3B,CAAC,CAAC,CAAC,CAAC;oBACT,CAAC;gBACL,CAAC;YACL,CAAC,CAAC,CAAA;QACN,CAAC;IACL,CAAC,CAAC,CAAC;AACP,CAAC;AAED,KAAK,MAAM,YAAY,IAAI,kBAAkB,CAAC,2BAA2B,EAAE,CAAC;IACxE,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;AACrD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qavajs/playwright-runner-adapter",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "adapter for playwright test runner",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@cucumber/cucumber": "^11.1.1",
|
|
18
18
|
"@playwright/test": "^1.49.1",
|
|
19
|
-
"@types/node": "^22.10.
|
|
19
|
+
"@types/node": "^22.10.5",
|
|
20
20
|
"typescript": "^5.7.2"
|
|
21
21
|
}
|
|
22
22
|
}
|
package/src/cucumber.spec.ts
CHANGED
|
@@ -15,15 +15,13 @@ function attach(this: { test: any }, body: any, details: any) {
|
|
|
15
15
|
const fixture = new supportCodeLibrary.World({});
|
|
16
16
|
const test = fixture.test;
|
|
17
17
|
|
|
18
|
+
for (const beforeAllHook of supportCodeLibrary.beforeTestRunHookDefinitions) {
|
|
19
|
+
test.beforeAll(() => beforeAllHook.code.apply({}));
|
|
20
|
+
}
|
|
21
|
+
|
|
18
22
|
for (const feature of features) {
|
|
19
23
|
const tests = feature.tests;
|
|
20
24
|
test.describe(feature.feature as string, async () => {
|
|
21
|
-
for (const beforeAllHook of supportCodeLibrary.beforeTestRunHookDefinitions) {
|
|
22
|
-
test.beforeAll(async () => {
|
|
23
|
-
await beforeAllHook.code.apply({});
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
|
|
27
25
|
const world = new supportCodeLibrary.World({
|
|
28
26
|
log,
|
|
29
27
|
attach,
|
|
@@ -39,28 +37,26 @@ for (const feature of features) {
|
|
|
39
37
|
for (const beforeHook of supportCodeLibrary.beforeTestCaseHookDefinitions) {
|
|
40
38
|
if (beforeHook.appliesToTestCase(testCase)) {
|
|
41
39
|
const hookName = beforeHook.name ?? 'Before';
|
|
42
|
-
await test.step(hookName,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}]);
|
|
46
|
-
});
|
|
40
|
+
await test.step(hookName, () => beforeHook.code.apply(world, [{
|
|
41
|
+
pickle: testCase
|
|
42
|
+
}]));
|
|
47
43
|
}
|
|
48
44
|
}
|
|
49
45
|
for (const pickleStep of testCase.steps) {
|
|
50
46
|
await test.step(pickleStep.text, async () => {
|
|
51
47
|
for (const beforeStep of supportCodeLibrary.beforeTestStepHookDefinitions) {
|
|
52
48
|
if (beforeStep.appliesToTestCase(testCase)) {
|
|
53
|
-
await beforeStep.code.apply(world, [{
|
|
49
|
+
await test.step('Before Step', () => beforeStep.code.apply(world, [{
|
|
54
50
|
pickle: testCase,
|
|
55
51
|
pickleStep
|
|
56
|
-
}]);
|
|
52
|
+
}]));
|
|
57
53
|
}
|
|
58
54
|
}
|
|
59
55
|
const steps = supportCodeLibrary.stepDefinitions
|
|
60
56
|
.filter(stepDefinition => stepDefinition.matchesStepName(pickleStep.text));
|
|
61
57
|
if (steps.length === 0) throw new Error(`Step '${pickleStep.text}' is not defined`);
|
|
62
58
|
if (steps.length > 1) throw new Error(`'${pickleStep.text}' matches multiple step definitions`);
|
|
63
|
-
const [step] = steps;
|
|
59
|
+
const [ step ] = steps;
|
|
64
60
|
const { parameters} = await step.getInvocationParameters({
|
|
65
61
|
step: {
|
|
66
62
|
text: pickleStep.text,
|
|
@@ -76,11 +72,11 @@ for (const feature of features) {
|
|
|
76
72
|
}
|
|
77
73
|
for (const afterStep of supportCodeLibrary.afterTestStepHookDefinitions) {
|
|
78
74
|
if (afterStep.appliesToTestCase(testCase)) {
|
|
79
|
-
await afterStep.code.apply(world, [{
|
|
75
|
+
await test.step('After Step', () => afterStep.code.apply(world, [{
|
|
80
76
|
pickle: testCase,
|
|
81
77
|
pickleStep,
|
|
82
78
|
result
|
|
83
|
-
}]);
|
|
79
|
+
}]));
|
|
84
80
|
}
|
|
85
81
|
}
|
|
86
82
|
if (result.error) throw result.error;
|
|
@@ -89,19 +85,16 @@ for (const feature of features) {
|
|
|
89
85
|
for (const afterHook of supportCodeLibrary.afterTestCaseHookDefinitions) {
|
|
90
86
|
if (afterHook.appliesToTestCase(testCase)) {
|
|
91
87
|
const hookName = afterHook.name ?? 'After';
|
|
92
|
-
await test.step(hookName,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}]);
|
|
96
|
-
});
|
|
88
|
+
await test.step(hookName, () => afterHook.code.apply(world, [{
|
|
89
|
+
pickle: testCase, result
|
|
90
|
+
}]));
|
|
97
91
|
}
|
|
98
92
|
}
|
|
99
93
|
})
|
|
100
94
|
}
|
|
101
|
-
for (const afterAllHook of supportCodeLibrary.afterTestRunHookDefinitions) {
|
|
102
|
-
test.afterAll(async function () {
|
|
103
|
-
await afterAllHook.code.apply({});
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
95
|
});
|
|
107
96
|
}
|
|
97
|
+
|
|
98
|
+
for (const afterAllHook of supportCodeLibrary.afterTestRunHookDefinitions) {
|
|
99
|
+
test.afterAll(() => afterAllHook.code.apply({}));
|
|
100
|
+
}
|