@qavajs/playwright-runner-adapter 0.5.0 → 0.6.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 +6 -0
- package/adapter/adapter.spec.js +16 -6
- package/adapter/adapter.spec.js.map +1 -1
- package/package.json +5 -5
- package/src/adapter.spec.ts +17 -7
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,12 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
|
|
|
10
10
|
:pencil: - chore
|
|
11
11
|
:microscope: - experimental
|
|
12
12
|
|
|
13
|
+
## [0.6.1]
|
|
14
|
+
- :beetle: make params in hooks closer to cucumber types
|
|
15
|
+
|
|
16
|
+
## [0.6.0]
|
|
17
|
+
- :rocket: added test case accessor to BeforeStep/AfterStep hooks
|
|
18
|
+
|
|
13
19
|
## [0.5.0]
|
|
14
20
|
- :rocket: updated gherkin dependency
|
|
15
21
|
- :rocket: added _expect_ to default world
|
package/adapter/adapter.spec.js
CHANGED
|
@@ -29,10 +29,13 @@ for (const feature of features) {
|
|
|
29
29
|
for (const testCase of tests) {
|
|
30
30
|
const tag = testCase.tags.map((tag) => tag.name);
|
|
31
31
|
test(testCase.name, { tag }, async () => {
|
|
32
|
+
const result = { status: 'passed' };
|
|
32
33
|
for (const beforeHook of supportCodeLibrary.beforeTestCaseHookDefinitions) {
|
|
33
34
|
if (beforeHook.appliesToTestCase(testCase)) {
|
|
34
35
|
await test.step('Before', async () => {
|
|
35
|
-
await beforeHook.code.apply(world, [
|
|
36
|
+
await beforeHook.code.apply(world, [{
|
|
37
|
+
pickle: testCase
|
|
38
|
+
}]);
|
|
36
39
|
});
|
|
37
40
|
}
|
|
38
41
|
}
|
|
@@ -40,7 +43,10 @@ for (const feature of features) {
|
|
|
40
43
|
await test.step(pickleStep.text, async () => {
|
|
41
44
|
for (const beforeStep of supportCodeLibrary.beforeTestStepHookDefinitions) {
|
|
42
45
|
if (beforeStep.appliesToTestCase(testCase)) {
|
|
43
|
-
await beforeStep.code.apply(world
|
|
46
|
+
await beforeStep.code.apply(world, [{
|
|
47
|
+
pickle: testCase,
|
|
48
|
+
pickleStep
|
|
49
|
+
}]);
|
|
44
50
|
}
|
|
45
51
|
}
|
|
46
52
|
const steps = supportCodeLibrary.stepDefinitions
|
|
@@ -51,14 +57,12 @@ for (const feature of features) {
|
|
|
51
57
|
throw new Error(`'${pickleStep.text}' matches multiple step definitions`);
|
|
52
58
|
const [step] = steps;
|
|
53
59
|
const { parameters } = await step.getInvocationParameters({
|
|
54
|
-
// @ts-ignore
|
|
55
60
|
step: {
|
|
56
61
|
text: pickleStep.text,
|
|
57
62
|
argument: pickleStep.argument
|
|
58
63
|
},
|
|
59
64
|
world
|
|
60
65
|
});
|
|
61
|
-
const result = { status: 'passed' };
|
|
62
66
|
try {
|
|
63
67
|
await step.code.apply(world, parameters);
|
|
64
68
|
}
|
|
@@ -68,7 +72,11 @@ for (const feature of features) {
|
|
|
68
72
|
}
|
|
69
73
|
for (const afterStep of supportCodeLibrary.afterTestStepHookDefinitions) {
|
|
70
74
|
if (afterStep.appliesToTestCase(testCase)) {
|
|
71
|
-
await afterStep.code.apply(world, [{
|
|
75
|
+
await afterStep.code.apply(world, [{
|
|
76
|
+
pickle: testCase,
|
|
77
|
+
pickleStep,
|
|
78
|
+
result
|
|
79
|
+
}]);
|
|
72
80
|
}
|
|
73
81
|
}
|
|
74
82
|
if (result.error)
|
|
@@ -78,7 +86,9 @@ for (const feature of features) {
|
|
|
78
86
|
for (const afterHook of supportCodeLibrary.afterTestCaseHookDefinitions) {
|
|
79
87
|
if (afterHook.appliesToTestCase(testCase)) {
|
|
80
88
|
await test.step('After', async () => {
|
|
81
|
-
await afterHook.code.apply(world, [
|
|
89
|
+
await afterHook.code.apply(world, [{
|
|
90
|
+
pickle: testCase, result
|
|
91
|
+
}]);
|
|
82
92
|
});
|
|
83
93
|
}
|
|
84
94
|
}
|
|
@@ -1 +1 @@
|
|
|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"@qavajs/playwright-runner-adapter",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "adapter for playwright test runner",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc",
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
"glob": "^11.0.0"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"@cucumber/cucumber": "^11.0.
|
|
18
|
-
"@playwright/test": "^1.
|
|
19
|
-
"@types/node": "^22.
|
|
20
|
-
"typescript": "^5.
|
|
17
|
+
"@cucumber/cucumber": "^11.0.1",
|
|
18
|
+
"@playwright/test": "^1.48.1",
|
|
19
|
+
"@types/node": "^22.7.7",
|
|
20
|
+
"typescript": "^5.6.3"
|
|
21
21
|
}
|
|
22
22
|
}
|
package/src/adapter.spec.ts
CHANGED
|
@@ -34,10 +34,13 @@ for (const feature of features) {
|
|
|
34
34
|
for (const testCase of tests) {
|
|
35
35
|
const tag = testCase.tags.map((tag: { name: string }) => tag.name);
|
|
36
36
|
test(testCase.name, { tag }, async () => {
|
|
37
|
+
const result: { status: string, error?: any } = { status: 'passed' };
|
|
37
38
|
for (const beforeHook of supportCodeLibrary.beforeTestCaseHookDefinitions) {
|
|
38
39
|
if (beforeHook.appliesToTestCase(testCase)) {
|
|
39
40
|
await test.step('Before', async () => {
|
|
40
|
-
await beforeHook.code.apply(world, [
|
|
41
|
+
await beforeHook.code.apply(world, [{
|
|
42
|
+
pickle: testCase
|
|
43
|
+
}]);
|
|
41
44
|
});
|
|
42
45
|
}
|
|
43
46
|
}
|
|
@@ -45,7 +48,10 @@ for (const feature of features) {
|
|
|
45
48
|
await test.step(pickleStep.text, async () => {
|
|
46
49
|
for (const beforeStep of supportCodeLibrary.beforeTestStepHookDefinitions) {
|
|
47
50
|
if (beforeStep.appliesToTestCase(testCase)) {
|
|
48
|
-
await beforeStep.code.apply(world
|
|
51
|
+
await beforeStep.code.apply(world, [{
|
|
52
|
+
pickle: testCase,
|
|
53
|
+
pickleStep
|
|
54
|
+
}]);
|
|
49
55
|
}
|
|
50
56
|
}
|
|
51
57
|
const steps = supportCodeLibrary.stepDefinitions
|
|
@@ -54,14 +60,12 @@ for (const feature of features) {
|
|
|
54
60
|
if (steps.length > 1) throw new Error(`'${pickleStep.text}' matches multiple step definitions`);
|
|
55
61
|
const [step] = steps;
|
|
56
62
|
const { parameters} = await step.getInvocationParameters({
|
|
57
|
-
// @ts-ignore
|
|
58
63
|
step: {
|
|
59
64
|
text: pickleStep.text,
|
|
60
65
|
argument: pickleStep.argument
|
|
61
66
|
},
|
|
62
67
|
world
|
|
63
|
-
});
|
|
64
|
-
const result: { status: string, error?: any } = { status: 'passed' };
|
|
68
|
+
} as any);
|
|
65
69
|
try {
|
|
66
70
|
await step.code.apply(world, parameters);
|
|
67
71
|
} catch (err) {
|
|
@@ -70,7 +74,11 @@ for (const feature of features) {
|
|
|
70
74
|
}
|
|
71
75
|
for (const afterStep of supportCodeLibrary.afterTestStepHookDefinitions) {
|
|
72
76
|
if (afterStep.appliesToTestCase(testCase)) {
|
|
73
|
-
await afterStep.code.apply(world, [{
|
|
77
|
+
await afterStep.code.apply(world, [{
|
|
78
|
+
pickle: testCase,
|
|
79
|
+
pickleStep,
|
|
80
|
+
result
|
|
81
|
+
}]);
|
|
74
82
|
}
|
|
75
83
|
}
|
|
76
84
|
if (result.error) throw result.error;
|
|
@@ -79,7 +87,9 @@ for (const feature of features) {
|
|
|
79
87
|
for (const afterHook of supportCodeLibrary.afterTestCaseHookDefinitions) {
|
|
80
88
|
if (afterHook.appliesToTestCase(testCase)) {
|
|
81
89
|
await test.step('After', async () => {
|
|
82
|
-
await afterHook.code.apply(world, [
|
|
90
|
+
await afterHook.code.apply(world, [{
|
|
91
|
+
pickle: testCase, result
|
|
92
|
+
}]);
|
|
83
93
|
});
|
|
84
94
|
}
|
|
85
95
|
}
|