@testomatio/reporter 0.8.0-beta.3 → 0.8.0-beta.5
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/lib/adapter/cucumber/current.js +1 -7
- package/lib/adapter/jasmine.js +1 -8
- package/lib/adapter/jest.js +1 -7
- package/lib/adapter/playwright.js +1 -7
- package/lib/adapter/webdriver.js +1 -4
- package/lib/client.js +13 -3
- package/lib/pipe/github.js +9 -0
- package/lib/pipe/testomatio.js +12 -3
- package/lib/util.js +1 -3
- package/lib/xmlReader.js +5 -1
- package/package.json +2 -2
|
@@ -18,13 +18,7 @@ class CucumberReporter extends Formatter {
|
|
|
18
18
|
this.failures = [];
|
|
19
19
|
this.cases = [];
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
if (!apiKey || apiKey === '') {
|
|
23
|
-
console.log(chalk.red('TESTOMATIO key is empty, ignoring reports'));
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
this.client = new TestomatClient({ apiKey });
|
|
21
|
+
this.client = new TestomatClient();
|
|
28
22
|
this.status = TRConstants.PASSED;
|
|
29
23
|
|
|
30
24
|
}
|
package/lib/adapter/jasmine.js
CHANGED
|
@@ -5,14 +5,7 @@ const { PASSED, FAILED } = require('../constants');
|
|
|
5
5
|
class JasmineReporter {
|
|
6
6
|
constructor(options) {
|
|
7
7
|
this.testTimeMap = {};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if (!apiKey) {
|
|
11
|
-
console.log('TESTOMATIO key is empty, ignoring reports');
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
this.client = new TestomatClient({ apiKey });
|
|
8
|
+
this.client = new TestomatClient({ apiKey: options?.apiKey });
|
|
16
9
|
this.client.createRun();
|
|
17
10
|
}
|
|
18
11
|
|
package/lib/adapter/jest.js
CHANGED
|
@@ -6,14 +6,8 @@ class JestReporter {
|
|
|
6
6
|
constructor(globalConfig, options) {
|
|
7
7
|
this._globalConfig = globalConfig;
|
|
8
8
|
this._options = options;
|
|
9
|
-
const { apiKey } = options;
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
console.log('TESTOMATIO key is empty, ignoring reports');
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
this.client = new TestomatClient({ apiKey });
|
|
10
|
+
this.client = new TestomatClient({ apiKey: options?.apiKey });
|
|
17
11
|
this.client.createRun();
|
|
18
12
|
}
|
|
19
13
|
|
|
@@ -10,13 +10,7 @@ const { parseTest } = require('../util');
|
|
|
10
10
|
|
|
11
11
|
class TestomatioReporter {
|
|
12
12
|
constructor(config = {}) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (!apiKey) {
|
|
16
|
-
console.log('API Key is not provided. Testomat.io report is disabled');
|
|
17
|
-
} else {
|
|
18
|
-
this.client = new TestomatioClient({ apiKey });
|
|
19
|
-
}
|
|
13
|
+
this.client = new TestomatioClient({ apiKey: config?.apiKey });
|
|
20
14
|
|
|
21
15
|
this.videos = [];
|
|
22
16
|
}
|
package/lib/adapter/webdriver.js
CHANGED
|
@@ -7,10 +7,7 @@ class WebdriverReporter extends WDIOReporter {
|
|
|
7
7
|
constructor(options) {
|
|
8
8
|
super(options);
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
if (!apiKey) return;
|
|
12
|
-
|
|
13
|
-
this.client = new TestomatClient({ apiKey });
|
|
10
|
+
this.client = new TestomatClient({ apiKey: options?.apiKey });
|
|
14
11
|
options = Object.assign(options, { stdout: true });
|
|
15
12
|
|
|
16
13
|
this._addTestPromises = [];
|
package/lib/client.js
CHANGED
|
@@ -6,6 +6,7 @@ const chalk = require('chalk');
|
|
|
6
6
|
const upload = require('./fileUploader');
|
|
7
7
|
const { PASSED, FAILED, FINISHED, APP_PREFIX } = require('./constants');
|
|
8
8
|
const pipesFactory = require('./pipe');
|
|
9
|
+
|
|
9
10
|
const { TESTOMATIO_ENV } = process.env;
|
|
10
11
|
|
|
11
12
|
|
|
@@ -15,8 +16,7 @@ class TestomatClient {
|
|
|
15
16
|
*
|
|
16
17
|
* @param {*} params
|
|
17
18
|
*/
|
|
18
|
-
constructor(params) {
|
|
19
|
-
this.apiKey = params.apiKey || process.env.TESTOMATIO;
|
|
19
|
+
constructor(params = {}) {
|
|
20
20
|
this.title = params.title || process.env.TESTOMATIO_TITLE;
|
|
21
21
|
this.env = TESTOMATIO_ENV;
|
|
22
22
|
this.parallel = params.parallel;
|
|
@@ -25,7 +25,9 @@ class TestomatClient {
|
|
|
25
25
|
this.queue = Promise.resolve();
|
|
26
26
|
this.axios = axios.create();
|
|
27
27
|
this.totalUploaded = 0;
|
|
28
|
+
console.log(APP_PREFIX, this.pipes.filter(p => p.isEnabled).map(p => p.toString()).join(', ') || "No pipe reporters enabled");
|
|
28
29
|
this.version = JSON.parse(fs.readFileSync(join(__dirname, '..', 'package.json')).toString()).version;
|
|
30
|
+
console.log(APP_PREFIX, `Testomatio Reporter v${this.version}`);
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
/**
|
|
@@ -34,7 +36,9 @@ class TestomatClient {
|
|
|
34
36
|
* @returns {Promise} - resolves to Run id which should be used to update / add test
|
|
35
37
|
*/
|
|
36
38
|
createRun() {
|
|
37
|
-
|
|
39
|
+
// all pipes disabled, skipping
|
|
40
|
+
if (!this.pipes.filter(p => p.isEnabled).length) return;
|
|
41
|
+
|
|
38
42
|
const runParams = {
|
|
39
43
|
title: this.title,
|
|
40
44
|
parallel: this.parallel,
|
|
@@ -54,6 +58,9 @@ class TestomatClient {
|
|
|
54
58
|
* @returns {Promise}
|
|
55
59
|
*/
|
|
56
60
|
async addTestRun(testId, status, testData = {}) {
|
|
61
|
+
// all pipes disabled, skipping
|
|
62
|
+
if (!this.pipes.filter(p => p.isEnabled).length) return;
|
|
63
|
+
|
|
57
64
|
const {
|
|
58
65
|
error = '',
|
|
59
66
|
time = '',
|
|
@@ -127,6 +134,9 @@ class TestomatClient {
|
|
|
127
134
|
* @returns {Promise}
|
|
128
135
|
*/
|
|
129
136
|
updateRunStatus(status, isParallel) {
|
|
137
|
+
// all pipes disabled, skipping
|
|
138
|
+
if (!this.pipes.filter(p => p.isEnabled).length) return;
|
|
139
|
+
|
|
130
140
|
let statusEvent;
|
|
131
141
|
if (status === FINISHED) statusEvent = 'finish';
|
|
132
142
|
if (status === PASSED) statusEvent = 'pass';
|
package/lib/pipe/github.js
CHANGED
|
@@ -15,10 +15,19 @@ class GitHubPipe {
|
|
|
15
15
|
this.token = params.GH_PAT || process.env.GH_PAT;
|
|
16
16
|
this.ref = process.env.GITHUB_REF
|
|
17
17
|
this.repo = process.env.GITHUB_ACTION_REPOSITORY
|
|
18
|
+
|
|
19
|
+
if (process.env.DEBUG) {
|
|
20
|
+
console.log('GitHub Pipe: ', this.token ? 'TOKEN' : '*no token*', this.ref, this.repo);
|
|
21
|
+
}
|
|
22
|
+
|
|
18
23
|
if (!this.token || !this.ref || !this.repo) return;
|
|
19
24
|
this.isEnabled = true;
|
|
20
25
|
this.issue = this.ref.match(/refs\/pull\/(\d+)\/merge/)[1]
|
|
21
26
|
this.start = new Date();
|
|
27
|
+
|
|
28
|
+
if (process.env.DEBUG) {
|
|
29
|
+
console.log('GitHub Pipe: Enabled');
|
|
30
|
+
}
|
|
22
31
|
}
|
|
23
32
|
|
|
24
33
|
async createRun() {}
|
package/lib/pipe/testomatio.js
CHANGED
|
@@ -15,9 +15,15 @@ class TestomatioPipe {
|
|
|
15
15
|
constructor(params, store = {}) {
|
|
16
16
|
this.url = params.testomatioUrl || process.env.TESTOMATIO_URL || 'https://app.testomat.io';
|
|
17
17
|
this.apiKey = params.apiKey || process.env.TESTOMATIO;
|
|
18
|
+
if (process.env.DEBUG) {
|
|
19
|
+
console.log('Testomatio Pipe: ', this.apiKey ? 'API KEY' : '*no api key*');
|
|
20
|
+
}
|
|
18
21
|
if (!this.apiKey) {
|
|
19
22
|
return;
|
|
20
23
|
}
|
|
24
|
+
if (process.env.DEBUG) {
|
|
25
|
+
console.log('Testomatio Pipe: Enabled');
|
|
26
|
+
}
|
|
21
27
|
this.store = store;
|
|
22
28
|
this.title = params.title || process.env.TESTOMATIO_TITLE;
|
|
23
29
|
this.axios = axios.create();
|
|
@@ -26,7 +32,6 @@ class TestomatioPipe {
|
|
|
26
32
|
this.runId = params.runId || process.env.runId;
|
|
27
33
|
this.createNewTests = !!process.env.TESTOMATIO_CREATE;
|
|
28
34
|
|
|
29
|
-
|
|
30
35
|
if (!isValidUrl(this.url.trim())) {
|
|
31
36
|
this.isEnabled = false;
|
|
32
37
|
console.log(
|
|
@@ -56,7 +61,7 @@ class TestomatioPipe {
|
|
|
56
61
|
this.runUrl = `${this.url}/${resp.data.url.split('/').splice(3).join('/')}`;
|
|
57
62
|
this.store.runUrl = this.runUrl;
|
|
58
63
|
this.store.runId = this.runId;
|
|
59
|
-
console.log(APP_PREFIX, '📊 Report created. Report ID:', this.runId
|
|
64
|
+
console.log(APP_PREFIX, '📊 Report created. Report ID:', this.runId);
|
|
60
65
|
process.env.runId = this.runId;
|
|
61
66
|
} catch (err) {
|
|
62
67
|
console.log(
|
|
@@ -122,7 +127,11 @@ class TestomatioPipe {
|
|
|
122
127
|
} catch (err) {
|
|
123
128
|
console.log(APP_PREFIX, 'Error updating status, skipping...', err);
|
|
124
129
|
}
|
|
125
|
-
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
toString() {
|
|
133
|
+
return 'Testomatio Reporter';
|
|
134
|
+
}
|
|
126
135
|
}
|
|
127
136
|
|
|
128
137
|
module.exports = TestomatioPipe;
|
package/lib/util.js
CHANGED
|
@@ -137,9 +137,7 @@ const fetchSourceCode = (contents, opts = {}) => {
|
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
const isSameTest = (test, t) =>
|
|
141
|
-
return t.title == test.title && t.suite_title == test.suite_title && Object.values(t.example) == Object.values(test.example) && t.test_id == test.test_id;
|
|
142
|
-
}
|
|
140
|
+
const isSameTest = (test, t) => t.title == test.title && t.suite_title == test.suite_title && Object.values(t.example) == Object.values(test.example) && t.test_id == test.test_id
|
|
143
141
|
|
|
144
142
|
module.exports = {
|
|
145
143
|
parseTest,
|
package/lib/xmlReader.js
CHANGED
|
@@ -4,7 +4,7 @@ const fs = require("fs");
|
|
|
4
4
|
|
|
5
5
|
// const util = require("util"); // you can see a result
|
|
6
6
|
const { XMLParser } = require("fast-xml-parser");
|
|
7
|
-
const { PASSED, FAILED, SKIPPED } = require('./constants');
|
|
7
|
+
const { APP_PREFIX, PASSED, FAILED, SKIPPED } = require('./constants');
|
|
8
8
|
const { fetchFilesFromStackTrace, fetchSourceCode, fetchSourceCodeFromStackTrace } = require('./util');
|
|
9
9
|
const upload = require('./fileUploader');
|
|
10
10
|
const pipesFactory = require('./pipe');
|
|
@@ -45,6 +45,10 @@ class XmlReader {
|
|
|
45
45
|
this.stats = {}
|
|
46
46
|
this.stats.language = opts.lang?.toLowerCase();
|
|
47
47
|
this.filesToUpload = {}
|
|
48
|
+
|
|
49
|
+
console.log(APP_PREFIX, this.pipes.filter(p => p.isEnabled).map(p => p.toString()).join(', ') || "No pipe reporters enabled");
|
|
50
|
+
this.version = JSON.parse(fs.readFileSync(join(__dirname, '..', 'package.json')).toString()).version;
|
|
51
|
+
console.log(APP_PREFIX, `Testomatio Reporter v${this.version}`);
|
|
48
52
|
}
|
|
49
53
|
|
|
50
54
|
connectAdapter() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testomatio/reporter",
|
|
3
|
-
"version": "0.8.0-beta.
|
|
3
|
+
"version": "0.8.0-beta.5",
|
|
4
4
|
"description": "Testomatio Reporter Client",
|
|
5
5
|
"main": "./lib/reporter.js",
|
|
6
6
|
"repository": "git@github.com:testomatio/reporter.git",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"pretty": "prettier --write .",
|
|
32
32
|
"lint": "eslint lib",
|
|
33
33
|
"lint:fix": "eslint lib --fix",
|
|
34
|
-
"test": "mocha tests/**
|
|
34
|
+
"test": "mocha tests/**",
|
|
35
35
|
"init": "cd ./tests/adapter/examples/cucumber && npm i",
|
|
36
36
|
"test:unit": "mocha tests",
|
|
37
37
|
"test:adapter": "mocha './tests/adapter/index.test.js'",
|