@wdio/allure-reporter 7.29.1 → 7.30.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/README.md +33 -3
- package/build/index.d.ts +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +21 -5
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -40,8 +40,14 @@ exports.config = {
|
|
|
40
40
|
```
|
|
41
41
|
- `outputDir` defaults to `./allure-results`. After a test run is complete, you will find that this directory has been populated with an `.xml` file for each spec, plus a number of `.txt` and `.png` files and other attachments.
|
|
42
42
|
- `disableWebdriverStepsReporting` - optional parameter(`false` by default), in order to log only custom steps to the reporter.
|
|
43
|
-
- `issueLinkTemplate` - optional parameter, in order to specify the issue link pattern. Reporter will replace `{}` placeholder with value specified in `addIssue(value)` call parameter.
|
|
44
|
-
|
|
43
|
+
- `issueLinkTemplate` - optional parameter, in order to specify the issue link pattern. Reporter will replace `{}` placeholder with value specified in `addIssue(value)` call parameter. The same logic is applied if Cucumber is used and tag `issue` is set at any level, it will be converted to the link in the report. The parameter value example:
|
|
44
|
+
```
|
|
45
|
+
https://example.org/issue/{}
|
|
46
|
+
```
|
|
47
|
+
- `tmsLinkTemplate` - optional parameter, in order to specify TMS (Test Management System) link pattern. Reporter will replace `{}` placeholder with value specified in `addTestId(value)` call parameter. The same logic is applied if Cucumber is used and tag `testId` is set at any level, it will be converted to the link in the report. The parameter value example:
|
|
48
|
+
```
|
|
49
|
+
https://example.org/tms/{}
|
|
50
|
+
```
|
|
45
51
|
- `disableWebdriverScreenshotsReporting` - optional parameter(`false` by default), in order to not attach screenshots to the reporter.
|
|
46
52
|
- `useCucumberStepReporter` - optional parameter (`false` by default), set it to true in order to change the report hierarchy when using cucumber. Try it for yourself and see how it looks.
|
|
47
53
|
- `disableMochaHooks` - optional parameter (`false` by default), set it to true in order to not fetch the `before/after` stacktrace/screenshot/result hooks into the Allure Reporter.
|
|
@@ -98,7 +104,9 @@ describe('Suite', () => {
|
|
|
98
104
|
})
|
|
99
105
|
```
|
|
100
106
|
|
|
101
|
-
Cucumber
|
|
107
|
+
#### Cucumber
|
|
108
|
+
|
|
109
|
+
Basic Cucumber example:
|
|
102
110
|
|
|
103
111
|
```js
|
|
104
112
|
Given('I include feature and story name', () => {
|
|
@@ -107,6 +115,28 @@ Given('I include feature and story name', () => {
|
|
|
107
115
|
})
|
|
108
116
|
```
|
|
109
117
|
|
|
118
|
+
##### Cucumber Tags
|
|
119
|
+
|
|
120
|
+
Cucumber tags with special names (`issue` and `testId`) are converted to the links (the corresponding link templates must be configured before):
|
|
121
|
+
```gherkin
|
|
122
|
+
@issue=BUG-1
|
|
123
|
+
@testId=TST-2
|
|
124
|
+
Feature: This is a feature with global tags that will be converted to Allure links
|
|
125
|
+
@issue=BUG-3
|
|
126
|
+
@testId=TST-4
|
|
127
|
+
Scenario: This is a scenario with tags that will be converted to Allure links
|
|
128
|
+
Given I do something
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Cucumber tags with special names (`feature`) are mapped to Allure labels:
|
|
132
|
+
|
|
133
|
+
```gherkin
|
|
134
|
+
Feature: Test user role
|
|
135
|
+
@feature=login
|
|
136
|
+
Scenario: Login
|
|
137
|
+
Given I test login
|
|
138
|
+
```
|
|
139
|
+
|
|
110
140
|
## Displaying the report
|
|
111
141
|
|
|
112
142
|
The results can be consumed by any of the [reporting tools](https://docs.qameta.io/allure#_reporting) offered by Allure. For example:
|
package/build/index.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ declare class AllureReporter extends WDIOReporter {
|
|
|
18
18
|
onSuiteStart(suite: SuiteStats): void;
|
|
19
19
|
onSuiteEnd(suite: SuiteStats): any;
|
|
20
20
|
onTestStart(test: TestStats | HookStats): void;
|
|
21
|
-
setCaseParameters(cid: string | undefined, parentUid: string | undefined): void;
|
|
21
|
+
setCaseParameters(cid: string | undefined, parentUid: string | undefined, addFeatureLabel?: boolean): void;
|
|
22
22
|
getParentSuite(uid?: string): SuiteStats | undefined;
|
|
23
23
|
getLabels({ tags }: SuiteStats): {
|
|
24
24
|
name: string;
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,OAAO,YAAY,EAAE,EACjB,UAAU,EAAO,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,iBAAiB,EACrE,gBAAgB,EAAE,WAAW,EAChC,MAAM,gBAAgB,CAAA;AAQvB,OAAO,EACH,sBAAsB,EAAE,uBAAuB,EAAE,uBAAuB,EACxE,mBAAmB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,oBAAoB,EAC/E,iBAAiB,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,EACvE,MAAM,SAAS,CAAA;AAUhB,cAAM,cAAe,SAAQ,YAAY;IACrC,OAAO,CAAC,OAAO,CAAK;IACpB,OAAO,CAAC,aAAa,CAA+B;IACpD,OAAO,CAAC,cAAc,CAAC,CAAS;IAChC,OAAO,CAAC,OAAO,CAAC,CAAoB;IACpC,OAAO,CAAC,eAAe,CAAC,CAAQ;IAChC,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,cAAc,CAAQ;IAC9B,OAAO,CAAC,oBAAoB,CAAU;IACtC,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,gBAAgB,CAAmB;gBAE/B,OAAO,GAAE,qBAA0B;IA6B/C,iBAAiB;IAgBjB,aAAa,CAAC,MAAM,EAAE,WAAW;IAMjC,YAAY,CAAC,KAAK,EAAE,UAAU;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,OAAO,YAAY,EAAE,EACjB,UAAU,EAAO,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,iBAAiB,EACrE,gBAAgB,EAAE,WAAW,EAChC,MAAM,gBAAgB,CAAA;AAQvB,OA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;IACH,MAAM,CAAC,cAAc,SAAU,MAAM,SAAS,MAAM,UAEnD;IAED;;;;;OAKG;IACH,MAAM,CAAC,cAAc,gBAAiB,MAAM,mBAAmB,MAAM,UAEpE;IAED;;;;;;OAMG;IACH,MAAM,CAAC,aAAa,SAAU,MAAM,WAAW,MAAM,GAAG,MAAM,GAAG,MAAM,QAAQ,MAAM,UAKpF;IAED;;;;OAIG;IACH,MAAM,CAAC,SAAS,UAAW,MAAM,UAEhC;IAED;;;;OAIG;IACH,MAAM,CAAC,OAAO,YAAY,MAAM,UAK/B;IAED;;;;;;;;;OASG;IACH,MAAM,CAAC,OAAO,UAAW,MAAM,4BAI5B,GAAG,WAAe,MAAM,UAO1B;IAED;;;;;OAKG;IACH,MAAM,CAAC,WAAW,SAAU,MAAM,SAAS,MAAM,UAEhD;CACJ;AAED,eAAe,cAAc,CAAA;AAE7B,OAAO,EAAE,qBAAqB,EAAE,CAAA;AAChC,cAAc,SAAS,CAAA;AAEvB,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,WAAW,CAAC;QAClB,UAAU,cAAe,SAAQ,qBAAqB;SAAI;KAC7D;CACJ"}
|
package/build/index.js
CHANGED
|
@@ -92,13 +92,25 @@ class AllureReporter extends reporter_1.default {
|
|
|
92
92
|
// handle cucumber scenario as allure "case" instead of "suite"
|
|
93
93
|
this._allure.startCase(suite.title);
|
|
94
94
|
const currentTest = this._allure.getCurrentTest();
|
|
95
|
+
let featureLabelPresent = false;
|
|
95
96
|
this.getLabels(suite).forEach(({ name, value }) => {
|
|
96
|
-
|
|
97
|
+
if (name === 'issue') {
|
|
98
|
+
this.addIssue({ issue: value });
|
|
99
|
+
}
|
|
100
|
+
else if (name === 'testId') {
|
|
101
|
+
this.addTestId({ testId: value });
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
if (name === 'feature') {
|
|
105
|
+
featureLabelPresent = true;
|
|
106
|
+
}
|
|
107
|
+
currentTest.addLabel(name, value);
|
|
108
|
+
}
|
|
97
109
|
});
|
|
98
110
|
if (suite.description) {
|
|
99
111
|
this.addDescription(suite);
|
|
100
112
|
}
|
|
101
|
-
this.setCaseParameters(suite.cid, suite.parent);
|
|
113
|
+
this.setCaseParameters(suite.cid, suite.parent, !featureLabelPresent);
|
|
102
114
|
}
|
|
103
115
|
onSuiteEnd(suite) {
|
|
104
116
|
// cleanup suites index to prevent resource leaks
|
|
@@ -154,7 +166,8 @@ class AllureReporter extends reporter_1.default {
|
|
|
154
166
|
this._allure.startCase(testTitle);
|
|
155
167
|
this.setCaseParameters(test.cid, test.parent);
|
|
156
168
|
}
|
|
157
|
-
setCaseParameters(cid, parentUid) {
|
|
169
|
+
setCaseParameters(cid, parentUid, addFeatureLabel = true) {
|
|
170
|
+
var _a, _b;
|
|
158
171
|
const parentSuite = this.getParentSuite(parentUid);
|
|
159
172
|
const currentTest = this._allure.getCurrentTest();
|
|
160
173
|
if (!this._isMultiremote) {
|
|
@@ -178,8 +191,11 @@ class AllureReporter extends reporter_1.default {
|
|
|
178
191
|
currentTest.addLabel('language', 'javascript');
|
|
179
192
|
currentTest.addLabel('framework', 'wdio');
|
|
180
193
|
currentTest.addLabel('thread', cid);
|
|
181
|
-
if (
|
|
182
|
-
|
|
194
|
+
if (addFeatureLabel && parentSuite) {
|
|
195
|
+
const labelValue = (_b = (_a = this.getLabels(parentSuite).find(label => label.name === 'feature')) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : parentSuite.title;
|
|
196
|
+
if (labelValue) {
|
|
197
|
+
currentTest.addLabel('feature', labelValue);
|
|
198
|
+
}
|
|
183
199
|
}
|
|
184
200
|
}
|
|
185
201
|
getParentSuite(uid) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wdio/allure-reporter",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.30.1",
|
|
4
4
|
"description": "A WebdriverIO reporter plugin to create Allure Test Reports",
|
|
5
5
|
"author": "Boris Osipov <osipov.boris@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-allure-reporter",
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"publishConfig": {
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "c5c25e4e20b5ab75817d879deefaafceb247b602"
|
|
41
41
|
}
|