@testomatio/reporter 2.0.1-beta.5-timestamp → 2.0.1-beta.6
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/README.md +1 -0
- package/lib/adapter/codecept.d.ts +2 -0
- package/lib/adapter/codecept.js +293 -335
- package/lib/adapter/cucumber/current.d.ts +14 -0
- package/lib/adapter/cucumber/current.js +195 -203
- package/lib/adapter/cucumber/legacy.d.ts +0 -0
- package/lib/adapter/cucumber/legacy.js +130 -155
- package/lib/adapter/cucumber.d.ts +2 -0
- package/lib/adapter/cucumber.js +5 -16
- package/lib/adapter/cypress-plugin/index.d.ts +2 -0
- package/lib/adapter/cypress-plugin/index.js +91 -105
- package/lib/adapter/jasmine.d.ts +11 -0
- package/lib/adapter/jasmine.js +54 -53
- package/lib/adapter/jest.d.ts +13 -0
- package/lib/adapter/jest.js +97 -99
- package/lib/adapter/mocha.d.ts +2 -0
- package/lib/adapter/mocha.js +112 -141
- package/lib/adapter/nightwatch.d.ts +4 -0
- package/lib/adapter/nightwatch.js +80 -0
- package/lib/adapter/playwright.d.ts +14 -0
- package/lib/adapter/playwright.js +199 -231
- package/lib/adapter/vitest.d.ts +35 -0
- package/lib/adapter/vitest.js +150 -149
- package/lib/adapter/webdriver.d.ts +24 -0
- package/lib/adapter/webdriver.js +144 -121
- package/lib/bin/cli.d.ts +2 -0
- package/lib/bin/cli.js +229 -211
- package/lib/bin/reportXml.d.ts +2 -0
- package/lib/bin/reportXml.js +51 -52
- package/lib/bin/startTest.d.ts +2 -0
- package/lib/bin/startTest.js +83 -95
- package/lib/bin/uploadArtifacts.d.ts +2 -0
- package/lib/bin/uploadArtifacts.js +56 -61
- package/lib/client.d.ts +76 -0
- package/lib/client.js +429 -465
- package/lib/config.d.ts +1 -0
- package/lib/config.js +18 -23
- package/lib/constants.d.ts +25 -0
- package/lib/constants.js +50 -44
- package/lib/data-storage.d.ts +34 -0
- package/lib/data-storage.js +216 -188
- package/lib/junit-adapter/adapter.d.ts +9 -0
- package/lib/junit-adapter/adapter.js +17 -20
- package/lib/junit-adapter/csharp.d.ts +5 -0
- package/lib/junit-adapter/csharp.js +28 -14
- package/lib/junit-adapter/index.d.ts +3 -0
- package/lib/junit-adapter/index.js +27 -25
- package/lib/junit-adapter/java.d.ts +5 -0
- package/lib/junit-adapter/java.js +41 -53
- package/lib/junit-adapter/javascript.d.ts +4 -0
- package/lib/junit-adapter/javascript.js +30 -27
- package/lib/junit-adapter/python.d.ts +5 -0
- package/lib/junit-adapter/python.js +38 -37
- package/lib/junit-adapter/ruby.d.ts +4 -0
- package/lib/junit-adapter/ruby.js +11 -8
- package/lib/output.d.ts +11 -0
- package/lib/output.js +44 -52
- package/lib/package.json +3 -0
- package/lib/pipe/bitbucket.d.ts +25 -0
- package/lib/pipe/bitbucket.js +223 -230
- package/lib/pipe/csv.d.ts +47 -0
- package/lib/pipe/csv.js +113 -126
- package/lib/pipe/debug.d.ts +29 -0
- package/lib/pipe/debug.js +125 -99
- package/lib/pipe/github.d.ts +30 -0
- package/lib/pipe/github.js +218 -213
- package/lib/pipe/gitlab.d.ts +25 -0
- package/lib/pipe/gitlab.js +183 -206
- package/lib/pipe/html.d.ts +35 -0
- package/lib/pipe/html.js +258 -321
- package/lib/pipe/index.d.ts +1 -0
- package/lib/pipe/index.js +94 -66
- package/lib/pipe/testomatio.d.ts +71 -0
- package/lib/pipe/testomatio.js +429 -474
- package/lib/replay.d.ts +31 -0
- package/lib/replay.js +255 -0
- package/lib/reporter-functions.d.ts +34 -0
- package/lib/reporter-functions.js +28 -26
- package/lib/reporter.d.ts +232 -0
- package/lib/reporter.js +34 -29
- package/lib/services/artifacts.d.ts +33 -0
- package/lib/services/artifacts.js +55 -51
- package/lib/services/index.d.ts +9 -0
- package/lib/services/index.js +14 -12
- package/lib/services/key-values.d.ts +27 -0
- package/lib/services/key-values.js +56 -53
- package/lib/services/logger.d.ts +64 -0
- package/lib/services/logger.js +226 -245
- package/lib/template/testomatio.hbs +1026 -1366
- package/lib/uploader.d.ts +60 -0
- package/lib/uploader.js +295 -364
- package/lib/utils/pipe_utils.d.ts +41 -0
- package/lib/utils/pipe_utils.js +89 -85
- package/lib/utils/utils.d.ts +54 -0
- package/lib/utils/utils.js +398 -307
- package/lib/xmlReader.d.ts +92 -0
- package/lib/xmlReader.js +525 -532
- package/package.json +64 -21
- package/src/adapter/codecept.js +373 -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/nightwatch.js +88 -0
- package/src/adapter/playwright.js +254 -0
- package/src/adapter/vitest.js +183 -0
- package/src/adapter/webdriver.js +142 -0
- package/src/bin/cli.js +348 -0
- package/src/bin/reportXml.js +77 -0
- package/src/bin/startTest.js +124 -0
- package/src/bin/uploadArtifacts.js +91 -0
- package/src/client.js +515 -0
- package/src/config.js +30 -0
- package/src/constants.js +53 -0
- package/src/data-storage.js +204 -0
- package/src/junit-adapter/adapter.js +23 -0
- package/src/junit-adapter/csharp.js +28 -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 +252 -0
- package/src/pipe/csv.js +140 -0
- package/src/pipe/debug.js +125 -0
- package/src/pipe/github.js +232 -0
- package/src/pipe/gitlab.js +247 -0
- package/src/pipe/html.js +373 -0
- package/src/pipe/index.js +71 -0
- package/src/pipe/testomatio.js +504 -0
- package/src/replay.js +262 -0
- package/src/reporter-functions.js +55 -0
- package/src/reporter.cjs_decprecated +21 -0
- package/src/reporter.js +33 -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 +315 -0
- package/src/template/emptyData.svg +23 -0
- package/src/template/testomatio.hbs +1081 -0
- package/src/uploader.js +376 -0
- package/src/utils/pipe_utils.js +119 -0
- package/src/utils/utils.js +416 -0
- package/src/xmlReader.js +614 -0
package/lib/replay.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export class Replay {
|
|
2
|
+
constructor(options?: {});
|
|
3
|
+
apiKey: any;
|
|
4
|
+
dryRun: any;
|
|
5
|
+
onProgress: any;
|
|
6
|
+
onLog: any;
|
|
7
|
+
onError: any;
|
|
8
|
+
/**
|
|
9
|
+
* Get the default debug file path
|
|
10
|
+
* @returns {string} Path to the latest debug file
|
|
11
|
+
*/
|
|
12
|
+
getDefaultDebugFile(): string;
|
|
13
|
+
/**
|
|
14
|
+
* Parse a debug file and extract test data
|
|
15
|
+
* @param {string} debugFile - Path to the debug file
|
|
16
|
+
* @returns {Object} Parsed debug data
|
|
17
|
+
*/
|
|
18
|
+
parseDebugFile(debugFile: string): any;
|
|
19
|
+
/**
|
|
20
|
+
* Restore environment variables from debug data
|
|
21
|
+
* @param {Object} envVars - Environment variables to restore
|
|
22
|
+
*/
|
|
23
|
+
restoreEnvironmentVariables(envVars: any): void;
|
|
24
|
+
/**
|
|
25
|
+
* Replay test data to Testomat.io
|
|
26
|
+
* @param {string} debugFile - Path to debug file (optional, uses default if not provided)
|
|
27
|
+
* @returns {Promise<Object>} Replay results
|
|
28
|
+
*/
|
|
29
|
+
replay(debugFile: string): Promise<any>;
|
|
30
|
+
}
|
|
31
|
+
export default Replay;
|
package/lib/replay.js
ADDED
|
@@ -0,0 +1,255 @@
|
|
|
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.Replay = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const os_1 = __importDefault(require("os"));
|
|
10
|
+
const client_js_1 = __importDefault(require("./client.js"));
|
|
11
|
+
const constants_js_1 = require("./constants.js");
|
|
12
|
+
const config_js_1 = require("./config.js");
|
|
13
|
+
class Replay {
|
|
14
|
+
constructor(options = {}) {
|
|
15
|
+
this.apiKey = options.apiKey || config_js_1.config.TESTOMATIO || undefined;
|
|
16
|
+
this.dryRun = options.dryRun || false;
|
|
17
|
+
this.onProgress = options.onProgress || (() => { });
|
|
18
|
+
this.onLog = options.onLog || console.log;
|
|
19
|
+
this.onError = options.onError || console.error;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Get the default debug file path
|
|
23
|
+
* @returns {string} Path to the latest debug file
|
|
24
|
+
*/
|
|
25
|
+
getDefaultDebugFile() {
|
|
26
|
+
return path_1.default.join(os_1.default.tmpdir(), 'testomatio.debug.latest.json');
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Parse a debug file and extract test data
|
|
30
|
+
* @param {string} debugFile - Path to the debug file
|
|
31
|
+
* @returns {Object} Parsed debug data
|
|
32
|
+
*/
|
|
33
|
+
parseDebugFile(debugFile) {
|
|
34
|
+
if (!fs_1.default.existsSync(debugFile)) {
|
|
35
|
+
throw new Error(`Debug file not found: ${debugFile}`);
|
|
36
|
+
}
|
|
37
|
+
const fileContent = fs_1.default.readFileSync(debugFile, 'utf-8');
|
|
38
|
+
const lines = fileContent.trim().split('\n').filter(line => line.trim() !== '');
|
|
39
|
+
if (lines.length === 0) {
|
|
40
|
+
throw new Error('Debug file is empty');
|
|
41
|
+
}
|
|
42
|
+
let runParams = {};
|
|
43
|
+
let finishParams = {};
|
|
44
|
+
let parseErrors = 0;
|
|
45
|
+
const testsMap = new Map(); // Use Map to deduplicate by rid
|
|
46
|
+
const testsWithoutRid = []; // For tests without rid (backward compatibility)
|
|
47
|
+
const envVars = {};
|
|
48
|
+
let runId = null;
|
|
49
|
+
// Parse debug file line by line
|
|
50
|
+
for (const [lineIndex, line] of lines.entries()) {
|
|
51
|
+
try {
|
|
52
|
+
const logEntry = JSON.parse(line);
|
|
53
|
+
if (logEntry.data === 'variables' && logEntry.testomatioEnvVars) {
|
|
54
|
+
Object.assign(envVars, logEntry.testomatioEnvVars);
|
|
55
|
+
}
|
|
56
|
+
else if (logEntry.action === 'createRun') {
|
|
57
|
+
runParams = logEntry.params || {};
|
|
58
|
+
}
|
|
59
|
+
else if (logEntry.action === 'addTestsBatch' && logEntry.tests) {
|
|
60
|
+
// Extract runId if available
|
|
61
|
+
if (logEntry.runId && !runId) {
|
|
62
|
+
runId = logEntry.runId;
|
|
63
|
+
}
|
|
64
|
+
// Process each test in the batch
|
|
65
|
+
for (const test of logEntry.tests) {
|
|
66
|
+
if (test.rid) {
|
|
67
|
+
// Handle tests with rid (deduplicate)
|
|
68
|
+
const existingTest = testsMap.get(test.rid);
|
|
69
|
+
if (existingTest) {
|
|
70
|
+
// Merge test data - prioritize non-null/non-empty values
|
|
71
|
+
const mergedTest = { ...existingTest };
|
|
72
|
+
Object.keys(test).forEach(key => {
|
|
73
|
+
if (test[key] !== null && test[key] !== undefined) {
|
|
74
|
+
if (key === 'files' && Array.isArray(test[key]) && test[key].length > 0) {
|
|
75
|
+
// Merge files arrays
|
|
76
|
+
mergedTest.files = [...(existingTest.files || []), ...test[key]];
|
|
77
|
+
}
|
|
78
|
+
else if (key === 'artifacts' && Array.isArray(test[key]) && test[key].length > 0) {
|
|
79
|
+
// Merge artifacts arrays
|
|
80
|
+
mergedTest.artifacts = [...(existingTest.artifacts || []), ...test[key]];
|
|
81
|
+
}
|
|
82
|
+
else if (existingTest[key] === null || existingTest[key] === undefined ||
|
|
83
|
+
(Array.isArray(existingTest[key]) && existingTest[key].length === 0)) {
|
|
84
|
+
// Use new value if existing is null/undefined/empty array
|
|
85
|
+
mergedTest[key] = test[key];
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
testsMap.set(test.rid, mergedTest);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
testsMap.set(test.rid, { ...test });
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
// Handle tests without rid (no deduplication)
|
|
97
|
+
testsWithoutRid.push({ ...test });
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
else if (logEntry.action === 'addTest' && logEntry.testId) {
|
|
102
|
+
// Extract runId if available
|
|
103
|
+
if (logEntry.runId && !runId) {
|
|
104
|
+
runId = logEntry.runId;
|
|
105
|
+
}
|
|
106
|
+
const test = logEntry.testId;
|
|
107
|
+
if (test.rid) {
|
|
108
|
+
// Handle tests with rid (deduplicate)
|
|
109
|
+
const existingTest = testsMap.get(test.rid);
|
|
110
|
+
if (existingTest) {
|
|
111
|
+
// Merge with existing test
|
|
112
|
+
const mergedTest = { ...existingTest, ...test };
|
|
113
|
+
testsMap.set(test.rid, mergedTest);
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
testsMap.set(test.rid, { ...test });
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
// Handle tests without rid (no deduplication)
|
|
121
|
+
testsWithoutRid.push({ ...test });
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
else if (logEntry.actions === 'finishRun') {
|
|
125
|
+
finishParams = logEntry.params || {};
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
catch (err) {
|
|
129
|
+
parseErrors++;
|
|
130
|
+
if (parseErrors <= 3) {
|
|
131
|
+
// Only show first 3 parse errors
|
|
132
|
+
this.onError(`Failed to parse line ${lineIndex + 1}: ${line.substring(0, 100)}...`);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
if (parseErrors > 3) {
|
|
137
|
+
this.onError(`${parseErrors - 3} more parse errors occurred`);
|
|
138
|
+
}
|
|
139
|
+
// Combine tests with rid and tests without rid
|
|
140
|
+
const allTests = [...Array.from(testsMap.values()), ...testsWithoutRid];
|
|
141
|
+
return {
|
|
142
|
+
runParams,
|
|
143
|
+
finishParams,
|
|
144
|
+
tests: allTests,
|
|
145
|
+
envVars,
|
|
146
|
+
parseErrors,
|
|
147
|
+
totalLines: lines.length,
|
|
148
|
+
runId
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Restore environment variables from debug data
|
|
153
|
+
* @param {Object} envVars - Environment variables to restore
|
|
154
|
+
*/
|
|
155
|
+
restoreEnvironmentVariables(envVars) {
|
|
156
|
+
// Only restore env vars that aren't already set (don't override current values)
|
|
157
|
+
Object.keys(envVars).forEach(key => {
|
|
158
|
+
if (process.env[key] === undefined || process.env[key] === '') {
|
|
159
|
+
process.env[key] = envVars[key];
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Replay test data to Testomat.io
|
|
165
|
+
* @param {string} debugFile - Path to debug file (optional, uses default if not provided)
|
|
166
|
+
* @returns {Promise<Object>} Replay results
|
|
167
|
+
*/
|
|
168
|
+
async replay(debugFile) {
|
|
169
|
+
if (!debugFile) {
|
|
170
|
+
debugFile = this.getDefaultDebugFile();
|
|
171
|
+
}
|
|
172
|
+
if (!this.apiKey) {
|
|
173
|
+
throw new Error('TESTOMATIO API key not found. Set TESTOMATIO environment variable.');
|
|
174
|
+
}
|
|
175
|
+
this.onLog(`Replaying data from debug file: ${debugFile}`);
|
|
176
|
+
// Parse the debug file
|
|
177
|
+
const debugData = this.parseDebugFile(debugFile);
|
|
178
|
+
const { runParams, finishParams, tests, envVars, runId } = debugData;
|
|
179
|
+
this.onLog(`Found ${tests.length} tests to replay`);
|
|
180
|
+
if (tests.length === 0) {
|
|
181
|
+
throw new Error('No test data found in debug file');
|
|
182
|
+
}
|
|
183
|
+
// Restore environment variables
|
|
184
|
+
this.restoreEnvironmentVariables(envVars);
|
|
185
|
+
if (this.dryRun) {
|
|
186
|
+
return {
|
|
187
|
+
success: true,
|
|
188
|
+
testsCount: tests.length,
|
|
189
|
+
runParams,
|
|
190
|
+
finishParams,
|
|
191
|
+
envVars,
|
|
192
|
+
runId,
|
|
193
|
+
dryRun: true
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
// Create client and restore the run
|
|
197
|
+
const client = new client_js_1.default({
|
|
198
|
+
apiKey: this.apiKey,
|
|
199
|
+
isBatchEnabled: true,
|
|
200
|
+
...runParams,
|
|
201
|
+
});
|
|
202
|
+
// Use the stored runId if available, otherwise create a new run
|
|
203
|
+
if (runId) {
|
|
204
|
+
this.onLog(`Using existing run ID: ${runId}`);
|
|
205
|
+
client.runId = runId;
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
this.onLog('Publishing to run...');
|
|
209
|
+
await client.createRun(runParams);
|
|
210
|
+
}
|
|
211
|
+
// Send each test result
|
|
212
|
+
let successCount = 0;
|
|
213
|
+
let failureCount = 0;
|
|
214
|
+
for (const [index, test] of tests.entries()) {
|
|
215
|
+
try {
|
|
216
|
+
await client.addTestRun(test.status, test);
|
|
217
|
+
successCount++;
|
|
218
|
+
this.onProgress({
|
|
219
|
+
current: index + 1,
|
|
220
|
+
total: tests.length,
|
|
221
|
+
test,
|
|
222
|
+
success: true
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
catch (err) {
|
|
226
|
+
failureCount++;
|
|
227
|
+
this.onError(`Failed to send test ${index + 1}: ${err.message}`);
|
|
228
|
+
this.onProgress({
|
|
229
|
+
current: index + 1,
|
|
230
|
+
total: tests.length,
|
|
231
|
+
test,
|
|
232
|
+
success: false,
|
|
233
|
+
error: err.message
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
await client.updateRunStatus(finishParams.status || constants_js_1.STATUS.FINISHED, finishParams.parallel || false);
|
|
238
|
+
const result = {
|
|
239
|
+
success: true,
|
|
240
|
+
testsCount: tests.length,
|
|
241
|
+
successCount,
|
|
242
|
+
failureCount,
|
|
243
|
+
runParams,
|
|
244
|
+
finishParams,
|
|
245
|
+
envVars,
|
|
246
|
+
runId: runId || client.runId
|
|
247
|
+
};
|
|
248
|
+
this.onLog(`Successfully replayed ${successCount}/${tests.length} tests from debug file`);
|
|
249
|
+
return result;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
exports.Replay = Replay;
|
|
253
|
+
module.exports = Replay;
|
|
254
|
+
|
|
255
|
+
module.exports.Replay = Replay;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
export { saveArtifact as artifact };
|
|
3
|
+
export { logMessage as log };
|
|
4
|
+
export { addStep as step };
|
|
5
|
+
export { setKeyValue as keyValue };
|
|
6
|
+
}
|
|
7
|
+
export default _default;
|
|
8
|
+
/**
|
|
9
|
+
* Stores path to file as artifact and uploads it to the S3 storage
|
|
10
|
+
* @param {string | {path: string, type: string, name: string}} data - path to file or object with path, type and name
|
|
11
|
+
*/
|
|
12
|
+
declare function saveArtifact(data: string | {
|
|
13
|
+
path: string;
|
|
14
|
+
type: string;
|
|
15
|
+
name: string;
|
|
16
|
+
}, context?: any): void;
|
|
17
|
+
/**
|
|
18
|
+
* Attach log message(s) to the test report
|
|
19
|
+
* @param string
|
|
20
|
+
*/
|
|
21
|
+
declare function logMessage(...args: any[]): void;
|
|
22
|
+
/**
|
|
23
|
+
* Similar to "log" function but marks message in report as a step
|
|
24
|
+
* @param {string} message
|
|
25
|
+
*/
|
|
26
|
+
declare function addStep(message: string): void;
|
|
27
|
+
/**
|
|
28
|
+
* Add key-value pair(s) to the test report
|
|
29
|
+
* @param {{[key: string]: string} | string} keyValue object { key: value } (multiple props allowed) or key (string)
|
|
30
|
+
* @param {string?} value
|
|
31
|
+
*/
|
|
32
|
+
declare function setKeyValue(keyValue: {
|
|
33
|
+
[key: string]: string;
|
|
34
|
+
} | string, value?: string | null): void;
|
|
@@ -1,50 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
if (process.env.PLAYWRIGHT_TEST_BASE_URL) {
|
|
5
|
-
initPlaywrightForStorage();
|
|
6
|
-
}
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const index_js_1 = require("./services/index.js");
|
|
8
4
|
/**
|
|
9
5
|
* Stores path to file as artifact and uploads it to the S3 storage
|
|
10
6
|
* @param {string | {path: string, type: string, name: string}} data - path to file or object with path, type and name
|
|
11
7
|
*/
|
|
12
8
|
function saveArtifact(data, context = null) {
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
if (process.env.IS_PLAYWRIGHT)
|
|
10
|
+
throw new Error(`This function is not available in Playwright framework.
|
|
11
|
+
/Playwright supports artifacts out of the box`);
|
|
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
|
-
* @param
|
|
18
|
+
* @param string
|
|
20
19
|
*/
|
|
21
20
|
function logMessage(...args) {
|
|
22
|
-
|
|
21
|
+
if (process.env.IS_PLAYWRIGHT)
|
|
22
|
+
throw new Error('This function is not available in Playwright framework');
|
|
23
|
+
index_js_1.services.logger._templateLiteralLog(...args);
|
|
23
24
|
}
|
|
24
|
-
|
|
25
25
|
/**
|
|
26
26
|
* Similar to "log" function but marks message in report as a step
|
|
27
|
-
* @param {
|
|
27
|
+
* @param {string} message
|
|
28
28
|
*/
|
|
29
29
|
function addStep(message) {
|
|
30
|
-
|
|
30
|
+
if (process.env.IS_PLAYWRIGHT)
|
|
31
|
+
throw new Error('This function is not available in Playwright framework. Use playwright steps');
|
|
32
|
+
index_js_1.services.logger.step(message);
|
|
31
33
|
}
|
|
32
|
-
|
|
33
34
|
/**
|
|
34
35
|
* Add key-value pair(s) to the test report
|
|
35
|
-
* @param {
|
|
36
|
+
* @param {{[key: string]: string} | string} keyValue object { key: value } (multiple props allowed) or key (string)
|
|
36
37
|
* @param {string?} value
|
|
37
38
|
*/
|
|
38
39
|
function setKeyValue(keyValue, value = null) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
if (process.env.IS_PLAYWRIGHT)
|
|
41
|
+
throw new Error('This function is not available in Playwright framework. Use test tag instead.');
|
|
42
|
+
if (typeof keyValue === 'string') {
|
|
43
|
+
keyValue = { [keyValue]: value };
|
|
44
|
+
}
|
|
45
|
+
index_js_1.services.keyValues.put(keyValue);
|
|
43
46
|
}
|
|
44
|
-
|
|
45
47
|
module.exports = {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
artifact: saveArtifact,
|
|
49
|
+
log: logMessage,
|
|
50
|
+
step: addStep,
|
|
51
|
+
keyValue: setKeyValue,
|
|
50
52
|
};
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
export type artifact = typeof import("./reporter-functions.js");
|
|
2
|
+
export const artifact: (data: string | {
|
|
3
|
+
path: string;
|
|
4
|
+
type: string;
|
|
5
|
+
name: string;
|
|
6
|
+
}, context?: any) => void;
|
|
7
|
+
export type log = typeof import("./reporter-functions.js");
|
|
8
|
+
export const log: (...args: any[]) => void;
|
|
9
|
+
export type logger = typeof import("./services/index.js");
|
|
10
|
+
export const logger: {
|
|
11
|
+
"__#13@#originalUserLogger": {
|
|
12
|
+
assert(condition?: boolean, ...data: any[]): void;
|
|
13
|
+
assert(value: any, message?: string, ...optionalParams: any[]): void;
|
|
14
|
+
clear(): void;
|
|
15
|
+
clear(): void;
|
|
16
|
+
count(label?: string): void;
|
|
17
|
+
count(label?: string): void;
|
|
18
|
+
countReset(label?: string): void;
|
|
19
|
+
countReset(label?: string): void;
|
|
20
|
+
debug(...data: any[]): void;
|
|
21
|
+
debug(message?: any, ...optionalParams: any[]): void;
|
|
22
|
+
dir(item?: any, options?: any): void;
|
|
23
|
+
dir(obj: any, options?: import("util").InspectOptions): void;
|
|
24
|
+
dirxml(...data: any[]): void;
|
|
25
|
+
dirxml(...data: any[]): void;
|
|
26
|
+
error(...data: any[]): void;
|
|
27
|
+
error(message?: any, ...optionalParams: any[]): void;
|
|
28
|
+
group(...data: any[]): void;
|
|
29
|
+
group(...label: any[]): void;
|
|
30
|
+
groupCollapsed(...data: any[]): void;
|
|
31
|
+
groupCollapsed(...label: any[]): void;
|
|
32
|
+
groupEnd(): void;
|
|
33
|
+
groupEnd(): void;
|
|
34
|
+
info(...data: any[]): void;
|
|
35
|
+
info(message?: any, ...optionalParams: any[]): void;
|
|
36
|
+
log(...data: any[]): void;
|
|
37
|
+
log(message?: any, ...optionalParams: any[]): void;
|
|
38
|
+
table(tabularData?: any, properties?: string[]): void;
|
|
39
|
+
table(tabularData: any, properties?: readonly string[]): void;
|
|
40
|
+
time(label?: string): void;
|
|
41
|
+
time(label?: string): void;
|
|
42
|
+
timeEnd(label?: string): void;
|
|
43
|
+
timeEnd(label?: string): void;
|
|
44
|
+
timeLog(label?: string, ...data: any[]): void;
|
|
45
|
+
timeLog(label?: string, ...data: any[]): void;
|
|
46
|
+
timeStamp(label?: string): void;
|
|
47
|
+
timeStamp(label?: string): void;
|
|
48
|
+
trace(...data: any[]): void;
|
|
49
|
+
trace(message?: any, ...optionalParams: any[]): void;
|
|
50
|
+
warn(...data: any[]): void;
|
|
51
|
+
warn(message?: any, ...optionalParams: any[]): void;
|
|
52
|
+
Console: console.ConsoleConstructor;
|
|
53
|
+
profile(label?: string): void;
|
|
54
|
+
profileEnd(label?: string): void;
|
|
55
|
+
};
|
|
56
|
+
"__#13@#userLoggerWithOverridenMethods": any;
|
|
57
|
+
logLevel: string;
|
|
58
|
+
step(strings: any, ...values: any[]): void;
|
|
59
|
+
getLogs(context: string): string[];
|
|
60
|
+
"__#13@#stringifyLogs"(...args: any[]): string;
|
|
61
|
+
_templateLiteralLog(strings: any, ...args: any[]): void;
|
|
62
|
+
"__#13@#logWrapper"(argsArray: any, level: any): void;
|
|
63
|
+
assert(...args: any[]): void;
|
|
64
|
+
debug(...args: any[]): void;
|
|
65
|
+
error(...args: any[]): void;
|
|
66
|
+
info(...args: any[]): void;
|
|
67
|
+
log(...args: any[]): void;
|
|
68
|
+
trace(...args: any[]): void;
|
|
69
|
+
warn(...args: any[]): void;
|
|
70
|
+
intercept(userLogger: any): void;
|
|
71
|
+
stopInterception(): void;
|
|
72
|
+
configure(config?: {
|
|
73
|
+
logLevel?: string;
|
|
74
|
+
prettyObjects?: boolean;
|
|
75
|
+
}): void;
|
|
76
|
+
prettyObjects: boolean;
|
|
77
|
+
};
|
|
78
|
+
export type meta = typeof import("./reporter-functions.js");
|
|
79
|
+
export const meta: (keyValue: {
|
|
80
|
+
[key: string]: string;
|
|
81
|
+
} | string, value?: string | null) => void;
|
|
82
|
+
export type step = typeof import("./reporter-functions.js");
|
|
83
|
+
export const step: (message: string) => void;
|
|
84
|
+
declare namespace _default {
|
|
85
|
+
let testomatioLogger: {
|
|
86
|
+
"__#13@#originalUserLogger": {
|
|
87
|
+
assert(condition?: boolean, ...data: any[]): void;
|
|
88
|
+
assert(value: any, message?: string, ...optionalParams: any[]): void;
|
|
89
|
+
clear(): void;
|
|
90
|
+
clear(): void;
|
|
91
|
+
count(label?: string): void;
|
|
92
|
+
count(label?: string): void;
|
|
93
|
+
countReset(label?: string): void;
|
|
94
|
+
countReset(label?: string): void;
|
|
95
|
+
debug(...data: any[]): void;
|
|
96
|
+
debug(message?: any, ...optionalParams: any[]): void;
|
|
97
|
+
dir(item?: any, options?: any): void;
|
|
98
|
+
dir(obj: any, options?: import("util").InspectOptions): void;
|
|
99
|
+
dirxml(...data: any[]): void;
|
|
100
|
+
dirxml(...data: any[]): void;
|
|
101
|
+
error(...data: any[]): void;
|
|
102
|
+
error(message?: any, ...optionalParams: any[]): void;
|
|
103
|
+
group(...data: any[]): void;
|
|
104
|
+
group(...label: any[]): void;
|
|
105
|
+
groupCollapsed(...data: any[]): void;
|
|
106
|
+
groupCollapsed(...label: any[]): void;
|
|
107
|
+
groupEnd(): void;
|
|
108
|
+
groupEnd(): void;
|
|
109
|
+
info(...data: any[]): void;
|
|
110
|
+
info(message?: any, ...optionalParams: any[]): void;
|
|
111
|
+
log(...data: any[]): void;
|
|
112
|
+
log(message?: any, ...optionalParams: any[]): void;
|
|
113
|
+
table(tabularData?: any, properties?: string[]): void;
|
|
114
|
+
table(tabularData: any, properties?: readonly string[]): void;
|
|
115
|
+
time(label?: string): void;
|
|
116
|
+
time(label?: string): void;
|
|
117
|
+
timeEnd(label?: string): void;
|
|
118
|
+
timeEnd(label?: string): void;
|
|
119
|
+
timeLog(label?: string, ...data: any[]): void;
|
|
120
|
+
timeLog(label?: string, ...data: any[]): void;
|
|
121
|
+
timeStamp(label?: string): void;
|
|
122
|
+
timeStamp(label?: string): void;
|
|
123
|
+
trace(...data: any[]): void;
|
|
124
|
+
trace(message?: any, ...optionalParams: any[]): void;
|
|
125
|
+
warn(...data: any[]): void;
|
|
126
|
+
warn(message?: any, ...optionalParams: any[]): void;
|
|
127
|
+
Console: console.ConsoleConstructor;
|
|
128
|
+
profile(label?: string): void;
|
|
129
|
+
profileEnd(label?: string): void;
|
|
130
|
+
};
|
|
131
|
+
"__#13@#userLoggerWithOverridenMethods": any;
|
|
132
|
+
logLevel: string;
|
|
133
|
+
step(strings: any, ...values: any[]): void;
|
|
134
|
+
getLogs(context: string): string[];
|
|
135
|
+
"__#13@#stringifyLogs"(...args: any[]): string;
|
|
136
|
+
_templateLiteralLog(strings: any, ...args: any[]): void;
|
|
137
|
+
"__#13@#logWrapper"(argsArray: any, level: any): void;
|
|
138
|
+
assert(...args: any[]): void;
|
|
139
|
+
debug(...args: any[]): void;
|
|
140
|
+
error(...args: any[]): void;
|
|
141
|
+
info(...args: any[]): void;
|
|
142
|
+
log(...args: any[]): void;
|
|
143
|
+
trace(...args: any[]): void;
|
|
144
|
+
warn(...args: any[]): void;
|
|
145
|
+
intercept(userLogger: any): void;
|
|
146
|
+
stopInterception(): void;
|
|
147
|
+
configure(config?: {
|
|
148
|
+
logLevel?: string;
|
|
149
|
+
prettyObjects?: boolean;
|
|
150
|
+
}): void;
|
|
151
|
+
prettyObjects: boolean;
|
|
152
|
+
};
|
|
153
|
+
let artifact: (data: string | {
|
|
154
|
+
path: string;
|
|
155
|
+
type: string;
|
|
156
|
+
name: string;
|
|
157
|
+
}, context?: any) => void;
|
|
158
|
+
let log: (...args: any[]) => void;
|
|
159
|
+
let logger: {
|
|
160
|
+
"__#13@#originalUserLogger": {
|
|
161
|
+
assert(condition?: boolean, ...data: any[]): void;
|
|
162
|
+
assert(value: any, message?: string, ...optionalParams: any[]): void;
|
|
163
|
+
clear(): void;
|
|
164
|
+
clear(): void;
|
|
165
|
+
count(label?: string): void;
|
|
166
|
+
count(label?: string): void;
|
|
167
|
+
countReset(label?: string): void;
|
|
168
|
+
countReset(label?: string): void;
|
|
169
|
+
debug(...data: any[]): void;
|
|
170
|
+
debug(message?: any, ...optionalParams: any[]): void;
|
|
171
|
+
dir(item?: any, options?: any): void;
|
|
172
|
+
dir(obj: any, options?: import("util").InspectOptions): void;
|
|
173
|
+
dirxml(...data: any[]): void;
|
|
174
|
+
dirxml(...data: any[]): void;
|
|
175
|
+
error(...data: any[]): void;
|
|
176
|
+
error(message?: any, ...optionalParams: any[]): void;
|
|
177
|
+
group(...data: any[]): void;
|
|
178
|
+
group(...label: any[]): void;
|
|
179
|
+
groupCollapsed(...data: any[]): void;
|
|
180
|
+
groupCollapsed(...label: any[]): void;
|
|
181
|
+
groupEnd(): void;
|
|
182
|
+
groupEnd(): void;
|
|
183
|
+
info(...data: any[]): void;
|
|
184
|
+
info(message?: any, ...optionalParams: any[]): void;
|
|
185
|
+
log(...data: any[]): void;
|
|
186
|
+
log(message?: any, ...optionalParams: any[]): void;
|
|
187
|
+
table(tabularData?: any, properties?: string[]): void;
|
|
188
|
+
table(tabularData: any, properties?: readonly string[]): void;
|
|
189
|
+
time(label?: string): void;
|
|
190
|
+
time(label?: string): void;
|
|
191
|
+
timeEnd(label?: string): void;
|
|
192
|
+
timeEnd(label?: string): void;
|
|
193
|
+
timeLog(label?: string, ...data: any[]): void;
|
|
194
|
+
timeLog(label?: string, ...data: any[]): void;
|
|
195
|
+
timeStamp(label?: string): void;
|
|
196
|
+
timeStamp(label?: string): void;
|
|
197
|
+
trace(...data: any[]): void;
|
|
198
|
+
trace(message?: any, ...optionalParams: any[]): void;
|
|
199
|
+
warn(...data: any[]): void;
|
|
200
|
+
warn(message?: any, ...optionalParams: any[]): void;
|
|
201
|
+
Console: console.ConsoleConstructor;
|
|
202
|
+
profile(label?: string): void;
|
|
203
|
+
profileEnd(label?: string): void;
|
|
204
|
+
};
|
|
205
|
+
"__#13@#userLoggerWithOverridenMethods": any;
|
|
206
|
+
logLevel: string;
|
|
207
|
+
step(strings: any, ...values: any[]): void;
|
|
208
|
+
getLogs(context: string): string[];
|
|
209
|
+
"__#13@#stringifyLogs"(...args: any[]): string;
|
|
210
|
+
_templateLiteralLog(strings: any, ...args: any[]): void;
|
|
211
|
+
"__#13@#logWrapper"(argsArray: any, level: any): void;
|
|
212
|
+
assert(...args: any[]): void;
|
|
213
|
+
debug(...args: any[]): void;
|
|
214
|
+
error(...args: any[]): void;
|
|
215
|
+
info(...args: any[]): void;
|
|
216
|
+
log(...args: any[]): void;
|
|
217
|
+
trace(...args: any[]): void;
|
|
218
|
+
warn(...args: any[]): void;
|
|
219
|
+
intercept(userLogger: any): void;
|
|
220
|
+
stopInterception(): void;
|
|
221
|
+
configure(config?: {
|
|
222
|
+
logLevel?: string;
|
|
223
|
+
prettyObjects?: boolean;
|
|
224
|
+
}): void;
|
|
225
|
+
prettyObjects: boolean;
|
|
226
|
+
};
|
|
227
|
+
let meta: (keyValue: {
|
|
228
|
+
[key: string]: string;
|
|
229
|
+
} | string, value?: string | null) => void;
|
|
230
|
+
let step: (message: string) => void;
|
|
231
|
+
}
|
|
232
|
+
export default _default;
|