@qavajs/playwright-runner-adapter 1.7.0 → 1.7.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 +3 -0
- package/adapter/cucumber.spec.js +32 -13
- package/adapter/cucumber.spec.js.map +1 -1
- package/package.json +1 -1
- package/src/cucumber.spec.ts +35 -13
package/CHANGELOG.md
CHANGED
|
@@ -14,6 +14,9 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
|
|
|
14
14
|
|
|
15
15
|
:microscope: - experimental
|
|
16
16
|
|
|
17
|
+
## [1.7.1]
|
|
18
|
+
- :beetle: fixed `result` property in `After` and `AfterStep` hooks
|
|
19
|
+
|
|
17
20
|
## [1.7.0]
|
|
18
21
|
- :rocket: added `filter` grep utility function
|
|
19
22
|
```typescript
|
package/adapter/cucumber.spec.js
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const loader_1 = require("./loader");
|
|
4
4
|
const { features, supportCodeLibrary } = (0, loader_1.load)();
|
|
5
|
+
function getResult(testInfo) {
|
|
6
|
+
const message = testInfo.errors.length > 0
|
|
7
|
+
? testInfo.errors.map((err) => err.message).join('\n')
|
|
8
|
+
: undefined;
|
|
9
|
+
return {
|
|
10
|
+
duration: testInfo.duration,
|
|
11
|
+
message,
|
|
12
|
+
status: testInfo.status,
|
|
13
|
+
exception: testInfo.error
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function getLine(step) {
|
|
17
|
+
return { location: { column: 1, file: step.uri, line: step.line } };
|
|
18
|
+
}
|
|
5
19
|
function log(data) {
|
|
6
20
|
console.log(data);
|
|
7
21
|
}
|
|
@@ -14,7 +28,7 @@ const fixture = new supportCodeLibrary.World({});
|
|
|
14
28
|
const test = fixture.test;
|
|
15
29
|
test.beforeAll(async () => {
|
|
16
30
|
for (const beforeAllHook of supportCodeLibrary.beforeTestRunHookDefinitions) {
|
|
17
|
-
const location =
|
|
31
|
+
const location = getLine(beforeAllHook);
|
|
18
32
|
await test.step('Before All', () => beforeAllHook.code.apply({}), location);
|
|
19
33
|
}
|
|
20
34
|
});
|
|
@@ -37,7 +51,7 @@ for (const feature of features) {
|
|
|
37
51
|
for (const beforeHook of supportCodeLibrary.beforeTestCaseHookDefinitions) {
|
|
38
52
|
if (beforeHook.appliesToTestCase(testCase)) {
|
|
39
53
|
const hookName = beforeHook.name ?? 'Before';
|
|
40
|
-
const location =
|
|
54
|
+
const location = getLine(beforeHook);
|
|
41
55
|
await test.step(hookName, () => beforeHook.code.apply(world, [{
|
|
42
56
|
pickle: testCase
|
|
43
57
|
}]), location);
|
|
@@ -53,10 +67,9 @@ for (const feature of features) {
|
|
|
53
67
|
{ type: 'tags', description: JSON.stringify(tag) }
|
|
54
68
|
];
|
|
55
69
|
test(testCase.name, { tag, annotation }, async () => {
|
|
56
|
-
const
|
|
57
|
-
testInfo.result = { status: 'passed' };
|
|
70
|
+
const result = { status: 'passed' };
|
|
58
71
|
for (const pickleStep of testCase.steps) {
|
|
59
|
-
if (
|
|
72
|
+
if (result.status !== 'passed') {
|
|
60
73
|
break;
|
|
61
74
|
}
|
|
62
75
|
const steps = supportCodeLibrary.stepDefinitions
|
|
@@ -66,11 +79,11 @@ for (const feature of features) {
|
|
|
66
79
|
if (steps.length > 1)
|
|
67
80
|
throw new Error(`Step '${pickleStep.text}' matches multiple step definitions`);
|
|
68
81
|
const [step] = steps;
|
|
69
|
-
const location =
|
|
82
|
+
const location = getLine(step);
|
|
70
83
|
await test.step(pickleStep.text, async () => {
|
|
71
84
|
for (const beforeStep of supportCodeLibrary.beforeTestStepHookDefinitions) {
|
|
72
85
|
if (beforeStep.appliesToTestCase(testCase)) {
|
|
73
|
-
const location =
|
|
86
|
+
const location = getLine(beforeStep);
|
|
74
87
|
await test.step('Before Step', () => beforeStep.code.apply(world, [{
|
|
75
88
|
pickle: testCase,
|
|
76
89
|
pickleStep
|
|
@@ -88,17 +101,23 @@ for (const feature of features) {
|
|
|
88
101
|
await step.code.apply(world, parameters);
|
|
89
102
|
}
|
|
90
103
|
catch (err) {
|
|
91
|
-
|
|
104
|
+
result.status = 'failed';
|
|
105
|
+
result.error = err;
|
|
92
106
|
throw err;
|
|
93
107
|
}
|
|
94
108
|
finally {
|
|
95
109
|
for (const afterStep of supportCodeLibrary.afterTestStepHookDefinitions) {
|
|
96
110
|
if (afterStep.appliesToTestCase(testCase)) {
|
|
97
|
-
const location =
|
|
111
|
+
const location = getLine(afterStep);
|
|
98
112
|
await test.step('After Step', () => afterStep.code.apply(world, [{
|
|
99
113
|
pickle: testCase,
|
|
100
114
|
pickleStep,
|
|
101
|
-
result:
|
|
115
|
+
result: {
|
|
116
|
+
duration: 0,
|
|
117
|
+
message: result.error?.message,
|
|
118
|
+
status: result.status,
|
|
119
|
+
exception: result.error
|
|
120
|
+
}
|
|
102
121
|
}]), location);
|
|
103
122
|
}
|
|
104
123
|
}
|
|
@@ -117,10 +136,10 @@ for (const feature of features) {
|
|
|
117
136
|
for (const afterHook of supportCodeLibrary.afterTestCaseHookDefinitions) {
|
|
118
137
|
if (afterHook.appliesToTestCase(testCase)) {
|
|
119
138
|
const hookName = afterHook.name ?? 'After';
|
|
120
|
-
const location =
|
|
139
|
+
const location = getLine(afterHook);
|
|
121
140
|
await test.step(hookName, () => afterHook.code.apply(world, [{
|
|
122
141
|
pickle: testCase,
|
|
123
|
-
result: testInfo
|
|
142
|
+
result: getResult(testInfo)
|
|
124
143
|
}]), location);
|
|
125
144
|
}
|
|
126
145
|
}
|
|
@@ -129,7 +148,7 @@ for (const feature of features) {
|
|
|
129
148
|
}
|
|
130
149
|
test.afterAll(async () => {
|
|
131
150
|
for (const afterAllHook of supportCodeLibrary.afterTestRunHookDefinitions) {
|
|
132
|
-
const location =
|
|
151
|
+
const location = getLine(afterAllHook);
|
|
133
152
|
await test.step('After All', () => afterAllHook.code.apply({}), location);
|
|
134
153
|
}
|
|
135
154
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cucumber.spec.js","sourceRoot":"","sources":["../src/cucumber.spec.ts"],"names":[],"mappings":";;AAAA,qCAAgC;
|
|
1
|
+
{"version":3,"file":"cucumber.spec.js","sourceRoot":"","sources":["../src/cucumber.spec.ts"],"names":[],"mappings":";;AAAA,qCAAgC;AAGhC,MAAM,EAAE,QAAQ,EAAE,kBAAkB,EAAE,GAAG,IAAA,aAAI,GAAE,CAAC;AAEhD,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,QAAQ;QAC3B,OAAO;QACP,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,SAAS,EAAE,QAAQ,CAAC,KAAK;KAC5B,CAAC;AACN,CAAC;AAED,SAAS,OAAO,CAAC,IAAmC;IAChD,OAAO,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,EAAC,CAAA;AACtE,CAAC;AAED,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,OAAO,EAAE,QAAQ,IAAI,YAAY,CAAC;IACnD,MAAM,WAAW,GAAG,OAAO,EAAE,SAAS,IAAI,YAAY,CAAC;IACvD,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,MAA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'@playwright/test';
|
|
2
3
|
|
|
3
4
|
const { features, supportCodeLibrary } = load();
|
|
4
5
|
|
|
6
|
+
function getResult(testInfo: TestInfo) {
|
|
7
|
+
const message = testInfo.errors.length > 0
|
|
8
|
+
? testInfo.errors.map((err: any) => err.message).join('\n')
|
|
9
|
+
: undefined;
|
|
10
|
+
return {
|
|
11
|
+
duration: testInfo.duration,
|
|
12
|
+
message,
|
|
13
|
+
status: testInfo.status,
|
|
14
|
+
exception: testInfo.error
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function getLine(step: { uri: string, line: number }) {
|
|
19
|
+
return { location: { column: 1, file: step.uri, line: step.line }}
|
|
20
|
+
}
|
|
21
|
+
|
|
5
22
|
function log(data: any) {
|
|
6
23
|
console.log(data);
|
|
7
24
|
}
|
|
@@ -17,7 +34,7 @@ const test = fixture.test;
|
|
|
17
34
|
|
|
18
35
|
test.beforeAll(async () => {
|
|
19
36
|
for (const beforeAllHook of supportCodeLibrary.beforeTestRunHookDefinitions) {
|
|
20
|
-
const location =
|
|
37
|
+
const location = getLine(beforeAllHook);
|
|
21
38
|
await test.step(
|
|
22
39
|
'Before All',
|
|
23
40
|
() => beforeAllHook.code.apply({}),
|
|
@@ -47,7 +64,7 @@ for (const feature of features) {
|
|
|
47
64
|
for (const beforeHook of supportCodeLibrary.beforeTestCaseHookDefinitions) {
|
|
48
65
|
if (beforeHook.appliesToTestCase(testCase)) {
|
|
49
66
|
const hookName = beforeHook.name ?? 'Before';
|
|
50
|
-
const location =
|
|
67
|
+
const location = getLine(beforeHook);
|
|
51
68
|
await test.step(
|
|
52
69
|
hookName,
|
|
53
70
|
() => beforeHook.code.apply(world, [{
|
|
@@ -68,10 +85,9 @@ for (const feature of features) {
|
|
|
68
85
|
{ type: 'tags', description: JSON.stringify(tag) }
|
|
69
86
|
];
|
|
70
87
|
test(testCase.name, { tag, annotation }, async () => {
|
|
71
|
-
const
|
|
72
|
-
testInfo.result = { status: 'passed' };
|
|
88
|
+
const result: { status: string, error?: Error } = { status: 'passed' };
|
|
73
89
|
for (const pickleStep of testCase.steps) {
|
|
74
|
-
if (
|
|
90
|
+
if (result.status !== 'passed') {
|
|
75
91
|
break;
|
|
76
92
|
}
|
|
77
93
|
const steps = supportCodeLibrary.stepDefinitions
|
|
@@ -79,11 +95,11 @@ for (const feature of features) {
|
|
|
79
95
|
if (steps.length === 0) throw new Error(`Step '${pickleStep.text}' is not defined`);
|
|
80
96
|
if (steps.length > 1) throw new Error(`Step '${pickleStep.text}' matches multiple step definitions`);
|
|
81
97
|
const [ step ] = steps;
|
|
82
|
-
const location =
|
|
98
|
+
const location = getLine(step);
|
|
83
99
|
await test.step(pickleStep.text, async () => {
|
|
84
100
|
for (const beforeStep of supportCodeLibrary.beforeTestStepHookDefinitions) {
|
|
85
101
|
if (beforeStep.appliesToTestCase(testCase)) {
|
|
86
|
-
const location =
|
|
102
|
+
const location = getLine(beforeStep);
|
|
87
103
|
await test.step(
|
|
88
104
|
'Before Step',
|
|
89
105
|
() => beforeStep.code.apply(world, [{
|
|
@@ -104,18 +120,24 @@ for (const feature of features) {
|
|
|
104
120
|
try {
|
|
105
121
|
await step.code.apply(world, parameters);
|
|
106
122
|
} catch (err: any) {
|
|
107
|
-
|
|
123
|
+
result.status = 'failed';
|
|
124
|
+
result.error = err;
|
|
108
125
|
throw err;
|
|
109
126
|
} finally {
|
|
110
127
|
for (const afterStep of supportCodeLibrary.afterTestStepHookDefinitions) {
|
|
111
128
|
if (afterStep.appliesToTestCase(testCase)) {
|
|
112
|
-
const location =
|
|
129
|
+
const location = getLine(afterStep);
|
|
113
130
|
await test.step(
|
|
114
131
|
'After Step',
|
|
115
132
|
() => afterStep.code.apply(world, [{
|
|
116
133
|
pickle: testCase,
|
|
117
134
|
pickleStep,
|
|
118
|
-
result:
|
|
135
|
+
result: {
|
|
136
|
+
duration: 0,
|
|
137
|
+
message: result.error?.message,
|
|
138
|
+
status: result.status,
|
|
139
|
+
exception: result.error
|
|
140
|
+
}
|
|
119
141
|
}]),
|
|
120
142
|
location
|
|
121
143
|
);
|
|
@@ -137,12 +159,12 @@ for (const feature of features) {
|
|
|
137
159
|
for (const afterHook of supportCodeLibrary.afterTestCaseHookDefinitions) {
|
|
138
160
|
if (afterHook.appliesToTestCase(testCase)) {
|
|
139
161
|
const hookName = afterHook.name ?? 'After';
|
|
140
|
-
const location =
|
|
162
|
+
const location = getLine(afterHook);
|
|
141
163
|
await test.step(
|
|
142
164
|
hookName,
|
|
143
165
|
() => afterHook.code.apply(world, [{
|
|
144
166
|
pickle: testCase,
|
|
145
|
-
result: testInfo
|
|
167
|
+
result: getResult(testInfo)
|
|
146
168
|
}]),
|
|
147
169
|
location
|
|
148
170
|
);
|
|
@@ -155,7 +177,7 @@ for (const feature of features) {
|
|
|
155
177
|
|
|
156
178
|
test.afterAll(async () => {
|
|
157
179
|
for (const afterAllHook of supportCodeLibrary.afterTestRunHookDefinitions) {
|
|
158
|
-
const location =
|
|
180
|
+
const location = getLine(afterAllHook);
|
|
159
181
|
await test.step(
|
|
160
182
|
'After All',
|
|
161
183
|
() => afterAllHook.code.apply({}),
|