allure-cucumberjs 2.0.0-beta.24 → 2.0.0-beta.25
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/README.md +64 -42
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -19,39 +19,35 @@ Create the reporter file:
|
|
|
19
19
|
|
|
20
20
|
```js
|
|
21
21
|
// reporter.js
|
|
22
|
-
import { AllureRuntime } from "allure-js-commons"
|
|
22
|
+
import { AllureRuntime } from "allure-js-commons";
|
|
23
23
|
import { CucumberJSAllureFormatter } from "allure-cucumberjs";
|
|
24
24
|
|
|
25
25
|
export default class extends CucumberJSAllureFormatter {
|
|
26
26
|
constructor(options) {
|
|
27
|
-
super(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
]
|
|
53
|
-
}
|
|
54
|
-
);
|
|
27
|
+
super(options, new AllureRuntime({ resultsDir: "./allure-results" }), {
|
|
28
|
+
labels: [
|
|
29
|
+
{
|
|
30
|
+
pattern: [/@feature:(.*)/],
|
|
31
|
+
name: "epic",
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
pattern: [/@severity:(.*)/],
|
|
35
|
+
name: "severity",
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
links: [
|
|
39
|
+
{
|
|
40
|
+
pattern: [/@issue=(.*)/],
|
|
41
|
+
type: "issue",
|
|
42
|
+
urlTemplate: "http://localhost:8080/issue/%s",
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
pattern: [/@tms=(.*)/],
|
|
46
|
+
type: "tms",
|
|
47
|
+
urlTemplate: "http://localhost:8080/tms/%s",
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
});
|
|
55
51
|
}
|
|
56
52
|
}
|
|
57
53
|
```
|
|
@@ -68,9 +64,9 @@ Or via configuration file:
|
|
|
68
64
|
// config.js
|
|
69
65
|
module.exports = {
|
|
70
66
|
default: {
|
|
71
|
-
format: "./path/to/reporter.js"
|
|
72
|
-
}
|
|
73
|
-
}
|
|
67
|
+
format: "./path/to/reporter.js",
|
|
68
|
+
},
|
|
69
|
+
};
|
|
74
70
|
```
|
|
75
71
|
|
|
76
72
|
And then run CLI with `config` parameter:
|
|
@@ -93,19 +89,19 @@ By default, the feature is available out of the box for single thread mode.
|
|
|
93
89
|
Example:
|
|
94
90
|
|
|
95
91
|
```js
|
|
96
|
-
import { Given } from "@cucumber/cucumber"
|
|
92
|
+
import { Given } from "@cucumber/cucumber";
|
|
97
93
|
|
|
98
94
|
Given(/my step/, async function () {
|
|
99
95
|
await this.step("step can have anonymous body function", async function () {
|
|
100
|
-
await this.label("label_name", "label_value")
|
|
101
|
-
await this.attach(JSON.stringify({ foo: "bar "}), "application/json")
|
|
102
|
-
})
|
|
103
|
-
|
|
96
|
+
await this.label("label_name", "label_value");
|
|
97
|
+
await this.attach(JSON.stringify({ foo: "bar " }), "application/json");
|
|
98
|
+
});
|
|
99
|
+
|
|
104
100
|
await this.step("by the way, body function can be arrow one", async (step) => {
|
|
105
|
-
await step.label("label_name", "label_value")
|
|
106
|
-
await step.attach(JSON.stringify({ foo: "bar "}), "application/json")
|
|
107
|
-
})
|
|
108
|
-
})
|
|
101
|
+
await step.label("label_name", "label_value");
|
|
102
|
+
await step.attach(JSON.stringify({ foo: "bar " }), "application/json");
|
|
103
|
+
});
|
|
104
|
+
});
|
|
109
105
|
```
|
|
110
106
|
|
|
111
107
|
If you want to keep the functoinality in `parallel` mode, set `CucumberAllureWorld` as
|
|
@@ -149,7 +145,7 @@ Follow the same approach when you need to use your own `World` implementation. J
|
|
|
149
145
|
|
|
150
146
|
Given(/my step/, async function () {
|
|
151
147
|
+ this.hello()
|
|
152
|
-
|
|
148
|
+
|
|
153
149
|
await this.step("step can have anonymous body function", async function () {
|
|
154
150
|
await this.label("label_name", "label_value")
|
|
155
151
|
await this.attach(JSON.stringify({ foo: "bar "}), "application/json")
|
|
@@ -184,3 +180,29 @@ Given("A cat fact is recieved", async function (this: CustomWorld) {
|
|
|
184
180
|
});
|
|
185
181
|
});
|
|
186
182
|
```
|
|
183
|
+
|
|
184
|
+
### Parameters usage
|
|
185
|
+
|
|
186
|
+
```ts
|
|
187
|
+
import { Given } from "@cucumber/cucumber";
|
|
188
|
+
|
|
189
|
+
Given(/my step/, async function () {
|
|
190
|
+
await this.step("step can have anonymous body function", async function () {
|
|
191
|
+
await this.parameter("parameterName", "parameterValue");
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Also addParameter takes an third optional parameter with the hidden and excluded options:
|
|
197
|
+
`hidden: true` - hides parameter from the report
|
|
198
|
+
`excluded: true` - excludes parameter from the history
|
|
199
|
+
|
|
200
|
+
```ts
|
|
201
|
+
import { Given } from "@cucumber/cucumber";
|
|
202
|
+
|
|
203
|
+
Given(/my step/, async function () {
|
|
204
|
+
await this.step("step can have anonymous body function", async function () {
|
|
205
|
+
await this.parameter("parameterName", "parameterValue", { hidden: true, excluded: true });
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "allure-cucumberjs",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.25",
|
|
4
4
|
"description": "Allure Cucumber.JS integration",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Ilya Korobitsyn <mail@korobochka.org>",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@types/mocha": "^9.0.0",
|
|
29
29
|
"@types/node": "^16.7.8",
|
|
30
30
|
"@types/sinon": "^10.0.11",
|
|
31
|
-
"allure-mocha": "2.0.0-beta.
|
|
31
|
+
"allure-mocha": "2.0.0-beta.25",
|
|
32
32
|
"chai": "^4.3.4",
|
|
33
33
|
"chai-like": "^1.1.1",
|
|
34
34
|
"glob": "^8.0.0",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@cucumber/gherkin-streams": "^5.0.1",
|
|
46
46
|
"@cucumber/gherkin-utils": "^8.0.0",
|
|
47
47
|
"@cucumber/messages": "^20.0.0",
|
|
48
|
-
"allure-js-commons": "2.0.0-beta.
|
|
48
|
+
"allure-js-commons": "2.0.0-beta.25"
|
|
49
49
|
},
|
|
50
50
|
"files": [
|
|
51
51
|
"dist/src/**/*",
|