@testomatio/reporter 1.0.11 → 1.0.12-beta.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/Changelog.md ADDED
@@ -0,0 +1,298 @@
1
+ <!-- pending release updates -->
2
+
3
+ # 1.0.10
4
+
5
+ * Added `TESTOMATIO_PUBLISH=1` variable to automatically publish run report
6
+
7
+ # 1.0.9
8
+
9
+ * Support XUnit format
10
+ * Improved support for parametrized Java tests
11
+
12
+ # 1.0.8
13
+
14
+ * Fixed `Can't read push of undefined` when logging steps
15
+
16
+ # 1.0.6
17
+
18
+ * Testomat.io. Auto-detect current build url and report it to Testomat.io. Manually url can be set with `BUILD_URL` variable:
19
+
20
+ ```
21
+ BUILD_URL=https://.... TESTOMATIO=apiKey <actual test command>
22
+ ```
23
+
24
+ # 1.0.5
25
+
26
+ * Fix "create tests" params processing for testomatio pipe
27
+
28
+ # 1.0.4
29
+
30
+ * Fixed parallel run
31
+
32
+ # 1.0.3
33
+
34
+ * Fixed reporting parallel runs
35
+
36
+ # 1.0.0
37
+
38
+
39
+ * Added [`TESTOMATIO_SHARED_RUN` option](https://github.com/testomatio/reporter/blob/master/docs/pipes.md#reporting-parallel-execution-to-to-same-run) to use a shared run for parallel executions
40
+ * Reworked [documentation](https://github.com/testomatio/reporter/tree/master#readme).
41
+ * Added an option to obtain [S3 configuration](https://github.com/testomatio/reporter/blob/master/docs/artifacts.md#configuration) from Testomat.io
42
+ * Introduced [pipes](https://github.com/testomatio/reporter/blob/master/docs/pipes.md):
43
+ * GitHub
44
+ * GitLab
45
+ * CSV Pipe
46
+
47
+
48
+ # 0.7.6
49
+
50
+ * Updated to use AWS S3 3.0 SDK for uploading
51
+
52
+ # 0.7.5
53
+
54
+ * Fixed reporting skipped tests in mocha
55
+
56
+ # 0.7.4
57
+
58
+ * Fixed parsing source code in JUnit files
59
+
60
+ # 0.7.3
61
+
62
+ * CodeceptJS: Upload all traces and videos from artifacts
63
+ * Fixed reporting skipped test in XML
64
+ * added `--timelimit` option to `report-xml` command line
65
+
66
+ # 0.7.2
67
+
68
+ * Fixed uploading non-existing file
69
+
70
+ # 0.7.1
71
+
72
+ * Support for NUnit XML v3 format
73
+
74
+ # 0.7.0
75
+
76
+ * Support for `@cucumber/cucumber` (>= 7.0) added
77
+ * Initial support for C# and NUnit
78
+
79
+ # 0.6.10
80
+
81
+ * Fixed uploading multilpe artifacts in Playwright
82
+
83
+ # 0.6.9
84
+
85
+ * Fixed pending tests reports for Cypress
86
+
87
+ # 0.6.8
88
+ # 0.6.7
89
+
90
+ * Pytest: fixed creating suites from reports
91
+
92
+ # 0.6.6
93
+
94
+ * JUnit reporter: prefer suite title over testcase classname in a report
95
+
96
+ # 0.6.5
97
+
98
+ * Fixed test statuses for runs in JUnit reporter
99
+
100
+ # 0.6.4
101
+
102
+ * Added `TESTOMATIO_PROCEED=1` param to not close current run
103
+ * Fixed priority of commands from `npx @testomatio/reporter`
104
+
105
+ # 0.6.3
106
+
107
+ * Fixed `npx start-test-run` to launch commands
108
+
109
+ # 0.6.2
110
+
111
+ * Added `--env-file` option to load env variables from env file
112
+
113
+ # 0.6.1
114
+
115
+ * Fixed creating RunGroup with JUnit reporter
116
+
117
+ # 0.6.0
118
+
119
+ * JUnit reporter support
120
+
121
+ # 0.5.10
122
+
123
+ * Fixed reporting Scenario Outline in Cypress-Cucumber
124
+ * Fixed error reports for Cypress when running in Chrome
125
+
126
+ # 0.5.9
127
+
128
+ * Added environment on Cypress report
129
+
130
+ # 0.5.8
131
+
132
+ * Fixed Cypress.io reporting
133
+
134
+ # 0.5.7
135
+
136
+ * Fixed webdriverio artifacts
137
+
138
+ # 0.5.6
139
+
140
+ * Unmark failed CodeceptJS tests as skipped
141
+
142
+ # 0.5.5
143
+
144
+ * Fixed `BeforeSuite` failures in CodeceptJS
145
+
146
+ # 0.5.4
147
+
148
+ Added `TESTOMATIO_CREATE=1` option to create unmatched tests on report
149
+
150
+ ```
151
+ TESTOMATIO_CREATE=1 TESTOMATIO=apiKey npx codeceptjs run
152
+ ```
153
+
154
+ # 0.5.3
155
+
156
+ * Fixed parsing suites
157
+
158
+ # 0.5.2
159
+
160
+ * Fixed multiple upload of artifacts in Cypress.io
161
+
162
+ # 0.5.1
163
+
164
+ * Fixed Cypress.io to report tests inside nested suites
165
+
166
+ # 0.5.0
167
+
168
+ * Added Cypress.io plugin
169
+ * Added artifacts upload to webdriverio
170
+
171
+ # 0.4.6
172
+
173
+ - Fixed CodeceptJS reporter to report tests failed in hooks
174
+
175
+ # 0.4.5
176
+
177
+ - Fixed "Total XX artifacts publicly uploaded to S3 bucket" when no S3 bucket is configured
178
+ - Improved S3 connection error messages
179
+
180
+ # 0.4.4
181
+
182
+ - Fixed returning 0 exit code when a process fails when running tests in parallel via `start-test-run`. Previously was using the last exit code returned by a process. Currently prefers the highest exit code that was returned by a process.
183
+
184
+ # 0.4.3
185
+
186
+ - Added `TESTOMATIO_DISABLE_ARTIFACTS` env variable to disable publishing artifacts.
187
+
188
+ # 0.4.2
189
+
190
+ - print version of reporter
191
+ - print number of uploaded artifacts
192
+ - print access mode for uploaded artifacts
193
+
194
+ # 0.4.1
195
+
196
+ Added `global.testomatioArtifacts = []` array which can be used to add arbitrary artifacts to a report.
197
+
198
+ ```js
199
+ // inside a running test:
200
+ global.testomatioArtifacts.push('file/to/upload.png');
201
+ ```
202
+
203
+ # 0.4.0
204
+
205
+ - Playwright: Introduced playwright/test support with screenshots and video artifacts
206
+
207
+ > Known issues: reporting using projects configured in Playwright does not work yet
208
+
209
+ - CodeceptJS: added video uploads
210
+
211
+ # 0.3.16
212
+
213
+ - CodeceptJS: fixed reporting tests with empty steps (on retry)
214
+
215
+ # 0.3.15
216
+
217
+ - Finish Run via API:
218
+
219
+ ```
220
+ TESTOMATIO={apiKey} TESTOMATIO_RUN={runId} npx @testomatio/reporter@latest --finish
221
+ ```
222
+
223
+ # 0.3.14
224
+
225
+ - Create an empty Run via API:
226
+
227
+ ```
228
+ TESTOMATIO={apiKey} npx @testomatio/reporter@latest --launch
229
+ ```
230
+
231
+ # 0.3.13
232
+
233
+ - Checking for a valid report URL
234
+ - Sending unlimited data on test report
235
+
236
+ # 0.3.12
237
+
238
+ - Fixed submitting arbitrary data on a test run
239
+ - Jest: fixed sending errors with stack traces
240
+ - Cypress: fixed sending reports
241
+
242
+ # 0.3.11
243
+
244
+ - Fixed circular JSON reference when submitting data to Testomatio
245
+
246
+ # 0.3.10
247
+
248
+ - Minor fixes
249
+
250
+ # 0.3.9
251
+
252
+ - Making all reporters to run without API key
253
+
254
+ # 0.3.8
255
+
256
+ - Fixed `npx start-test-run` to work with empty API keys
257
+
258
+ # 0.3.7
259
+
260
+ - Fixed release
261
+
262
+ # 0.3.6
263
+
264
+ - Update title and rungroup on start for scheduled runs.
265
+
266
+ # 0.3.5
267
+
268
+ - Added `TESTOMATIO_RUN` environment variable to pass id of a specific run to report
269
+
270
+ # 0.3.4
271
+
272
+ - Minor fixes
273
+
274
+ # 0.3.3
275
+
276
+ - [CodeceptJS] Fixed stack trace reporting
277
+ - [CodeceptJS] Fixed displaying of nested steps
278
+ - [CodeceptJS][mocha] Added assertion diff to report
279
+
280
+ # 0.3.2
281
+
282
+ - Fixed error message for S3 uploading
283
+
284
+ # 0.3.1
285
+
286
+ - [CodeceptJS] Better formatter for nested structures and BDD tests
287
+
288
+ # 0.3.0
289
+
290
+ - Added `TESTOMATIO_TITLE` env variable to set a name for Run
291
+ - Added `TESTOMATIO_RUNGROUP_TITLE` env variable to attach Run to RunGroup
292
+ - Added `TESTOMATIO_ENV` env variable to attach additional env values to report
293
+ - [CodeceptJS] **CodeceptJS v3 support**
294
+ - [CodeceptJS] Dropped support for CodeceptJS 2
295
+ - [CodeceptJS] Added support for before hooks
296
+ - [CodeceptJS] Log of steps
297
+ - [CodeceptJS] Upload screenshots of failed tests to S3
298
+ - [CodeceptJS] Updated to use with parallel execution
@@ -23,6 +23,7 @@ program
23
23
  }
24
24
  let { javaTests, lang } = opts;
25
25
  if (opts.envFile) {
26
+ console.log(APP_PREFIX, 'Loading env file:', opts.envFile);
26
27
  debug('Loading env file: %s', opts.envFile)
27
28
  require('dotenv').config({ path: opts.envFile }); // eslint-disable-line
28
29
  }
package/lib/client.js CHANGED
@@ -92,7 +92,7 @@ class Client {
92
92
  message = error?.message;
93
93
  }
94
94
  if (steps) {
95
- stack = this.formatSteps(stack, steps);
95
+ stack += this.formatSteps(stack, steps);
96
96
  }
97
97
 
98
98
  stack += testData.stack || '';
package/lib/util.js CHANGED
@@ -55,11 +55,21 @@ const isValidUrl = s => {
55
55
  }
56
56
  };
57
57
 
58
+ const fileMatchRegex = /file:(\/\/?[^:\s]+?\.(png|avi|webm|jpg|html|txt))/ig;
59
+
58
60
  const fetchFilesFromStackTrace = (stack = '') => {
59
- const files = stack.matchAll(/file:?\/(\/.*?\.(png|avi|webm|jpg|html|txt))/g);
60
- return Array.from(files)
61
- .map(f => f[1])
62
- .filter(f => fs.existsSync(f));
61
+
62
+ const files = Array.from(stack.matchAll(fileMatchRegex))
63
+ .map(f => f[1].trim())
64
+ .map(f => f.startsWith('//') ? f.substring(1) : f )
65
+
66
+ debug('Found files in stack trace: ', files);
67
+
68
+ return files.filter(f => {
69
+ const isFile = fs.existsSync(f);
70
+ if (!isFile) debug('File %s could not be found and uploaded as artifact', f);
71
+ return isFile;
72
+ });
63
73
  };
64
74
 
65
75
  const fetchSourceCodeFromStackTrace = (stack = '') => {
package/lib/xmlReader.js CHANGED
@@ -304,6 +304,10 @@ class XmlReader {
304
304
  if (file.endsWith('.ts')) this.stats.language = 'ts';
305
305
  }
306
306
 
307
+ if (!fs.existsSync(file)) {
308
+ debug('Failed to open file with the source code', file)
309
+ return;
310
+ }
307
311
  const contents = fs.readFileSync(file).toString();
308
312
  t.code = fetchSourceCode(contents, { ...t, lang: this.stats.language })
309
313
  } catch (err) {
@@ -349,7 +353,7 @@ class XmlReader {
349
353
  let files = [];
350
354
  if (test.files?.length) files = test.files.map(f => path.join(process.cwd(), f))
351
355
  files = [...files, ...fetchFilesFromStackTrace(test.stack)];
352
- debug('Uploading files', files)
356
+ console.log(APP_PREFIX, 'Uploading files', files)
353
357
  test.artifacts = await Promise.all(files.map(f => upload.uploadFileByPath(f, this.runId)));
354
358
  }
355
359
  }
@@ -360,8 +364,8 @@ class XmlReader {
360
364
  title: this.requestParams.title,
361
365
  env: this.requestParams.env,
362
366
  group_title: this.requestParams.group_title,
363
- };
364
-
367
+ };
368
+
365
369
  debug("Run", runParams);
366
370
 
367
371
  return Promise.all(this.pipes.map(p => p.createRun(runParams)));
@@ -402,6 +406,8 @@ function reduceTestCases(prev, item) {
402
406
  if (!Array.isArray(testCases)) {
403
407
  testCases = [testCases]
404
408
  }
409
+ const suiteOutput = item['system-out'] || item.output || item.log || '';
410
+ const suiteErr = item['system-err'] || item.output || item.log || '';
405
411
  testCases.filter(t => !!t).forEach(testCaseItem => {
406
412
  const file = testCaseItem.file || item.filepath || '';
407
413
 
@@ -418,7 +424,7 @@ function reduceTestCases(prev, item) {
418
424
  if (!message) message = stack.trim().split('\n')[0];
419
425
 
420
426
  // prepend system output
421
- stack = `${testCaseItem['system-out'] || testCaseItem.output || testCaseItem.log || ''}\n\n${stack}`.trim()
427
+ stack = `${testCaseItem['system-out'] || testCaseItem.output || testCaseItem.log || ''}\n\n${stack}\n\n${suiteOutput}\n\n${suiteErr}`.trim()
422
428
 
423
429
  let status = STATUS.PASSED.toString();
424
430
  if ('failure' in testCaseItem || 'error' in testCaseItem) status = STATUS.FAILED;
@@ -450,7 +456,7 @@ function processTestSuite(testsuite) {
450
456
  suites = [testsuite];
451
457
  }
452
458
 
453
- const res = suites.reduce(reduceTestCases, []);
459
+ const res = suites.reduce(reduceTestCases, []);
454
460
 
455
461
  return res;
456
462
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testomatio/reporter",
3
- "version": "1.0.11",
3
+ "version": "1.0.12-beta.2",
4
4
  "description": "Testomatio Reporter Client",
5
5
  "main": "./lib/reporter.js",
6
6
  "typings": "typings/index.d.ts",