@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 +12 -0
- package/README.md +10 -0
- package/lib/adapter/codecept.js +1 -1
- package/lib/adapter/cypress-plugin/index.js +3 -4
- package/lib/adapter/webdriver.js +8 -2
- package/lib/client.js +5 -2
- package/package.json +1 -1
package/Changelog.md
CHANGED
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
|
package/lib/adapter/codecept.js
CHANGED
|
@@ -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.
|
|
10
|
-
client.
|
|
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
|
});
|
package/lib/adapter/webdriver.js
CHANGED
|
@@ -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
|
|
24
|
+
async onRunnerEnd() {
|
|
23
25
|
this._isSynchronising = true;
|
|
24
26
|
|
|
25
|
-
await this.
|
|
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
|
-
|
|
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
|
|