@testomatio/reporter 0.5.6 → 0.5.9

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.9
2
+
3
+ * Added environment on Cypress report
4
+
5
+ # 0.5.8
6
+
7
+ * Fixed Cypress.io reporting
8
+
9
+ # 0.5.7
10
+
11
+ * Fixed webdriverio artifacts
12
+
1
13
  # 0.5.6
2
14
 
3
15
  * Unmark failed CodeceptJS tests as skipped
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
@@ -115,7 +115,7 @@ function CodeceptReporter(config) {
115
115
  });
116
116
 
117
117
  event.dispatcher.on(event.hook.failed, (suite, err) => {
118
- const error = err;
118
+ error = err;
119
119
 
120
120
  if (!suite) return;
121
121
  if (!suite.tests) return;
@@ -5,10 +5,9 @@ const TestomatClient = require('../../client');
5
5
  const testomatioReporter = on => {
6
6
  const client = new TestomatClient({ apiKey: process.env.TESTOMATIO });
7
7
 
8
- on('before:run', async () => {
9
- if (!client.title) {
10
- client.title = `${run.config.projectName} tests @${run.browser.displayName} @${run.system.osName}`
11
- if (client.title.includes('undefined')) delete client.title;
8
+ on('before:run', async (run) => {
9
+ if (!client.env) {
10
+ client.env = `${run.browser.displayName},${run.system.osName}`
12
11
  }
13
12
  await client.createRun();
14
13
  });
@@ -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
@@ -25,6 +25,7 @@ class TestomatClient {
25
25
  this.apiKey = params.apiKey || process.env.TESTOMATIO;
26
26
  this.title = params.title || process.env.TESTOMATIO_TITLE;
27
27
  this.createNewTests = !!process.env.TESTOMATIO_CREATE
28
+ this.env = TESTOMATIO_ENV;
28
29
  this.parallel = params.parallel;
29
30
  this.runId = process.env.runId;
30
31
  this.queue = Promise.resolve();
@@ -45,8 +46,8 @@ class TestomatClient {
45
46
  api_key: this.apiKey.trim(),
46
47
  title: this.title,
47
48
  parallel: this.parallel,
49
+ env: this.env,
48
50
  group_title: TESTOMATIO_RUNGROUP_TITLE,
49
- env: TESTOMATIO_ENV,
50
51
  };
51
52
 
52
53
  global.testomatioArtifacts = [];
@@ -129,7 +130,9 @@ class TestomatClient {
129
130
  }
130
131
 
131
132
  for (const [idx, buffer] of filesBuffers.entries()) {
132
- uploadedFiles.push(upload.uploadFileAsBuffer(buffer, idx + 1, this.runId));
133
+ const fileName = `${idx + 1}-${title.replace(/\s+/g, '-')}`;
134
+
135
+ uploadedFiles.push(upload.uploadFileAsBuffer(buffer, fileName, this.runId));
133
136
  }
134
137
  }
135
138
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testomatio/reporter",
3
- "version": "0.5.6",
3
+ "version": "0.5.9",
4
4
  "description": "Testomatio Reporter Client",
5
5
  "main": "./lib/reporter.js",
6
6
  "repository": "git@github.com:testomatio/reporter.git",