@testomatio/reporter 2.1.3-beta.3-multi-links → 2.2.2
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 +3 -3
- package/lib/adapter/mocha.js +14 -0
- package/lib/adapter/webdriver.js +8 -6
- package/lib/bin/cli.js +9 -6
- package/lib/bin/startTest.js +38 -91
- package/lib/client.d.ts +1 -2
- package/lib/client.js +8 -6
- package/lib/data-storage.d.ts +4 -4
- package/lib/data-storage.js +7 -8
- package/lib/pipe/testomatio.d.ts +0 -1
- package/lib/pipe/testomatio.js +4 -8
- package/lib/replay.js +1 -1
- package/lib/reporter-functions.d.ts +20 -7
- package/lib/reporter-functions.js +27 -35
- package/lib/reporter.d.ts +22 -20
- package/lib/reporter.js +9 -7
- package/lib/services/artifacts.d.ts +1 -1
- package/lib/services/index.d.ts +2 -2
- package/lib/services/index.js +2 -2
- package/lib/services/key-values.d.ts +1 -1
- package/lib/services/labels.d.ts +1 -1
- package/lib/services/labels.js +2 -2
- package/lib/services/logger.d.ts +1 -1
- package/lib/utils/utils.js +3 -1
- package/package.json +1 -1
- package/src/adapter/codecept.js +3 -4
- package/src/adapter/mocha.js +15 -0
- package/src/adapter/webdriver.js +9 -6
- package/src/bin/cli.js +9 -6
- package/src/bin/startTest.js +43 -114
- package/src/client.js +7 -6
- package/src/data-storage.js +7 -9
- package/src/pipe/testomatio.js +4 -7
- package/src/replay.js +1 -1
- package/src/reporter-functions.js +27 -37
- package/src/reporter.js +8 -6
- package/src/services/index.js +2 -2
- package/src/services/labels.js +2 -2
- 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)
|
|
@@ -45,43 +50,29 @@ function setKeyValue(keyValue, value = null) {
|
|
|
45
50
|
index_js_1.services.keyValues.put(keyValue);
|
|
46
51
|
}
|
|
47
52
|
/**
|
|
48
|
-
* Add
|
|
53
|
+
* Add label(s) 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|string[]|null} [value=null] - optional label value(s) (e.g. 'high', 'login') or array of values
|
|
56
|
+
* @returns {void}
|
|
51
57
|
*/
|
|
52
58
|
function setLabel(key, value = null) {
|
|
53
59
|
if (Array.isArray(value)) {
|
|
54
|
-
value.forEach(
|
|
60
|
+
value.forEach(val => setLabel(key, val));
|
|
55
61
|
return;
|
|
56
62
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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);
|
|
83
|
-
}
|
|
84
|
-
index_js_1.services.labels.put([labelString]);
|
|
63
|
+
const labelObject = value !== null && value !== undefined && value !== ''
|
|
64
|
+
? { label: `${key}:${value}` }
|
|
65
|
+
: { label: key };
|
|
66
|
+
index_js_1.services.links.put([labelObject]);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Add link(s) to the test report
|
|
70
|
+
* @param {...string} testIds - test IDs to link
|
|
71
|
+
* @returns {void}
|
|
72
|
+
*/
|
|
73
|
+
function linkTest(...testIds) {
|
|
74
|
+
const links = testIds.map(testId => ({ test: testId }));
|
|
75
|
+
index_js_1.services.links.put(links);
|
|
85
76
|
}
|
|
86
77
|
module.exports = {
|
|
87
78
|
artifact: saveArtifact,
|
|
@@ -89,4 +80,5 @@ module.exports = {
|
|
|
89
80
|
step: addStep,
|
|
90
81
|
keyValue: setKeyValue,
|
|
91
82
|
label: setLabel,
|
|
83
|
+
linkTest,
|
|
92
84
|
};
|
package/lib/reporter.d.ts
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
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
|
+
"__#14@#originalUserLogger": {
|
|
12
9
|
assert(condition?: boolean, ...data: any[]): void;
|
|
13
10
|
assert(value: any, message?: string, ...optionalParams: any[]): void;
|
|
14
11
|
clear(): void;
|
|
@@ -53,13 +50,13 @@ export const logger: {
|
|
|
53
50
|
profile(label?: string): void;
|
|
54
51
|
profileEnd(label?: string): void;
|
|
55
52
|
};
|
|
56
|
-
"__#
|
|
53
|
+
"__#14@#userLoggerWithOverridenMethods": any;
|
|
57
54
|
logLevel: string;
|
|
58
55
|
step(strings: any, ...values: any[]): void;
|
|
59
56
|
getLogs(context: string): string[];
|
|
60
|
-
"__#
|
|
57
|
+
"__#14@#stringifyLogs"(...args: any[]): string;
|
|
61
58
|
_templateLiteralLog(strings: any, ...args: any[]): void;
|
|
62
|
-
"__#
|
|
59
|
+
"__#14@#logWrapper"(argsArray: any, level: any): void;
|
|
63
60
|
assert(...args: any[]): void;
|
|
64
61
|
debug(...args: any[]): void;
|
|
65
62
|
error(...args: any[]): void;
|
|
@@ -75,17 +72,15 @@ 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 | string[] | null) => void;
|
|
80
|
+
export const linkTest: (...testIds: string[]) => void;
|
|
86
81
|
declare namespace _default {
|
|
87
82
|
let testomatioLogger: {
|
|
88
|
-
"__#
|
|
83
|
+
"__#14@#originalUserLogger": {
|
|
89
84
|
assert(condition?: boolean, ...data: any[]): void;
|
|
90
85
|
assert(value: any, message?: string, ...optionalParams: any[]): void;
|
|
91
86
|
clear(): void;
|
|
@@ -130,13 +125,13 @@ declare namespace _default {
|
|
|
130
125
|
profile(label?: string): void;
|
|
131
126
|
profileEnd(label?: string): void;
|
|
132
127
|
};
|
|
133
|
-
"__#
|
|
128
|
+
"__#14@#userLoggerWithOverridenMethods": any;
|
|
134
129
|
logLevel: string;
|
|
135
130
|
step(strings: any, ...values: any[]): void;
|
|
136
131
|
getLogs(context: string): string[];
|
|
137
|
-
"__#
|
|
132
|
+
"__#14@#stringifyLogs"(...args: any[]): string;
|
|
138
133
|
_templateLiteralLog(strings: any, ...args: any[]): void;
|
|
139
|
-
"__#
|
|
134
|
+
"__#14@#logWrapper"(argsArray: any, level: any): void;
|
|
140
135
|
assert(...args: any[]): void;
|
|
141
136
|
debug(...args: any[]): void;
|
|
142
137
|
error(...args: any[]): void;
|
|
@@ -159,7 +154,7 @@ declare namespace _default {
|
|
|
159
154
|
}, context?: any) => void;
|
|
160
155
|
let log: (...args: any[]) => void;
|
|
161
156
|
let logger: {
|
|
162
|
-
"__#
|
|
157
|
+
"__#14@#originalUserLogger": {
|
|
163
158
|
assert(condition?: boolean, ...data: any[]): void;
|
|
164
159
|
assert(value: any, message?: string, ...optionalParams: any[]): void;
|
|
165
160
|
clear(): void;
|
|
@@ -204,13 +199,13 @@ declare namespace _default {
|
|
|
204
199
|
profile(label?: string): void;
|
|
205
200
|
profileEnd(label?: string): void;
|
|
206
201
|
};
|
|
207
|
-
"__#
|
|
202
|
+
"__#14@#userLoggerWithOverridenMethods": any;
|
|
208
203
|
logLevel: string;
|
|
209
204
|
step(strings: any, ...values: any[]): void;
|
|
210
205
|
getLogs(context: string): string[];
|
|
211
|
-
"__#
|
|
206
|
+
"__#14@#stringifyLogs"(...args: any[]): string;
|
|
212
207
|
_templateLiteralLog(strings: any, ...args: any[]): void;
|
|
213
|
-
"__#
|
|
208
|
+
"__#14@#logWrapper"(argsArray: any, level: any): void;
|
|
214
209
|
assert(...args: any[]): void;
|
|
215
210
|
debug(...args: any[]): void;
|
|
216
211
|
error(...args: any[]): void;
|
|
@@ -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 | 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
package/lib/services/labels.js
CHANGED
|
@@ -27,7 +27,7 @@ class LabelStorage {
|
|
|
27
27
|
put(labels, context = null) {
|
|
28
28
|
if (!labels || !Array.isArray(labels))
|
|
29
29
|
return;
|
|
30
|
-
data_storage_js_1.dataStorage.putData('
|
|
30
|
+
data_storage_js_1.dataStorage.putData('links', labels, context);
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
33
|
* Returns labels array for the test
|
|
@@ -35,7 +35,7 @@ class LabelStorage {
|
|
|
35
35
|
* @returns {string[]} labels array, e.g. ['smoke', 'severity:high', 'feature:user_account']
|
|
36
36
|
*/
|
|
37
37
|
get(context = null) {
|
|
38
|
-
const labelsList = data_storage_js_1.dataStorage.getData('
|
|
38
|
+
const labelsList = data_storage_js_1.dataStorage.getData('links', context);
|
|
39
39
|
if (!labelsList || !labelsList?.length)
|
|
40
40
|
return [];
|
|
41
41
|
const allLabels = [];
|
package/lib/services/logger.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
|
@@ -54,8 +54,6 @@ function CodeceptReporter(config) {
|
|
|
54
54
|
say: output.say,
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
-
output.stepShift = 0;
|
|
58
|
-
|
|
59
57
|
output.debug = function(msg) {
|
|
60
58
|
originalOutput.debug(msg);
|
|
61
59
|
dataStorage.putData('log', repeat(this?.stepShift || 0) + pc.cyan(msg.toString()));
|
|
@@ -71,6 +69,7 @@ function CodeceptReporter(config) {
|
|
|
71
69
|
originalOutput.log(msg);
|
|
72
70
|
dataStorage.putData('log', repeat(this?.stepShift || 0) + pc.gray(msg));
|
|
73
71
|
};
|
|
72
|
+
output.stepShift = 0;
|
|
74
73
|
|
|
75
74
|
recorder.startUnlessRunning();
|
|
76
75
|
|
|
@@ -164,7 +163,7 @@ function CodeceptReporter(config) {
|
|
|
164
163
|
const manuallyAttachedArtifacts = services.artifacts.get(test.fullTitle());
|
|
165
164
|
const keyValues = services.keyValues.get(test.fullTitle());
|
|
166
165
|
const stepHierarchy = buildUnifiedStepHierarchy(test.steps, hookSteps);
|
|
167
|
-
const
|
|
166
|
+
const links = services.links.get(test.fullTitle());
|
|
168
167
|
|
|
169
168
|
services.setContext(null);
|
|
170
169
|
|
|
@@ -179,7 +178,7 @@ function CodeceptReporter(config) {
|
|
|
179
178
|
files,
|
|
180
179
|
steps: stepHierarchy, // Array of step objects per API schema
|
|
181
180
|
logs,
|
|
182
|
-
|
|
181
|
+
links,
|
|
183
182
|
manuallyAttachedArtifacts,
|
|
184
183
|
meta: { ...keyValues, ...test.meta },
|
|
185
184
|
});
|
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
|
|
package/src/adapter/webdriver.js
CHANGED
|
@@ -3,6 +3,7 @@ import TestomatClient from '../client.js';
|
|
|
3
3
|
import { getTestomatIdFromTestTitle, fileSystem } from '../utils/utils.js';
|
|
4
4
|
import { services } from '../services/index.js';
|
|
5
5
|
import { TESTOMAT_TMP_STORAGE_DIR } from '../constants.js';
|
|
6
|
+
import { stringToMD5Hash } from '../data-storage.js';
|
|
6
7
|
|
|
7
8
|
class WebdriverReporter extends WDIOReporter {
|
|
8
9
|
constructor(options) {
|
|
@@ -52,12 +53,12 @@ class WebdriverReporter extends WDIOReporter {
|
|
|
52
53
|
onTestEnd(test) {
|
|
53
54
|
test.suite = test.parent;
|
|
54
55
|
const logs = getTestLogs(test.fullTitle);
|
|
55
|
-
//
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
// still be under investigation
|
|
57
|
+
const artifacts = services.artifacts.get(test.fullTitle);
|
|
58
|
+
const keyValues = services.keyValues.get(test.fullTitle);
|
|
58
59
|
test.logs = logs;
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
test.artifacts = artifacts;
|
|
61
|
+
test.meta = keyValues;
|
|
61
62
|
|
|
62
63
|
this._addTestPromises.push(this.addTest(test));
|
|
63
64
|
}
|
|
@@ -81,8 +82,10 @@ class WebdriverReporter extends WDIOReporter {
|
|
|
81
82
|
.filter(el => el.endpoint === screenshotEndpoint && el.result && el.result.value)
|
|
82
83
|
.map(el => Buffer.from(el.result.value, 'base64'));
|
|
83
84
|
|
|
85
|
+
const rid = stringToMD5Hash(test.fullTitle);
|
|
86
|
+
|
|
84
87
|
await this.client.addTestRun(state, {
|
|
85
|
-
rid
|
|
88
|
+
rid,
|
|
86
89
|
manuallyAttachedArtifacts: test.artifacts,
|
|
87
90
|
error,
|
|
88
91
|
logs: test.logs,
|
package/src/bin/cli.js
CHANGED
|
@@ -85,7 +85,7 @@ program
|
|
|
85
85
|
return process.exit(255);
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
const client = new TestomatClient({ apiKey, title
|
|
88
|
+
const client = new TestomatClient({ apiKey, title });
|
|
89
89
|
|
|
90
90
|
if (opts.filter) {
|
|
91
91
|
const [pipe, ...optsArray] = opts.filter.split(':');
|
|
@@ -105,14 +105,17 @@ program
|
|
|
105
105
|
|
|
106
106
|
const runTests = async () => {
|
|
107
107
|
const testCmds = command.split(' ');
|
|
108
|
-
const cmd = spawn(testCmds[0], testCmds.slice(1), {
|
|
108
|
+
const cmd = spawn(testCmds[0], testCmds.slice(1), {
|
|
109
|
+
stdio: 'inherit',
|
|
110
|
+
env: { ...process.env, TESTOMATIO_PROCEED: 'true', runId: client.runId },
|
|
111
|
+
});
|
|
109
112
|
|
|
110
113
|
cmd.on('close', async code => {
|
|
111
114
|
const emoji = code === 0 ? '🟢' : '🔴';
|
|
112
115
|
console.log(APP_PREFIX, emoji, `Runner exited with ${pc.bold(code)}`);
|
|
113
116
|
if (apiKey) {
|
|
114
117
|
const status = code === 0 ? 'passed' : 'failed';
|
|
115
|
-
await client.updateRunStatus(status
|
|
118
|
+
await client.updateRunStatus(status);
|
|
116
119
|
}
|
|
117
120
|
process.exit(code);
|
|
118
121
|
});
|
|
@@ -310,13 +313,13 @@ program
|
|
|
310
313
|
const replayService = new Replay({
|
|
311
314
|
apiKey: config.TESTOMATIO,
|
|
312
315
|
dryRun: opts.dryRun,
|
|
313
|
-
onLog:
|
|
314
|
-
onError:
|
|
316
|
+
onLog: message => console.log(APP_PREFIX, message),
|
|
317
|
+
onError: message => console.error(APP_PREFIX, '⚠️ ', message),
|
|
315
318
|
onProgress: ({ current, total }) => {
|
|
316
319
|
if (current % 10 === 0 || current === total) {
|
|
317
320
|
console.log(APP_PREFIX, `📊 Progress: ${current}/${total} tests processed`);
|
|
318
321
|
}
|
|
319
|
-
}
|
|
322
|
+
},
|
|
320
323
|
});
|
|
321
324
|
|
|
322
325
|
const result = await replayService.replay(debugFile);
|