@wdio/allure-reporter 7.25.0 → 7.25.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  WDIO Allure Reporter
2
2
  ====================
3
3
 
4
- > A WebdriverIO reporter plugin to create [Allure Test Reports](https://docs.qameta.io/allure/).
4
+ > A WebdriverIO reporter plugin to create [Allure Test Reports](https://docs.qameta.io/allure-report/).
5
5
 
6
6
  ![Allure Reporter Example](/img/allure.png)
7
7
 
package/build/index.d.ts CHANGED
@@ -11,13 +11,15 @@ declare class AllureReporter extends WDIOReporter {
11
11
  private _consoleOutput;
12
12
  private _originalStdoutWrite;
13
13
  private _addConsoleLogs;
14
+ private _startedFeatures;
14
15
  constructor(options?: AllureReporterOptions);
15
16
  registerListeners(): void;
16
17
  onRunnerStart(runner: RunnerStats): void;
17
- onSuiteStart(suite: SuiteStats): any;
18
+ onSuiteStart(suite: SuiteStats): void;
18
19
  onSuiteEnd(suite: SuiteStats): any;
19
- onTestStart(test: TestStats | HookStats): any;
20
- setCaseParameters(cid: string | undefined): void;
20
+ onTestStart(test: TestStats | HookStats): void;
21
+ setCaseParameters(cid: string | undefined, parentUid: string | undefined): void;
22
+ getParentSuite(uid?: string): SuiteStats | undefined;
21
23
  getLabels({ tags }: SuiteStats): {
22
24
  name: string;
23
25
  value: string;
@@ -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,E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CAAC;IACX,UAAU,WAAW,CAAC;QAClB,UAAU,cAAe,SAAQ,qBAAqB;SAAI;KAC7D;CACJ"}
package/build/index.js CHANGED
@@ -34,6 +34,7 @@ class AllureReporter extends reporter_1.default {
34
34
  ...options,
35
35
  outputDir,
36
36
  });
37
+ this._startedFeatures = [];
37
38
  this._addConsoleLogs = false;
38
39
  this._consoleOutput = '';
39
40
  this._originalStdoutWrite = process.stdout.write.bind(process.stdout);
@@ -74,27 +75,36 @@ class AllureReporter extends reporter_1.default {
74
75
  this._isMultiremote = runner.isMultiremote || false;
75
76
  }
76
77
  onSuiteStart(suite) {
77
- if (this._options.useCucumberStepReporter) {
78
- if (suite.type === 'feature') {
79
- // handle cucumber features as allure "suite"
80
- return this._allure.startSuite(suite.title);
81
- }
82
- // handle cucumber scenario as allure "case" instead of "suite"
83
- this._allure.startCase(suite.title);
84
- const currentTest = this._allure.getCurrentTest();
85
- this.getLabels(suite).forEach(({ name, value }) => {
86
- currentTest.addLabel(name, value);
87
- });
88
- if (suite.description) {
89
- this.addDescription(suite);
90
- }
91
- return this.setCaseParameters(suite.cid);
78
+ const isFeature = suite.type === 'feature';
79
+ if (!this._options.useCucumberStepReporter) {
80
+ const currentSuite = this._allure.getCurrentSuite();
81
+ const prefix = currentSuite ? currentSuite.name + ': ' : '';
82
+ this._allure.startSuite(prefix + suite.title);
83
+ return;
84
+ }
85
+ // handle cucumber features as allure "suite"
86
+ if (isFeature) {
87
+ // temp solution to keep suites stats index for saving allure test ops feature based structure
88
+ this._startedFeatures.push(suite);
89
+ this._allure.startSuite(suite.title);
90
+ return;
92
91
  }
93
- const currentSuite = this._allure.getCurrentSuite();
94
- const prefix = currentSuite ? currentSuite.name + ': ' : '';
95
- this._allure.startSuite(prefix + suite.title);
92
+ // handle cucumber scenario as allure "case" instead of "suite"
93
+ this._allure.startCase(suite.title);
94
+ const currentTest = this._allure.getCurrentTest();
95
+ this.getLabels(suite).forEach(({ name, value }) => {
96
+ currentTest.addLabel(name, value);
97
+ });
98
+ if (suite.description) {
99
+ this.addDescription(suite);
100
+ }
101
+ this.setCaseParameters(suite.cid, suite.parent);
96
102
  }
97
103
  onSuiteEnd(suite) {
104
+ // cleanup suites index to prevent resource leaks
105
+ if (suite.type === 'feature') {
106
+ this._startedFeatures = this._startedFeatures.filter((suite) => suite.uid !== suite.uid);
107
+ }
98
108
  if (this._options.useCucumberStepReporter && suite.type === 'scenario') {
99
109
  // passing hooks are missing the 'state' property
100
110
  suite.hooks = suite.hooks.map((hook) => {
@@ -128,23 +138,24 @@ class AllureReporter extends reporter_1.default {
128
138
  const testTitle = test.currentTest ? test.currentTest : test.title;
129
139
  if (this.isAnyTestRunning() && this._allure.getCurrentTest().name == testTitle) {
130
140
  // Test already in progress, most likely started by a before each hook
131
- this.setCaseParameters(test.cid);
141
+ this.setCaseParameters(test.cid, test.parent);
132
142
  return;
133
143
  }
134
144
  if (this._options.useCucumberStepReporter) {
135
- const step = this._allure.startStep(testTitle);
145
+ this._allure.startStep(testTitle);
136
146
  const testObj = test;
137
147
  const argument = testObj === null || testObj === void 0 ? void 0 : testObj.argument;
138
148
  const dataTable = (_a = argument === null || argument === void 0 ? void 0 : argument.rows) === null || _a === void 0 ? void 0 : _a.map((a) => a === null || a === void 0 ? void 0 : a.cells);
139
149
  if (dataTable) {
140
150
  this._allure.addAttachment('Data Table', (0, sync_1.stringify)(dataTable), 'text/csv');
141
151
  }
142
- return step;
152
+ return;
143
153
  }
144
154
  this._allure.startCase(testTitle);
145
- this.setCaseParameters(test.cid);
155
+ this.setCaseParameters(test.cid, test.parent);
146
156
  }
147
- setCaseParameters(cid) {
157
+ setCaseParameters(cid, parentUid) {
158
+ const parentSuite = this.getParentSuite(parentUid);
148
159
  const currentTest = this._allure.getCurrentTest();
149
160
  if (!this._isMultiremote) {
150
161
  const caps = this._capabilities;
@@ -167,6 +178,15 @@ class AllureReporter extends reporter_1.default {
167
178
  currentTest.addLabel('language', 'javascript');
168
179
  currentTest.addLabel('framework', 'wdio');
169
180
  currentTest.addLabel('thread', cid);
181
+ if (parentSuite === null || parentSuite === void 0 ? void 0 : parentSuite.title) {
182
+ currentTest.addLabel('feature', parentSuite === null || parentSuite === void 0 ? void 0 : parentSuite.title);
183
+ }
184
+ }
185
+ getParentSuite(uid) {
186
+ if (!uid) {
187
+ return undefined;
188
+ }
189
+ return this._startedFeatures.find((suite) => suite.uid === uid);
170
190
  }
171
191
  getLabels({ tags }) {
172
192
  const labels = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wdio/allure-reporter",
3
- "version": "7.25.0",
3
+ "version": "7.25.2",
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",
@@ -25,8 +25,8 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@types/node": "^18.0.0",
28
- "@wdio/reporter": "7.25.0",
29
- "@wdio/types": "7.25.0",
28
+ "@wdio/reporter": "7.25.1",
29
+ "@wdio/types": "7.25.1",
30
30
  "allure-js-commons": "^1.3.2",
31
31
  "csv-stringify": "^6.0.4",
32
32
  "strip-ansi": "^6.0.0"
@@ -37,5 +37,5 @@
37
37
  "publishConfig": {
38
38
  "access": "public"
39
39
  },
40
- "gitHead": "6e619e8d6a97561922c75a6e0ef2e6172e63b720"
40
+ "gitHead": "69164874891f64ab088699b33f9cafc6d779722f"
41
41
  }