@testomatio/reporter 0.5.4 → 0.5.7

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 CHANGED
@@ -1,3 +1,15 @@
1
+ # 0.5.7
2
+
3
+ * Fixed webdriverio artifacts
4
+
5
+ # 0.5.6
6
+
7
+ * Unmark failed CodeceptJS tests as skipped
8
+
9
+ # 0.5.5
10
+
11
+ * Fixed `BeforeSuite` failures in CodeceptJS
12
+
1
13
  # 0.5.4
2
14
 
3
15
  Added `TESTOMATIO_CREATE=1` option to create unmatched tests on report
package/README.md CHANGED
@@ -189,6 +189,16 @@ exports.config = {
189
189
  }
190
190
  ```
191
191
 
192
+ For making screenshots on failed tests add the following hook to `wdio.conf.js`:
193
+
194
+ ```js
195
+ afterTest: function (test, context, { error, result, duration, passed, retries }) {
196
+ if (error) {
197
+ browser.takeScreenshot()
198
+ }
199
+ },
200
+ ```
201
+
192
202
  Run the following command from you project folder:
193
203
 
194
204
  ```bash
@@ -114,6 +114,26 @@ function CodeceptReporter(config) {
114
114
  error = err;
115
115
  });
116
116
 
117
+ event.dispatcher.on(event.hook.failed, (suite, err) => {
118
+ error = err;
119
+
120
+ if (!suite) return;
121
+ if (!suite.tests) return;
122
+ for (const test of suite.tests) {
123
+ const { id, tags, title } = test;
124
+ failedTests.push(id || title);
125
+ const testId = parseTest(tags);
126
+
127
+ client.addTestRun(testId, TRConstants.FAILED, {
128
+ ...stripExampleFromTitle(title),
129
+ suite_title: suite.title,
130
+ error,
131
+ time: 0,
132
+ });
133
+ }
134
+ output.stop();
135
+ });
136
+
117
137
  event.dispatcher.on(event.test.after, test => {
118
138
  if (test.state && test.state !== FAILED) return;
119
139
  if (test.err) error = test.err;
@@ -143,7 +163,9 @@ function CodeceptReporter(config) {
143
163
  });
144
164
 
145
165
  event.dispatcher.on(event.test.skipped, test => {
146
- const { tags, title } = test;
166
+ const { id, tags, title } = test;
167
+ if (failedTests.includes(id || title)) return;
168
+
147
169
  const testId = parseTest(tags);
148
170
  const testObj = getTestAndMessage(title);
149
171
  client.addTestRun(testId, TRConstants.SKIPPED, {
@@ -12,6 +12,8 @@ class WebdriverReporter extends WDIOReporter {
12
12
  this.client = new TestomatClient({ apiKey });
13
13
  options = Object.assign(options, { stdout: true });
14
14
 
15
+ this._addTestPromises = [];
16
+
15
17
  this._isSynchronising = false;
16
18
  }
17
19
 
@@ -19,14 +21,18 @@ class WebdriverReporter extends WDIOReporter {
19
21
  return this._isSynchronising === false;
20
22
  }
21
23
 
22
- async onTestEnd(test) {
24
+ async onRunnerEnd() {
23
25
  this._isSynchronising = true;
24
26
 
25
- await this.addTest(test);
27
+ await Promise.all(this._addTestPromises);
26
28
 
27
29
  this._isSynchronising = false;
28
30
  }
29
31
 
32
+ onTestEnd(test) {
33
+ this._addTestPromises.push(this.addTest(test));
34
+ }
35
+
30
36
  async addTest(test) {
31
37
  if (!this.client) return;
32
38
 
package/lib/client.js CHANGED
@@ -129,7 +129,9 @@ class TestomatClient {
129
129
  }
130
130
 
131
131
  for (const [idx, buffer] of filesBuffers.entries()) {
132
- uploadedFiles.push(upload.uploadFileAsBuffer(buffer, idx + 1, this.runId));
132
+ const fileName = `${idx + 1}-${title.replace(/\s+/g, '-')}`;
133
+
134
+ uploadedFiles.push(upload.uploadFileAsBuffer(buffer, fileName, this.runId));
133
135
  }
134
136
  }
135
137
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testomatio/reporter",
3
- "version": "0.5.4",
3
+ "version": "0.5.7",
4
4
  "description": "Testomatio Reporter Client",
5
5
  "main": "./lib/reporter.js",
6
6
  "repository": "git@github.com:testomatio/reporter.git",