@testomatio/reporter 1.1.0-beta.codeceptjs-before-suite-logs → 1.1.0-beta.cypress-trace-time

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.
@@ -78,35 +78,8 @@ function CodeceptReporter(config) {
78
78
  global.testomatioDataStore.steps = [];
79
79
  });
80
80
 
81
- let hookSteps = [];
82
- let suiteHookRunning = false;
83
-
84
- event.dispatcher.on(event.suite.before, (suite) => {
85
- suiteHookRunning = true;
86
- hookSteps = [];
87
- global.testomatioDataStore.steps = [];
88
- });
89
-
90
- event.dispatcher.on(event.test.before, () => {
91
- suiteHookRunning = false;
92
- global.testomatioDataStore.steps = []
93
- });
94
-
95
- event.dispatcher.on(event.hook.started, (suite) => {
96
- // global.testomatioDataStore.steps = [];
97
- });
98
-
99
- event.dispatcher.on(event.hook.passed, (suite) => {
100
- if (suiteHookRunning) hookSteps.push(...global.testomatioDataStore.steps);
101
- });
102
-
103
- event.dispatcher.on(event.hook.failed, (suite) => {
104
- if (suiteHookRunning) hookSteps.push(...global.testomatioDataStore.steps);
105
- });
106
-
107
81
  event.dispatcher.on(event.test.started, test => {
108
82
  testTimeMap[test.id] = Date.now();
109
-
110
83
  if (global.testomatioDataStore) global.testomatioDataStore.currentlyRunningTestId = getIdFromTestTitle(test.title);
111
84
  });
112
85
 
@@ -116,7 +89,7 @@ function CodeceptReporter(config) {
116
89
  await Promise.all(reportTestPromises);
117
90
 
118
91
  if (upload.isArtifactsEnabled()) {
119
- uploadAttachments(client, videos, '🎞️ Uploading', 'video');
92
+ uploadAttachments(client, videos, '🎞️ Uploading', 'video');
120
93
  uploadAttachments(client, traces, '📁 Uploading', 'trace');
121
94
  }
122
95
 
@@ -136,7 +109,7 @@ function CodeceptReporter(config) {
136
109
  suite_title: test.parent && test.parent.title,
137
110
  message: testObj.message,
138
111
  time: getDuration(test),
139
- steps: [...hookSteps, ...global.testomatioDataStore.steps].join('\n') || null,
112
+ steps: global.testomatioDataStore.steps.join('\n') || null,
140
113
  test_id: testId,
141
114
  });
142
115
  // output.stop();
@@ -160,7 +133,6 @@ function CodeceptReporter(config) {
160
133
  ...stripExampleFromTitle(title),
161
134
  suite_title: suite.title,
162
135
  test_id: testId,
163
- steps: hookSteps.join('\n') || null,
164
136
  error,
165
137
  time: 0,
166
138
  });
@@ -189,7 +161,7 @@ function CodeceptReporter(config) {
189
161
  message: testObj.message,
190
162
  time: getDuration(test),
191
163
  files,
192
- steps: [...hookSteps, ...global.testomatioDataStore.steps].join('\n') || null,
164
+ steps: global.testomatioDataStore?.steps?.join('\n') || null,
193
165
  })
194
166
  .then(pipes => {
195
167
  testId = pipes.filter(p => p.pipe.includes('Testomatio'))[0]?.result?.data?.test_id;
@@ -26,8 +26,9 @@ const testomatioReporter = on => {
26
26
  const lastAttemptIndex = test.attempts.length - 1;
27
27
  const latestAttempt = test.attempts[lastAttemptIndex];
28
28
 
29
- const time = latestAttempt.duration;
30
- const error = latestAttempt.error;
29
+ // latestAttempt.duration && latestAttempt.error were available in adapters version up to 13 JFYI
30
+ const time = latestAttempt.duration || latestAttempt.wallClockDuration || test.duration;
31
+ let error = latestAttempt.error;
31
32
 
32
33
  let title = test.title.pop();
33
34
  const examples = title.match(/\(example (#\d+)\)/);
@@ -40,15 +41,20 @@ const testomatioReporter = on => {
40
41
  const testId = parseTest(title);
41
42
  const suiteId = parseSuite(suiteTitle);
42
43
 
43
- if (error) {
44
+ if (!error && test.displayError) {
45
+ error = { message: test.displayError };
44
46
  error.inspect = function() { // eslint-disable-line func-names
45
- if (this && this.codeFrame) {
46
- return this.codeFrame.frame;
47
- }
48
- return '';
49
- }
47
+ return this.message;
48
+ };
50
49
  }
51
50
 
51
+ const formattedError = error
52
+ ? {
53
+ message: error.message,
54
+ inspect: error.inspect || function() { return this.message; },
55
+ }
56
+ : '';
57
+
52
58
  const screenshots = Array.isArray(results.screenshots)
53
59
  ? results.screenshots
54
60
  .filter(
@@ -72,8 +78,16 @@ const testomatioReporter = on => {
72
78
  state = STATUS.SKIPPED;
73
79
  }
74
80
 
75
- addSpecTestsPromises.push(client.addTestRun(state, {
76
- title, time, example, error, files, suite_title: suiteTitle, test_id: testId, suite_id: suiteId
81
+ addSpecTestsPromises.push(
82
+ client.addTestRun(state, {
83
+ title,
84
+ time,
85
+ example,
86
+ error: formattedError,
87
+ files,
88
+ suite_title: suiteTitle,
89
+ test_id: testId,
90
+ suite_id: suiteId
77
91
  }));
78
92
  }
79
93
 
@@ -32,6 +32,7 @@ class TestomatioPipe {
32
32
  this.sharedRun = !!process.env.TESTOMATIO_SHARED_RUN;
33
33
  this.groupTitle = params.groupTitle || process.env.TESTOMATIO_RUNGROUP_TITLE;
34
34
  this.env = process.env.TESTOMATIO_ENV;
35
+ this.label = process.env.TESTOMATIO_LABEL;
35
36
 
36
37
  this.axios = axios.create({
37
38
  baseURL: `${this.url.trim()}`,
@@ -130,6 +131,7 @@ class TestomatioPipe {
130
131
  jira_id: this.jiraId,
131
132
  env: this.env,
132
133
  title: this.title,
134
+ label: this.label,
133
135
  shared_run: this.sharedRun,
134
136
  }).filter(([, value]) => !!value),
135
137
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testomatio/reporter",
3
- "version": "1.1.0-beta.codeceptjs-before-suite-logs",
3
+ "version": "1.1.0-beta.cypress-trace-time",
4
4
  "description": "Testomatio Reporter Client",
5
5
  "main": "./lib/reporter.js",
6
6
  "typings": "typings/index.d.ts",
package/Changelog.md DELETED
@@ -1,359 +0,0 @@
1
- <!-- pending release updates -->
2
- # 1.0.18
3
-
4
- * Fixed stack traces for CodeceptJS
5
-
6
- # 1.0.17
7
-
8
- Renamed `TESTOMATIO_STACK_FILTER` to `TESTOMATIO_STACK_IGNORE`
9
-
10
- # 1.0.16
11
-
12
- * Addded [stack trace configuration](./docs/stacktrace.md) and documentation:
13
-
14
- ```
15
- TESTOMATIO_STACK_IGNORE="tests/support/**.js" <actual-run-command>
16
- ```
17
- * Jest: fixed reporting tests without a suite title
18
-
19
- # 1.0.15
20
-
21
- * Attach Run to Jira Issue via `TESTOMATIO_JIRA_ID` env variable:
22
-
23
- ```
24
- TESTOMATIO_JIRA_ID=TST-12 <actual run command>
25
- ```
26
-
27
- * Mocha - removed requirement of TESTOMATIO API Key
28
-
29
- # 1.0.14
30
-
31
- * Execute tests by tag names. Use this filter to select tests associated with specific tags.
32
-
33
- ```bash
34
- TESTOMATIO={API_KEY} npx start-test-run -c 'actual run command' --filter 'testomatio:tag-name=smoke'
35
- ```
36
-
37
- * more instruction you can find in docs/pipes/testomatio.md
38
-
39
- # 1.0.13
40
-
41
- * JUnit improvements
42
- * Match test from source code by adding Test ID as a comment:
43
-
44
- ```java
45
- // @T8acca9eb
46
- ```
47
- * Match test from output by adding Test ID as output:
48
-
49
- ```java
50
- System.out.println("tid://@T8acca9eb");
51
- ```
52
- * Support for suite before and after output
53
- * Improved support for artifacts
54
-
55
- # 1.0.12
56
-
57
- & Logger refactoring by @olexandr13 in #208
58
- * fix undefined logs by @olexandr13 in #210
59
-
60
- # 1.0.11
61
-
62
- * fix steps duplication for codecept report by @olexandr13 in #209
63
-
64
- # 1.0.10
65
-
66
- * Added `TESTOMATIO_PUBLISH=1` variable to automatically publish run report
67
-
68
- # 1.0.9
69
-
70
- * Support XUnit format
71
- * Improved support for parametrized Java tests
72
-
73
- # 1.0.8
74
-
75
- * Fixed `Can't read push of undefined` when logging steps
76
-
77
- # 1.0.6
78
-
79
- * Testomat.io. Auto-detect current build url and report it to Testomat.io. Manually url can be set with `BUILD_URL` variable:
80
-
81
- ```
82
- BUILD_URL=https://.... TESTOMATIO=apiKey <actual test command>
83
- ```
84
-
85
- # 1.0.5
86
-
87
- * Fix "create tests" params processing for testomatio pipe
88
-
89
- # 1.0.4
90
-
91
- * Fixed parallel run
92
-
93
- # 1.0.3
94
-
95
- * Fixed reporting parallel runs
96
-
97
- # 1.0.0
98
-
99
-
100
- * 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
101
- * Reworked [documentation](https://github.com/testomatio/reporter/tree/master#readme).
102
- * Added an option to obtain [S3 configuration](https://github.com/testomatio/reporter/blob/master/docs/artifacts.md#configuration) from Testomat.io
103
- * Introduced [pipes](https://github.com/testomatio/reporter/blob/master/docs/pipes.md):
104
- * GitHub
105
- * GitLab
106
- * CSV Pipe
107
-
108
-
109
- # 0.7.6
110
-
111
- * Updated to use AWS S3 3.0 SDK for uploading
112
-
113
- # 0.7.5
114
-
115
- * Fixed reporting skipped tests in mocha
116
-
117
- # 0.7.4
118
-
119
- * Fixed parsing source code in JUnit files
120
-
121
- # 0.7.3
122
-
123
- * CodeceptJS: Upload all traces and videos from artifacts
124
- * Fixed reporting skipped test in XML
125
- * added `--timelimit` option to `report-xml` command line
126
-
127
- # 0.7.2
128
-
129
- * Fixed uploading non-existing file
130
-
131
- # 0.7.1
132
-
133
- * Support for NUnit XML v3 format
134
-
135
- # 0.7.0
136
-
137
- * Support for `@cucumber/cucumber` (>= 7.0) added
138
- * Initial support for C# and NUnit
139
-
140
- # 0.6.10
141
-
142
- * Fixed uploading multilpe artifacts in Playwright
143
-
144
- # 0.6.9
145
-
146
- * Fixed pending tests reports for Cypress
147
-
148
- # 0.6.8
149
- # 0.6.7
150
-
151
- * Pytest: fixed creating suites from reports
152
-
153
- # 0.6.6
154
-
155
- * JUnit reporter: prefer suite title over testcase classname in a report
156
-
157
- # 0.6.5
158
-
159
- * Fixed test statuses for runs in JUnit reporter
160
-
161
- # 0.6.4
162
-
163
- * Added `TESTOMATIO_PROCEED=1` param to not close current run
164
- * Fixed priority of commands from `npx @testomatio/reporter`
165
-
166
- # 0.6.3
167
-
168
- * Fixed `npx start-test-run` to launch commands
169
-
170
- # 0.6.2
171
-
172
- * Added `--env-file` option to load env variables from env file
173
-
174
- # 0.6.1
175
-
176
- * Fixed creating RunGroup with JUnit reporter
177
-
178
- # 0.6.0
179
-
180
- * JUnit reporter support
181
-
182
- # 0.5.10
183
-
184
- * Fixed reporting Scenario Outline in Cypress-Cucumber
185
- * Fixed error reports for Cypress when running in Chrome
186
-
187
- # 0.5.9
188
-
189
- * Added environment on Cypress report
190
-
191
- # 0.5.8
192
-
193
- * Fixed Cypress.io reporting
194
-
195
- # 0.5.7
196
-
197
- * Fixed webdriverio artifacts
198
-
199
- # 0.5.6
200
-
201
- * Unmark failed CodeceptJS tests as skipped
202
-
203
- # 0.5.5
204
-
205
- * Fixed `BeforeSuite` failures in CodeceptJS
206
-
207
- # 0.5.4
208
-
209
- Added `TESTOMATIO_CREATE=1` option to create unmatched tests on report
210
-
211
- ```
212
- TESTOMATIO_CREATE=1 TESTOMATIO=apiKey npx codeceptjs run
213
- ```
214
-
215
- # 0.5.3
216
-
217
- * Fixed parsing suites
218
-
219
- # 0.5.2
220
-
221
- * Fixed multiple upload of artifacts in Cypress.io
222
-
223
- # 0.5.1
224
-
225
- * Fixed Cypress.io to report tests inside nested suites
226
-
227
- # 0.5.0
228
-
229
- * Added Cypress.io plugin
230
- * Added artifacts upload to webdriverio
231
-
232
- # 0.4.6
233
-
234
- - Fixed CodeceptJS reporter to report tests failed in hooks
235
-
236
- # 0.4.5
237
-
238
- - Fixed "Total XX artifacts publicly uploaded to S3 bucket" when no S3 bucket is configured
239
- - Improved S3 connection error messages
240
-
241
- # 0.4.4
242
-
243
- - 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.
244
-
245
- # 0.4.3
246
-
247
- - Added `TESTOMATIO_DISABLE_ARTIFACTS` env variable to disable publishing artifacts.
248
-
249
- # 0.4.2
250
-
251
- - print version of reporter
252
- - print number of uploaded artifacts
253
- - print access mode for uploaded artifacts
254
-
255
- # 0.4.1
256
-
257
- Added `global.testomatioArtifacts = []` array which can be used to add arbitrary artifacts to a report.
258
-
259
- ```js
260
- // inside a running test:
261
- global.testomatioArtifacts.push('file/to/upload.png');
262
- ```
263
-
264
- # 0.4.0
265
-
266
- - Playwright: Introduced playwright/test support with screenshots and video artifacts
267
-
268
- > Known issues: reporting using projects configured in Playwright does not work yet
269
-
270
- - CodeceptJS: added video uploads
271
-
272
- # 0.3.16
273
-
274
- - CodeceptJS: fixed reporting tests with empty steps (on retry)
275
-
276
- # 0.3.15
277
-
278
- - Finish Run via API:
279
-
280
- ```
281
- TESTOMATIO={apiKey} TESTOMATIO_RUN={runId} npx @testomatio/reporter@latest --finish
282
- ```
283
-
284
- # 0.3.14
285
-
286
- - Create an empty Run via API:
287
-
288
- ```
289
- TESTOMATIO={apiKey} npx @testomatio/reporter@latest --launch
290
- ```
291
-
292
- # 0.3.13
293
-
294
- - Checking for a valid report URL
295
- - Sending unlimited data on test report
296
-
297
- # 0.3.12
298
-
299
- - Fixed submitting arbitrary data on a test run
300
- - Jest: fixed sending errors with stack traces
301
- - Cypress: fixed sending reports
302
-
303
- # 0.3.11
304
-
305
- - Fixed circular JSON reference when submitting data to Testomatio
306
-
307
- # 0.3.10
308
-
309
- - Minor fixes
310
-
311
- # 0.3.9
312
-
313
- - Making all reporters to run without API key
314
-
315
- # 0.3.8
316
-
317
- - Fixed `npx start-test-run` to work with empty API keys
318
-
319
- # 0.3.7
320
-
321
- - Fixed release
322
-
323
- # 0.3.6
324
-
325
- - Update title and rungroup on start for scheduled runs.
326
-
327
- # 0.3.5
328
-
329
- - Added `TESTOMATIO_RUN` environment variable to pass id of a specific run to report
330
-
331
- # 0.3.4
332
-
333
- - Minor fixes
334
-
335
- # 0.3.3
336
-
337
- - [CodeceptJS] Fixed stack trace reporting
338
- - [CodeceptJS] Fixed displaying of nested steps
339
- - [CodeceptJS][mocha] Added assertion diff to report
340
-
341
- # 0.3.2
342
-
343
- - Fixed error message for S3 uploading
344
-
345
- # 0.3.1
346
-
347
- - [CodeceptJS] Better formatter for nested structures and BDD tests
348
-
349
- # 0.3.0
350
-
351
- - Added `TESTOMATIO_TITLE` env variable to set a name for Run
352
- - Added `TESTOMATIO_RUNGROUP_TITLE` env variable to attach Run to RunGroup
353
- - Added `TESTOMATIO_ENV` env variable to attach additional env values to report
354
- - [CodeceptJS] **CodeceptJS v3 support**
355
- - [CodeceptJS] Dropped support for CodeceptJS 2
356
- - [CodeceptJS] Added support for before hooks
357
- - [CodeceptJS] Log of steps
358
- - [CodeceptJS] Upload screenshots of failed tests to S3
359
- - [CodeceptJS] Updated to use with parallel execution