@testomatio/reporter 1.6.0-beta-2-artifacts → 2.0.0-beta-esm
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/codecept.js +288 -330
- package/lib/adapter/cucumber/current.js +195 -203
- package/lib/adapter/cucumber/legacy.js +130 -155
- package/lib/adapter/cucumber.js +5 -16
- package/lib/adapter/cypress-plugin/index.js +91 -105
- package/lib/adapter/jasmine/jasmine.js +63 -0
- package/lib/adapter/jasmine.js +54 -53
- package/lib/adapter/jest.js +97 -99
- package/lib/adapter/mocha/mocha.js +125 -0
- package/lib/adapter/mocha.js +111 -140
- package/lib/adapter/playwright.js +168 -200
- package/lib/adapter/vitest.js +144 -143
- package/lib/adapter/webdriver.js +113 -97
- package/lib/bin/reportXml.js +49 -49
- package/lib/bin/startTest.js +80 -97
- package/lib/client.js +344 -385
- package/lib/config.js +16 -21
- package/lib/constants.js +49 -43
- package/lib/data-storage.js +206 -188
- package/lib/fileUploader.js +245 -0
- package/lib/junit-adapter/adapter.js +17 -20
- package/lib/junit-adapter/csharp.js +18 -14
- package/lib/junit-adapter/index.js +27 -25
- package/lib/junit-adapter/java.js +41 -53
- package/lib/junit-adapter/javascript.js +30 -27
- package/lib/junit-adapter/python.js +38 -37
- package/lib/junit-adapter/ruby.js +11 -8
- package/lib/output.js +44 -52
- package/lib/package.json +1 -0
- package/lib/pipe/bitbucket.js +208 -227
- package/lib/pipe/csv.js +111 -124
- package/lib/pipe/github.js +184 -211
- package/lib/pipe/gitlab.js +164 -205
- package/lib/pipe/html.js +253 -312
- package/lib/pipe/index.js +83 -63
- package/lib/pipe/testomatio.js +391 -454
- package/lib/reporter-functions.js +16 -20
- package/lib/reporter.js +47 -17
- package/lib/services/artifacts.js +55 -51
- package/lib/services/index.js +14 -12
- package/lib/services/key-values.js +56 -53
- package/lib/services/logger.js +227 -245
- package/lib/utils/chalk.js +10 -0
- package/lib/utils/pipe_utils.js +91 -84
- package/lib/utils/utils.js +289 -273
- package/lib/xmlReader.js +480 -519
- package/package.json +57 -19
- package/src/adapter/codecept.js +369 -0
- package/src/adapter/cucumber/current.js +228 -0
- package/src/adapter/cucumber/legacy.js +158 -0
- package/src/adapter/cucumber.js +4 -0
- package/src/adapter/cypress-plugin/index.js +110 -0
- package/src/adapter/jasmine.js +60 -0
- package/src/adapter/jest.js +107 -0
- package/src/adapter/mocha.cjs +2 -0
- package/src/adapter/mocha.js +156 -0
- package/src/adapter/playwright.js +222 -0
- package/src/adapter/vitest.js +183 -0
- package/src/adapter/webdriver.js +111 -0
- package/src/bin/reportXml.js +67 -0
- package/src/bin/startTest.js +119 -0
- package/src/client.js +423 -0
- package/src/config.js +30 -0
- package/src/constants.js +49 -0
- package/src/data-storage.js +204 -0
- package/src/fileUploader.js +307 -0
- package/src/junit-adapter/adapter.js +23 -0
- package/src/junit-adapter/csharp.js +16 -0
- package/src/junit-adapter/index.js +28 -0
- package/src/junit-adapter/java.js +58 -0
- package/src/junit-adapter/javascript.js +31 -0
- package/src/junit-adapter/python.js +42 -0
- package/src/junit-adapter/ruby.js +10 -0
- package/src/output.js +57 -0
- package/src/pipe/bitbucket.js +254 -0
- package/src/pipe/csv.js +140 -0
- package/src/pipe/github.js +234 -0
- package/src/pipe/gitlab.js +229 -0
- package/src/pipe/html.js +366 -0
- package/src/pipe/index.js +73 -0
- package/src/pipe/testomatio.js +498 -0
- package/src/reporter-functions.js +44 -0
- package/src/reporter.cjs +22 -0
- package/src/reporter.js +24 -0
- package/src/services/artifacts.js +59 -0
- package/src/services/index.js +13 -0
- package/src/services/key-values.js +59 -0
- package/src/services/logger.js +314 -0
- package/src/template/emptyData.svg +23 -0
- package/src/template/testomatio.hbs +1421 -0
- package/src/utils/chalk.js +13 -0
- package/src/utils/pipe_utils.js +127 -0
- package/src/utils/utils.js +341 -0
- package/src/xmlReader.js +551 -0
- package/lib/bin/cli.js +0 -216
- package/lib/bin/uploadArtifacts.js +0 -86
- package/lib/uploader.js +0 -312
|
@@ -1,46 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const index_js_1 = require("./services/index.js");
|
|
4
|
+
const playwright_js_1 = require("./adapter/playwright.js");
|
|
5
|
+
if (process.env.PLAYWRIGHT_TEST_BASE_URL)
|
|
6
|
+
(0, playwright_js_1.initPlaywrightForStorage)();
|
|
8
7
|
/**
|
|
9
8
|
* Stores path to file as artifact and uploads it to the S3 storage
|
|
10
9
|
* @param {string | {path: string, type: string, name: string}} data - path to file or object with path, type and name
|
|
11
10
|
*/
|
|
12
11
|
function saveArtifact(data, context = null) {
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
if (!data)
|
|
13
|
+
return;
|
|
14
|
+
index_js_1.services.artifacts.put(data, context);
|
|
15
15
|
}
|
|
16
|
-
|
|
17
16
|
/**
|
|
18
17
|
* Attach log message(s) to the test report
|
|
19
18
|
* @param {...any} args
|
|
20
19
|
*/
|
|
21
20
|
function logMessage(...args) {
|
|
22
|
-
|
|
21
|
+
index_js_1.services.logger._templateLiteralLog(...args);
|
|
23
22
|
}
|
|
24
|
-
|
|
25
23
|
/**
|
|
26
24
|
* Similar to "log" function but marks message in report as a step
|
|
27
25
|
* @param {*} message
|
|
28
26
|
*/
|
|
29
27
|
function addStep(message) {
|
|
30
|
-
|
|
28
|
+
index_js_1.services.logger.step(message);
|
|
31
29
|
}
|
|
32
|
-
|
|
33
30
|
/**
|
|
34
31
|
* Add key-value pair(s) to the test report
|
|
35
32
|
* @param {*} keyValue
|
|
36
33
|
*/
|
|
37
34
|
function setKeyValue(keyValue) {
|
|
38
|
-
|
|
35
|
+
index_js_1.services.keyValues.put(keyValue);
|
|
39
36
|
}
|
|
40
|
-
|
|
41
37
|
module.exports = {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
38
|
+
artifact: saveArtifact,
|
|
39
|
+
log: logMessage,
|
|
40
|
+
step: addStep,
|
|
41
|
+
keyValue: setKeyValue,
|
|
46
42
|
};
|
package/lib/reporter.js
CHANGED
|
@@ -1,19 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.step = exports.meta = exports.logger = exports.log = exports.artifact = void 0;
|
|
30
|
+
const client_js_1 = __importDefault(require("./client.js"));
|
|
31
|
+
const TRConstants = __importStar(require("./constants.js"));
|
|
32
|
+
const index_js_1 = require("./services/index.js");
|
|
33
|
+
const reporter_functions_js_1 = __importDefault(require("./reporter-functions.js"));
|
|
7
34
|
module.exports = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
TestomatClient,
|
|
18
|
-
TRConstants,
|
|
35
|
+
// TODO: deprecate in future; use log or testomat.log
|
|
36
|
+
testomatioLogger: index_js_1.services.logger,
|
|
37
|
+
artifact: reporter_functions_js_1.default.artifact,
|
|
38
|
+
log: reporter_functions_js_1.default.log,
|
|
39
|
+
logger: index_js_1.services.logger,
|
|
40
|
+
meta: reporter_functions_js_1.default.keyValue,
|
|
41
|
+
step: reporter_functions_js_1.default.step,
|
|
42
|
+
TestomatClient: client_js_1.default,
|
|
43
|
+
TRConstants,
|
|
19
44
|
};
|
|
45
|
+
exports.artifact = reporter_functions_js_1.default.artifact;
|
|
46
|
+
exports.log = reporter_functions_js_1.default.log;
|
|
47
|
+
exports.logger = index_js_1.services.logger;
|
|
48
|
+
exports.meta = reporter_functions_js_1.default.keyValue;
|
|
49
|
+
exports.step = reporter_functions_js_1.default.step;
|
|
@@ -1,57 +1,61 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.artifactStorage = void 0;
|
|
7
|
+
const debug_1 = __importDefault(require("debug"));
|
|
8
|
+
const data_storage_js_1 = require("../data-storage.js");
|
|
9
|
+
const debug = (0, debug_1.default)('@testomatio/reporter:services-artifacts');
|
|
4
10
|
/**
|
|
5
11
|
* Artifact storage is supposed to store file paths
|
|
6
12
|
*/
|
|
7
13
|
class ArtifactStorage {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
static #instance;
|
|
15
|
+
/**
|
|
16
|
+
* Singleton
|
|
17
|
+
* @returns {ArtifactStorage}
|
|
18
|
+
*/
|
|
19
|
+
static getInstance() {
|
|
20
|
+
if (!this.#instance) {
|
|
21
|
+
this.#instance = new ArtifactStorage();
|
|
22
|
+
}
|
|
23
|
+
return this.#instance;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Stores path to file as artifact and uploads it to the S3 storage
|
|
27
|
+
* @param {string | {path: string, type: string, name: string}} data - path to file or object with path, type and name
|
|
28
|
+
* @param {*} context testId or test title
|
|
29
|
+
*/
|
|
30
|
+
put(data, context = null) {
|
|
31
|
+
if (!data)
|
|
32
|
+
return;
|
|
33
|
+
debug('Save artifact:', data);
|
|
34
|
+
data_storage_js_1.dataStorage.putData('artifact', data, context);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Returns list of artifacts to upload
|
|
38
|
+
* @param {*} context testId or test context from test runner
|
|
39
|
+
* @returns {(string | {path: string, type: string, name: string})[]}
|
|
40
|
+
*/
|
|
41
|
+
get(context) {
|
|
42
|
+
let artifacts = data_storage_js_1.dataStorage.getData('artifact', context);
|
|
43
|
+
if (!artifacts || !artifacts.length)
|
|
44
|
+
return [];
|
|
45
|
+
artifacts = artifacts.map(artifactData => {
|
|
46
|
+
// artifact could be an object ({type, path, name} props) or string (just path)
|
|
47
|
+
let artifact;
|
|
48
|
+
try {
|
|
49
|
+
artifact = JSON.parse(artifactData);
|
|
50
|
+
}
|
|
51
|
+
catch (e) {
|
|
52
|
+
artifact = artifactData;
|
|
53
|
+
}
|
|
54
|
+
return artifact;
|
|
55
|
+
});
|
|
56
|
+
artifacts = artifacts.filter(artifact => !!artifact);
|
|
57
|
+
debug(`Artifacts for test ${context}:`, artifacts);
|
|
58
|
+
return artifacts.length ? artifacts : [];
|
|
17
59
|
}
|
|
18
|
-
return this.#instance;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Stores path to file as artifact and uploads it to the S3 storage
|
|
23
|
-
* @param {string | {path: string, type: string, name: string}} data - path to file or object with path, type and name
|
|
24
|
-
* @param {*} context testId or test title
|
|
25
|
-
*/
|
|
26
|
-
put(data, context = null) {
|
|
27
|
-
if (!data) return;
|
|
28
|
-
debug('Save artifact:', data);
|
|
29
|
-
dataStorage.putData('artifact', data, context);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Returns list of artifacts to upload
|
|
34
|
-
* @param {*} context testId or test context from test runner
|
|
35
|
-
* @returns {(string | {path: string, type: string, name: string})[]}
|
|
36
|
-
*/
|
|
37
|
-
get(context) {
|
|
38
|
-
let artifacts = dataStorage.getData('artifact', context);
|
|
39
|
-
if (!artifacts || !artifacts.length) return [];
|
|
40
|
-
|
|
41
|
-
artifacts = artifacts.map(artifactData => {
|
|
42
|
-
// artifact could be an object ({type, path, name} props) or string (just path)
|
|
43
|
-
let artifact;
|
|
44
|
-
try {
|
|
45
|
-
artifact = JSON.parse(artifactData);
|
|
46
|
-
} catch (e) {
|
|
47
|
-
artifact = artifactData;
|
|
48
|
-
}
|
|
49
|
-
return artifact;
|
|
50
|
-
});
|
|
51
|
-
artifacts = artifacts.filter(artifact => !!artifact);
|
|
52
|
-
debug(`Artifacts for test ${context}:`, artifacts);
|
|
53
|
-
return artifacts.length ? artifacts : [];
|
|
54
|
-
}
|
|
55
60
|
}
|
|
56
|
-
|
|
57
|
-
module.exports.artifactStorage = ArtifactStorage.getInstance();
|
|
61
|
+
exports.artifactStorage = ArtifactStorage.getInstance();
|
package/lib/services/index.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.services = void 0;
|
|
4
|
+
const logger_js_1 = require("./logger.js");
|
|
5
|
+
const artifacts_js_1 = require("./artifacts.js");
|
|
6
|
+
const key_values_js_1 = require("./key-values.js");
|
|
7
|
+
const data_storage_js_1 = require("../data-storage.js");
|
|
8
|
+
exports.services = {
|
|
9
|
+
logger: logger_js_1.logger,
|
|
10
|
+
artifacts: artifacts_js_1.artifactStorage,
|
|
11
|
+
keyValues: key_values_js_1.keyValueStorage,
|
|
12
|
+
setContext: context => {
|
|
13
|
+
data_storage_js_1.dataStorage.setContext(context);
|
|
14
|
+
},
|
|
13
15
|
};
|
|
@@ -1,58 +1,61 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.keyValueStorage = void 0;
|
|
7
|
+
const debug_1 = __importDefault(require("debug"));
|
|
8
|
+
const data_storage_js_1 = require("../data-storage.js");
|
|
9
|
+
const debug = (0, debug_1.default)('@testomatio/reporter:services-key-value');
|
|
4
10
|
class KeyValueStorage {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
static #instance;
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @returns {KeyValueStorage}
|
|
15
|
+
*/
|
|
16
|
+
static getInstance() {
|
|
17
|
+
if (!this.#instance) {
|
|
18
|
+
this.#instance = new KeyValueStorage();
|
|
19
|
+
}
|
|
20
|
+
return this.#instance;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Stores key-value pair and passes it to reporter
|
|
24
|
+
* @param {{key: string}} keyValue - key-value pair(s) as object
|
|
25
|
+
* @param {*} context - full test title
|
|
26
|
+
*/
|
|
27
|
+
put(keyValue, context = null) {
|
|
28
|
+
if (!keyValue)
|
|
29
|
+
return;
|
|
30
|
+
data_storage_js_1.dataStorage.putData('keyvalue', keyValue, context);
|
|
31
|
+
}
|
|
32
|
+
#isKeyValueObject(smth) {
|
|
33
|
+
return smth && typeof smth === 'object' && !Array.isArray(smth) && smth !== null;
|
|
14
34
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
get(context = null) {
|
|
38
|
-
const keyValuesList = dataStorage.getData('keyvalue', context);
|
|
39
|
-
if (!keyValuesList || !keyValuesList?.length) return {};
|
|
40
|
-
|
|
41
|
-
const keyValues = {};
|
|
42
|
-
for (const keyValue of keyValuesList) {
|
|
43
|
-
if (this.#isKeyValueObject(keyValue)) {
|
|
44
|
-
Object.assign(keyValues, keyValue);
|
|
45
|
-
} else if (typeof keyValue === 'string') {
|
|
46
|
-
try {
|
|
47
|
-
Object.assign(keyValues, JSON.parse(keyValue));
|
|
48
|
-
} catch (e) {
|
|
49
|
-
debug(`Error parsing key-values for test ${context}`, keyValue);
|
|
35
|
+
/**
|
|
36
|
+
* Returns key-values pairs for the test as object
|
|
37
|
+
* @param {*} context testId or test context from test runner
|
|
38
|
+
* @returns {{[key: string]: string} | {}} key-values pairs as object, e.g. {priority: 'high', browser: 'chrome'}
|
|
39
|
+
*/
|
|
40
|
+
get(context = null) {
|
|
41
|
+
const keyValuesList = data_storage_js_1.dataStorage.getData('keyvalue', context);
|
|
42
|
+
if (!keyValuesList || !keyValuesList?.length)
|
|
43
|
+
return {};
|
|
44
|
+
const keyValues = {};
|
|
45
|
+
for (const keyValue of keyValuesList) {
|
|
46
|
+
if (this.#isKeyValueObject(keyValue)) {
|
|
47
|
+
Object.assign(keyValues, keyValue);
|
|
48
|
+
}
|
|
49
|
+
else if (typeof keyValue === 'string') {
|
|
50
|
+
try {
|
|
51
|
+
Object.assign(keyValues, JSON.parse(keyValue));
|
|
52
|
+
}
|
|
53
|
+
catch (e) {
|
|
54
|
+
debug(`Error parsing key-values for test ${context}`, keyValue);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
50
57
|
}
|
|
51
|
-
|
|
58
|
+
return keyValues;
|
|
52
59
|
}
|
|
53
|
-
|
|
54
|
-
return keyValues;
|
|
55
|
-
}
|
|
56
60
|
}
|
|
57
|
-
|
|
58
|
-
module.exports.keyValueStorage = KeyValueStorage.getInstance();
|
|
61
|
+
exports.keyValueStorage = KeyValueStorage.getInstance();
|