@testomatio/reporter 2.1.3-beta.3-multi-links → 2.3.0-beta.1-links
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 +5 -3
- package/lib/adapter/cucumber/current.js +2 -0
- package/lib/adapter/jest.js +2 -0
- package/lib/adapter/mocha.js +14 -0
- package/lib/adapter/playwright.js +2 -0
- package/lib/adapter/webdriver.js +8 -9
- package/lib/bin/startTest.js +38 -91
- package/lib/client.js +4 -32
- package/lib/data-storage.d.ts +4 -4
- package/lib/data-storage.js +11 -12
- package/lib/pipe/testomatio.js +3 -3
- package/lib/reporter-functions.d.ts +26 -6
- package/lib/reporter-functions.js +36 -35
- package/lib/reporter.d.ts +10 -8
- package/lib/reporter.js +9 -7
- package/lib/services/index.d.ts +2 -2
- package/lib/services/index.js +2 -2
- package/lib/services/labels.d.ts +0 -22
- package/lib/services/labels.js +0 -62
- package/lib/services/links.d.ts +1 -1
- package/lib/utils/utils.js +3 -1
- package/package.json +1 -1
- package/src/adapter/codecept.js +6 -4
- package/src/adapter/cucumber/current.js +2 -0
- package/src/adapter/jest.js +2 -0
- package/src/adapter/mocha.js +15 -0
- package/src/adapter/playwright.js +2 -0
- package/src/adapter/webdriver.js +8 -9
- package/src/bin/startTest.js +43 -114
- package/src/client.js +4 -32
- package/src/data-storage.js +11 -14
- package/src/pipe/testomatio.js +3 -3
- package/src/reporter-functions.js +36 -38
- package/src/reporter.js +8 -6
- package/src/services/index.js +2 -2
- package/src/services/labels.js +0 -58
- package/src/services/links.js +69 -0
- package/src/utils/utils.js +5 -3
- package/lib/utils/cli_utils.d.ts +0 -1
- package/lib/utils/cli_utils.js +0 -524304
|
@@ -4,6 +4,8 @@ const index_js_1 = require("./services/index.js");
|
|
|
4
4
|
/**
|
|
5
5
|
* Stores path to file as artifact and uploads it to the S3 storage
|
|
6
6
|
* @param {string | {path: string, type: string, name: string}} data - path to file or object with path, type and name
|
|
7
|
+
* @param {any} [context=null] - optional context parameter
|
|
8
|
+
* @returns {void}
|
|
7
9
|
*/
|
|
8
10
|
function saveArtifact(data, context = null) {
|
|
9
11
|
if (process.env.IS_PLAYWRIGHT)
|
|
@@ -15,7 +17,8 @@ function saveArtifact(data, context = null) {
|
|
|
15
17
|
}
|
|
16
18
|
/**
|
|
17
19
|
* Attach log message(s) to the test report
|
|
18
|
-
* @param
|
|
20
|
+
* @param {...any} args - log messages to attach
|
|
21
|
+
* @returns {void}
|
|
19
22
|
*/
|
|
20
23
|
function logMessage(...args) {
|
|
21
24
|
if (process.env.IS_PLAYWRIGHT)
|
|
@@ -24,7 +27,8 @@ function logMessage(...args) {
|
|
|
24
27
|
}
|
|
25
28
|
/**
|
|
26
29
|
* Similar to "log" function but marks message in report as a step
|
|
27
|
-
* @param {string} message
|
|
30
|
+
* @param {string} message - step message
|
|
31
|
+
* @returns {void}
|
|
28
32
|
*/
|
|
29
33
|
function addStep(message) {
|
|
30
34
|
if (process.env.IS_PLAYWRIGHT)
|
|
@@ -33,8 +37,9 @@ function addStep(message) {
|
|
|
33
37
|
}
|
|
34
38
|
/**
|
|
35
39
|
* Add key-value pair(s) to the test report
|
|
36
|
-
* @param {{[key: string]: string} | string} keyValue object { key: value } (multiple props allowed) or key (string)
|
|
37
|
-
* @param {string
|
|
40
|
+
* @param {{[key: string]: string} | string} keyValue - object { key: value } (multiple props allowed) or key (string)
|
|
41
|
+
* @param {string|null} [value=null] - optional value when keyValue is a string
|
|
42
|
+
* @returns {void}
|
|
38
43
|
*/
|
|
39
44
|
function setKeyValue(keyValue, value = null) {
|
|
40
45
|
if (process.env.IS_PLAYWRIGHT)
|
|
@@ -47,41 +52,35 @@ function setKeyValue(keyValue, value = null) {
|
|
|
47
52
|
/**
|
|
48
53
|
* Add a single label to the test report
|
|
49
54
|
* @param {string} key - label key (e.g. 'severity', 'feature', or just 'smoke' for labels without values)
|
|
50
|
-
* @param {string} [value] - optional label value (e.g. 'high', 'login')
|
|
55
|
+
* @param {string|null} [value=null] - optional label value (e.g. 'high', 'login')
|
|
56
|
+
* @returns {void}
|
|
51
57
|
*/
|
|
52
58
|
function setLabel(key, value = null) {
|
|
53
59
|
if (Array.isArray(value)) {
|
|
54
|
-
value.forEach(
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
if (!key || typeof key !== 'string') {
|
|
58
|
-
console.warn('Label key must be a non-empty string');
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
// Limit key length to 255 characters
|
|
62
|
-
if (key.length > 255) {
|
|
63
|
-
console.warn('Label key is too long, trimmed to 255 characters:', key);
|
|
64
|
-
key = key.substring(0, 255);
|
|
65
|
-
}
|
|
66
|
-
let labelString = key;
|
|
67
|
-
if (value !== null && value !== undefined && value !== '') {
|
|
68
|
-
if (typeof value !== 'string') {
|
|
69
|
-
console.warn('Label value must be a string, converting:', value);
|
|
70
|
-
value = String(value);
|
|
71
|
-
}
|
|
72
|
-
// Limit value length to 255 characters
|
|
73
|
-
if (value.length > 255) {
|
|
74
|
-
console.warn('Label value is too long, trimmed to 255 characters:', value);
|
|
75
|
-
value = value.substring(0, 255);
|
|
76
|
-
}
|
|
77
|
-
labelString = `${key}:${value}`;
|
|
78
|
-
}
|
|
79
|
-
// Limit total label length to 255 characters
|
|
80
|
-
if (labelString.length > 255) {
|
|
81
|
-
console.warn('Label is too long, trimmed to 255 characters:', labelString);
|
|
82
|
-
labelString = labelString.substring(0, 255);
|
|
60
|
+
return value.forEach(label => setLabel(key, label));
|
|
83
61
|
}
|
|
84
|
-
|
|
62
|
+
const labelObject = value !== null && value !== undefined && value !== ''
|
|
63
|
+
? { label: `${key}:${value}` }
|
|
64
|
+
: { label: key };
|
|
65
|
+
index_js_1.services.links.put([labelObject]);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Add link(s) to the test report
|
|
69
|
+
* @param {...string} testIds - test IDs to link
|
|
70
|
+
* @returns {void}
|
|
71
|
+
*/
|
|
72
|
+
function linkTest(...testIds) {
|
|
73
|
+
const links = testIds.map(testId => ({ test: testId }));
|
|
74
|
+
index_js_1.services.links.put(links);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Add JIRA issue link(s) to the test report
|
|
78
|
+
* @param {...string} jiraIds - JIRA issue IDs to link
|
|
79
|
+
* @returns {void}
|
|
80
|
+
*/
|
|
81
|
+
function linkJira(...jiraIds) {
|
|
82
|
+
const links = jiraIds.map(jiraId => ({ jira: jiraId }));
|
|
83
|
+
index_js_1.services.links.put(links);
|
|
85
84
|
}
|
|
86
85
|
module.exports = {
|
|
87
86
|
artifact: saveArtifact,
|
|
@@ -89,4 +88,6 @@ module.exports = {
|
|
|
89
88
|
step: addStep,
|
|
90
89
|
keyValue: setKeyValue,
|
|
91
90
|
label: setLabel,
|
|
91
|
+
linkTest,
|
|
92
|
+
linkJira,
|
|
92
93
|
};
|
package/lib/reporter.d.ts
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
export type artifact = typeof import("./reporter-functions.js");
|
|
2
1
|
export const artifact: (data: string | {
|
|
3
2
|
path: string;
|
|
4
3
|
type: string;
|
|
5
4
|
name: string;
|
|
6
5
|
}, context?: any) => void;
|
|
7
|
-
export type log = typeof import("./reporter-functions.js");
|
|
8
6
|
export const log: (...args: any[]) => void;
|
|
9
|
-
export type logger = typeof import("./services/index.js");
|
|
10
7
|
export const logger: {
|
|
11
8
|
"__#13@#originalUserLogger": {
|
|
12
9
|
assert(condition?: boolean, ...data: any[]): void;
|
|
@@ -75,14 +72,12 @@ export const logger: {
|
|
|
75
72
|
}): void;
|
|
76
73
|
prettyObjects: boolean;
|
|
77
74
|
};
|
|
78
|
-
export type meta = typeof import("./reporter-functions.js");
|
|
79
75
|
export const meta: (keyValue: {
|
|
80
76
|
[key: string]: string;
|
|
81
77
|
} | string, value?: string | null) => void;
|
|
82
|
-
export type step = typeof import("./reporter-functions.js");
|
|
83
78
|
export const step: (message: string) => void;
|
|
84
|
-
export
|
|
85
|
-
export const
|
|
79
|
+
export const label: (key: string, value?: string | null) => void;
|
|
80
|
+
export const linkTest: (...testIds: string[]) => void;
|
|
86
81
|
declare namespace _default {
|
|
87
82
|
let testomatioLogger: {
|
|
88
83
|
"__#13@#originalUserLogger": {
|
|
@@ -230,6 +225,13 @@ declare namespace _default {
|
|
|
230
225
|
[key: string]: string;
|
|
231
226
|
} | string, value?: string | null) => void;
|
|
232
227
|
let step: (message: string) => void;
|
|
233
|
-
let label: (key: string, value?: string) => void;
|
|
228
|
+
let label: (key: string, value?: string | null) => void;
|
|
229
|
+
let linkTest: (...testIds: string[]) => void;
|
|
234
230
|
}
|
|
235
231
|
export default _default;
|
|
232
|
+
export type ArtifactFunction = typeof import("./reporter-functions.js").default.artifact;
|
|
233
|
+
export type LogFunction = typeof import("./reporter-functions.js").default.log;
|
|
234
|
+
export type LoggerService = typeof import("./services/index.js").services.logger;
|
|
235
|
+
export type MetaFunction = typeof import("./reporter-functions.js").default.keyValue;
|
|
236
|
+
export type StepFunction = typeof import("./reporter-functions.js").default.step;
|
|
237
|
+
export type LabelFunction = typeof import("./reporter-functions.js").default.label;
|
package/lib/reporter.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.label = exports.step = exports.meta = exports.logger = exports.log = exports.artifact = void 0;
|
|
6
|
+
exports.linkTest = exports.label = exports.step = exports.meta = exports.logger = exports.log = exports.artifact = void 0;
|
|
7
7
|
// import TestomatClient from './client.js';
|
|
8
8
|
// import * as TRConstants from './constants.js';
|
|
9
9
|
const index_js_1 = require("./services/index.js");
|
|
@@ -14,13 +14,14 @@ exports.logger = index_js_1.services.logger;
|
|
|
14
14
|
exports.meta = reporter_functions_js_1.default.keyValue;
|
|
15
15
|
exports.step = reporter_functions_js_1.default.step;
|
|
16
16
|
exports.label = reporter_functions_js_1.default.label;
|
|
17
|
+
exports.linkTest = reporter_functions_js_1.default.linkTest;
|
|
17
18
|
/**
|
|
18
|
-
* @typedef {import('./reporter-functions.js')}
|
|
19
|
-
* @typedef {import('./reporter-functions.js')}
|
|
20
|
-
* @typedef {import('./services/index.js')}
|
|
21
|
-
* @typedef {import('./reporter-functions.js')}
|
|
22
|
-
* @typedef {import('./reporter-functions.js')}
|
|
23
|
-
* @typedef {import('./reporter-functions.js')}
|
|
19
|
+
* @typedef {typeof import('./reporter-functions.js').default.artifact} ArtifactFunction
|
|
20
|
+
* @typedef {typeof import('./reporter-functions.js').default.log} LogFunction
|
|
21
|
+
* @typedef {typeof import('./services/index.js').services.logger} LoggerService
|
|
22
|
+
* @typedef {typeof import('./reporter-functions.js').default.keyValue} MetaFunction
|
|
23
|
+
* @typedef {typeof import('./reporter-functions.js').default.step} StepFunction
|
|
24
|
+
* @typedef {typeof import('./reporter-functions.js').default.label} LabelFunction
|
|
24
25
|
*/
|
|
25
26
|
module.exports = {
|
|
26
27
|
/**
|
|
@@ -33,6 +34,7 @@ module.exports = {
|
|
|
33
34
|
meta: reporter_functions_js_1.default.keyValue,
|
|
34
35
|
step: reporter_functions_js_1.default.step,
|
|
35
36
|
label: reporter_functions_js_1.default.label,
|
|
37
|
+
linkTest: reporter_functions_js_1.default.linkTest,
|
|
36
38
|
// TestomatClient,
|
|
37
39
|
// TRConstants,
|
|
38
40
|
};
|
package/lib/services/index.d.ts
CHANGED
|
@@ -2,10 +2,10 @@ export namespace services {
|
|
|
2
2
|
export { logger };
|
|
3
3
|
export { artifactStorage as artifacts };
|
|
4
4
|
export { keyValueStorage as keyValues };
|
|
5
|
-
export {
|
|
5
|
+
export { linkStorage as links };
|
|
6
6
|
export function setContext(context: any): void;
|
|
7
7
|
}
|
|
8
8
|
import { logger } from './logger.js';
|
|
9
9
|
import { artifactStorage } from './artifacts.js';
|
|
10
10
|
import { keyValueStorage } from './key-values.js';
|
|
11
|
-
import {
|
|
11
|
+
import { linkStorage } from './links.js';
|
package/lib/services/index.js
CHANGED
|
@@ -4,13 +4,13 @@ exports.services = void 0;
|
|
|
4
4
|
const logger_js_1 = require("./logger.js");
|
|
5
5
|
const artifacts_js_1 = require("./artifacts.js");
|
|
6
6
|
const key_values_js_1 = require("./key-values.js");
|
|
7
|
-
const
|
|
7
|
+
const links_js_1 = require("./links.js");
|
|
8
8
|
const data_storage_js_1 = require("../data-storage.js");
|
|
9
9
|
exports.services = {
|
|
10
10
|
logger: logger_js_1.logger,
|
|
11
11
|
artifacts: artifacts_js_1.artifactStorage,
|
|
12
12
|
keyValues: key_values_js_1.keyValueStorage,
|
|
13
|
-
|
|
13
|
+
links: links_js_1.linkStorage,
|
|
14
14
|
setContext: context => {
|
|
15
15
|
data_storage_js_1.dataStorage.setContext(context);
|
|
16
16
|
},
|
package/lib/services/labels.d.ts
CHANGED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export const labelStorage: LabelStorage;
|
|
2
|
-
declare class LabelStorage {
|
|
3
|
-
static "__#16@#instance": any;
|
|
4
|
-
/**
|
|
5
|
-
*
|
|
6
|
-
* @returns {LabelStorage}
|
|
7
|
-
*/
|
|
8
|
-
static getInstance(): LabelStorage;
|
|
9
|
-
/**
|
|
10
|
-
* Stores labels array and passes it to reporter
|
|
11
|
-
* @param {string[]} labels - array of label strings
|
|
12
|
-
* @param {*} context - full test title
|
|
13
|
-
*/
|
|
14
|
-
put(labels: string[], context?: any): void;
|
|
15
|
-
/**
|
|
16
|
-
* Returns labels array for the test
|
|
17
|
-
* @param {*} context testId or test context from test runner
|
|
18
|
-
* @returns {string[]} labels array, e.g. ['smoke', 'severity:high', 'feature:user_account']
|
|
19
|
-
*/
|
|
20
|
-
get(context?: any): string[];
|
|
21
|
-
}
|
|
22
|
-
export {};
|
package/lib/services/labels.js
CHANGED
|
@@ -1,62 +0,0 @@
|
|
|
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.labelStorage = 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-labels');
|
|
10
|
-
class LabelStorage {
|
|
11
|
-
static #instance;
|
|
12
|
-
/**
|
|
13
|
-
*
|
|
14
|
-
* @returns {LabelStorage}
|
|
15
|
-
*/
|
|
16
|
-
static getInstance() {
|
|
17
|
-
if (!this.#instance) {
|
|
18
|
-
this.#instance = new LabelStorage();
|
|
19
|
-
}
|
|
20
|
-
return this.#instance;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Stores labels array and passes it to reporter
|
|
24
|
-
* @param {string[]} labels - array of label strings
|
|
25
|
-
* @param {*} context - full test title
|
|
26
|
-
*/
|
|
27
|
-
put(labels, context = null) {
|
|
28
|
-
if (!labels || !Array.isArray(labels))
|
|
29
|
-
return;
|
|
30
|
-
data_storage_js_1.dataStorage.putData('labels', labels, context);
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Returns labels array for the test
|
|
34
|
-
* @param {*} context testId or test context from test runner
|
|
35
|
-
* @returns {string[]} labels array, e.g. ['smoke', 'severity:high', 'feature:user_account']
|
|
36
|
-
*/
|
|
37
|
-
get(context = null) {
|
|
38
|
-
const labelsList = data_storage_js_1.dataStorage.getData('labels', context);
|
|
39
|
-
if (!labelsList || !labelsList?.length)
|
|
40
|
-
return [];
|
|
41
|
-
const allLabels = [];
|
|
42
|
-
for (const labels of labelsList) {
|
|
43
|
-
if (Array.isArray(labels)) {
|
|
44
|
-
allLabels.push(...labels);
|
|
45
|
-
}
|
|
46
|
-
else if (typeof labels === 'string') {
|
|
47
|
-
try {
|
|
48
|
-
const parsedLabels = JSON.parse(labels);
|
|
49
|
-
if (Array.isArray(parsedLabels)) {
|
|
50
|
-
allLabels.push(...parsedLabels);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
catch (e) {
|
|
54
|
-
debug(`Error parsing labels for test ${context}`, labels);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
// Remove duplicates
|
|
59
|
-
return [...new Set(allLabels)];
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
exports.labelStorage = LabelStorage.getInstance();
|
package/lib/services/links.d.ts
CHANGED
package/lib/utils/utils.js
CHANGED
|
@@ -321,7 +321,7 @@ const fileSystem = {
|
|
|
321
321
|
exports.fileSystem = fileSystem;
|
|
322
322
|
const foundedTestLog = (app, tests) => {
|
|
323
323
|
const n = tests.length;
|
|
324
|
-
return
|
|
324
|
+
return console.log(app, `✅ We found ${n === 1 ? 'one test' : `${n} tests`} in Testomat.io!`);
|
|
325
325
|
};
|
|
326
326
|
exports.foundedTestLog = foundedTestLog;
|
|
327
327
|
const humanize = text => {
|
|
@@ -399,6 +399,8 @@ function storeRunId(runId) {
|
|
|
399
399
|
function readLatestRunId() {
|
|
400
400
|
try {
|
|
401
401
|
const filePath = path_1.default.join(os_1.default.tmpdir(), `testomatio.latest.run`);
|
|
402
|
+
if (!fs_1.default.existsSync(filePath))
|
|
403
|
+
return null;
|
|
402
404
|
const stats = fs_1.default.statSync(filePath);
|
|
403
405
|
const diff = +new Date() - +stats.mtime;
|
|
404
406
|
const diffHours = diff / 1000 / 60 / 60;
|
package/package.json
CHANGED
package/src/adapter/codecept.js
CHANGED
|
@@ -25,6 +25,9 @@ const HOOK_EXECUTION_ORDER = {
|
|
|
25
25
|
POST_TEST: ['AfterHook', 'AfterSuiteHook']
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
+
// codeceptjs workers are self-contained
|
|
29
|
+
dataStorage.isFileStorage = false;
|
|
30
|
+
|
|
28
31
|
const DATA_REGEXP = /[|\s]+?(\{".*\}|\[.*\])/;
|
|
29
32
|
|
|
30
33
|
if (MAJOR_VERSION < 3) {
|
|
@@ -54,8 +57,6 @@ function CodeceptReporter(config) {
|
|
|
54
57
|
say: output.say,
|
|
55
58
|
};
|
|
56
59
|
|
|
57
|
-
output.stepShift = 0;
|
|
58
|
-
|
|
59
60
|
output.debug = function(msg) {
|
|
60
61
|
originalOutput.debug(msg);
|
|
61
62
|
dataStorage.putData('log', repeat(this?.stepShift || 0) + pc.cyan(msg.toString()));
|
|
@@ -71,6 +72,7 @@ function CodeceptReporter(config) {
|
|
|
71
72
|
originalOutput.log(msg);
|
|
72
73
|
dataStorage.putData('log', repeat(this?.stepShift || 0) + pc.gray(msg));
|
|
73
74
|
};
|
|
75
|
+
output.stepShift = 0;
|
|
74
76
|
|
|
75
77
|
recorder.startUnlessRunning();
|
|
76
78
|
|
|
@@ -164,7 +166,7 @@ function CodeceptReporter(config) {
|
|
|
164
166
|
const manuallyAttachedArtifacts = services.artifacts.get(test.fullTitle());
|
|
165
167
|
const keyValues = services.keyValues.get(test.fullTitle());
|
|
166
168
|
const stepHierarchy = buildUnifiedStepHierarchy(test.steps, hookSteps);
|
|
167
|
-
const
|
|
169
|
+
const links = services.links.get(test.fullTitle());
|
|
168
170
|
|
|
169
171
|
services.setContext(null);
|
|
170
172
|
|
|
@@ -179,7 +181,7 @@ function CodeceptReporter(config) {
|
|
|
179
181
|
files,
|
|
180
182
|
steps: stepHierarchy, // Array of step objects per API schema
|
|
181
183
|
logs,
|
|
182
|
-
|
|
184
|
+
links,
|
|
183
185
|
manuallyAttachedArtifacts,
|
|
184
186
|
meta: { ...keyValues, ...test.meta },
|
|
185
187
|
});
|
|
@@ -113,6 +113,7 @@ class CucumberReporter extends Formatter {
|
|
|
113
113
|
const logs = services.logger.getLogs(testTitle).join('\n');
|
|
114
114
|
const artifacts = services.artifacts.get(testTitle);
|
|
115
115
|
const keyValues = services.keyValues.get(testTitle);
|
|
116
|
+
const links = services.links.get(testTitle);
|
|
116
117
|
|
|
117
118
|
this.client.addTestRun(status, {
|
|
118
119
|
// error: testCaseAttempt.worstTestStepResult.message,
|
|
@@ -123,6 +124,7 @@ class CucumberReporter extends Formatter {
|
|
|
123
124
|
.trim(),
|
|
124
125
|
example: { ...example },
|
|
125
126
|
logs,
|
|
127
|
+
links,
|
|
126
128
|
manuallyAttachedArtifacts: artifacts,
|
|
127
129
|
meta: keyValues,
|
|
128
130
|
title: scenario,
|
package/src/adapter/jest.js
CHANGED
|
@@ -59,6 +59,7 @@ export class JestReporter {
|
|
|
59
59
|
const logs = getTestLogs(result);
|
|
60
60
|
const artifacts = services.artifacts.get(result.fullName);
|
|
61
61
|
const keyValues = services.keyValues.get(result.fullName);
|
|
62
|
+
const links = services.links.get(result.fullName);
|
|
62
63
|
|
|
63
64
|
const deducedStatus = status === 'pending' ? 'skipped' : status;
|
|
64
65
|
// In jest if test is not matched with test name pattern it is considered as skipped.
|
|
@@ -72,6 +73,7 @@ export class JestReporter {
|
|
|
72
73
|
title,
|
|
73
74
|
time: duration,
|
|
74
75
|
logs,
|
|
76
|
+
links,
|
|
75
77
|
manuallyAttachedArtifacts: artifacts,
|
|
76
78
|
meta: keyValues,
|
|
77
79
|
});
|
package/src/adapter/mocha.js
CHANGED
|
@@ -61,6 +61,7 @@ function MochaReporter(runner, opts) {
|
|
|
61
61
|
const logs = getTestLogs(test);
|
|
62
62
|
const artifacts = services.artifacts.get(test.fullTitle());
|
|
63
63
|
const keyValues = services.keyValues.get(test.fullTitle());
|
|
64
|
+
const links = services.links.get(test.fullTitle());
|
|
64
65
|
|
|
65
66
|
client.addTestRun(STATUS.PASSED, {
|
|
66
67
|
test_id: testId,
|
|
@@ -72,6 +73,7 @@ function MochaReporter(runner, opts) {
|
|
|
72
73
|
logs,
|
|
73
74
|
manuallyAttachedArtifacts: artifacts,
|
|
74
75
|
meta: keyValues,
|
|
76
|
+
links,
|
|
75
77
|
});
|
|
76
78
|
});
|
|
77
79
|
|
|
@@ -79,6 +81,10 @@ function MochaReporter(runner, opts) {
|
|
|
79
81
|
skipped += 1;
|
|
80
82
|
console.log('skip: %s', test.fullTitle());
|
|
81
83
|
const testId = getTestomatIdFromTestTitle(test.title);
|
|
84
|
+
const artifacts = services.artifacts.get(test.fullTitle());
|
|
85
|
+
const keyValues = services.keyValues.get(test.fullTitle());
|
|
86
|
+
const links = services.links.get(test.fullTitle());
|
|
87
|
+
|
|
82
88
|
client.addTestRun(STATUS.SKIPPED, {
|
|
83
89
|
title: getTestName(test),
|
|
84
90
|
suite_title: getSuiteTitle(test),
|
|
@@ -86,6 +92,9 @@ function MochaReporter(runner, opts) {
|
|
|
86
92
|
file: getFile(test),
|
|
87
93
|
test_id: testId,
|
|
88
94
|
time: test.duration,
|
|
95
|
+
manuallyAttachedArtifacts: artifacts,
|
|
96
|
+
meta: keyValues,
|
|
97
|
+
links,
|
|
89
98
|
});
|
|
90
99
|
});
|
|
91
100
|
|
|
@@ -95,6 +104,9 @@ function MochaReporter(runner, opts) {
|
|
|
95
104
|
const testId = getTestomatIdFromTestTitle(test.title);
|
|
96
105
|
|
|
97
106
|
const logs = getTestLogs(test);
|
|
107
|
+
const artifacts = services.artifacts.get(test.fullTitle());
|
|
108
|
+
const keyValues = services.keyValues.get(test.fullTitle());
|
|
109
|
+
const links = services.links.get(test.fullTitle());
|
|
98
110
|
|
|
99
111
|
client.addTestRun(STATUS.FAILED, {
|
|
100
112
|
error: err,
|
|
@@ -105,6 +117,9 @@ function MochaReporter(runner, opts) {
|
|
|
105
117
|
code: process.env.TESTOMATIO_UPDATE_CODE ? test.body.toString() : '',
|
|
106
118
|
time: test.duration,
|
|
107
119
|
logs,
|
|
120
|
+
manuallyAttachedArtifacts: artifacts,
|
|
121
|
+
meta: keyValues,
|
|
122
|
+
links,
|
|
108
123
|
});
|
|
109
124
|
});
|
|
110
125
|
|
|
@@ -58,6 +58,7 @@ class PlaywrightReporter {
|
|
|
58
58
|
}
|
|
59
59
|
const manuallyAttachedArtifacts = services.artifacts.get(fullTestTitle);
|
|
60
60
|
const testMeta = services.keyValues.get(fullTestTitle);
|
|
61
|
+
const links = services.links.get(fullTestTitle);
|
|
61
62
|
const rid = test.id || test.testId || uuidv4();
|
|
62
63
|
|
|
63
64
|
/**
|
|
@@ -95,6 +96,7 @@ class PlaywrightReporter {
|
|
|
95
96
|
steps: steps.length ? steps : undefined,
|
|
96
97
|
time: duration,
|
|
97
98
|
logs,
|
|
99
|
+
links,
|
|
98
100
|
manuallyAttachedArtifacts,
|
|
99
101
|
meta: {
|
|
100
102
|
browser: project.browser,
|
package/src/adapter/webdriver.js
CHANGED
|
@@ -52,12 +52,10 @@ class WebdriverReporter extends WDIOReporter {
|
|
|
52
52
|
onTestEnd(test) {
|
|
53
53
|
test.suite = test.parent;
|
|
54
54
|
const logs = getTestLogs(test.fullTitle);
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
test.artifacts = services.artifacts.get(test.fullTitle);
|
|
56
|
+
test.meta = services.keyValues.get(test.fullTitle);
|
|
57
|
+
test.links = services.links.get(test.fullTitle);
|
|
58
58
|
test.logs = logs;
|
|
59
|
-
// test.artifacts = artifacts;
|
|
60
|
-
// test.meta = keyValues;
|
|
61
59
|
|
|
62
60
|
this._addTestPromises.push(this.addTest(test));
|
|
63
61
|
}
|
|
@@ -72,7 +70,7 @@ class WebdriverReporter extends WDIOReporter {
|
|
|
72
70
|
async addTest(test) {
|
|
73
71
|
if (!this.client) return;
|
|
74
72
|
|
|
75
|
-
const { title, _duration: duration, state, error, output } = test;
|
|
73
|
+
const { title, _duration: duration, state, error, output, links, artifacts, meta, logs } = test;
|
|
76
74
|
|
|
77
75
|
const testId = getTestomatIdFromTestTitle(title);
|
|
78
76
|
|
|
@@ -83,10 +81,11 @@ class WebdriverReporter extends WDIOReporter {
|
|
|
83
81
|
|
|
84
82
|
await this.client.addTestRun(state, {
|
|
85
83
|
rid: test.uid || '',
|
|
86
|
-
manuallyAttachedArtifacts:
|
|
84
|
+
manuallyAttachedArtifacts: artifacts,
|
|
87
85
|
error,
|
|
88
|
-
logs
|
|
89
|
-
meta
|
|
86
|
+
logs,
|
|
87
|
+
meta,
|
|
88
|
+
links,
|
|
90
89
|
title,
|
|
91
90
|
test_id: testId,
|
|
92
91
|
time: duration,
|