@testomatio/reporter 1.1.0-beta → 1.1.0-beta-3

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,355 @@
1
+ <!-- pending release updates -->
2
+ # 1.0.17
3
+
4
+ Renamed `TESTOMATIO_STACK_FILTER` to `TESTOMATIO_STACK_IGNORE`
5
+
6
+ # 1.0.16
7
+
8
+ * Addded [stack trace configuration](./docs/stacktrace.md) and documentation:
9
+
10
+ ```
11
+ TESTOMATIO_STACK_IGNORE="tests/support/**.js" <actual-run-command>
12
+ ```
13
+ * Jest: fixed reporting tests without a suite title
14
+
15
+ # 1.0.15
16
+
17
+ * Attach Run to Jira Issue via `TESTOMATIO_JIRA_ID` env variable:
18
+
19
+ ```
20
+ TESTOMATIO_JIRA_ID=TST-12 <actual run command>
21
+ ```
22
+
23
+ * Mocha - removed requirement of TESTOMATIO API Key
24
+
25
+ # 1.0.14
26
+
27
+ * Execute tests by tag names. Use this filter to select tests associated with specific tags.
28
+
29
+ ```bash
30
+ TESTOMATIO={API_KEY} npx start-test-run -c 'actual run command' --filter 'testomatio:tag-name=smoke'
31
+ ```
32
+
33
+ * more instruction you can find in docs/pipes/testomatio.md
34
+
35
+ # 1.0.13
36
+
37
+ * JUnit improvements
38
+ * Match test from source code by adding Test ID as a comment:
39
+
40
+ ```java
41
+ // @T8acca9eb
42
+ ```
43
+ * Match test from output by adding Test ID as output:
44
+
45
+ ```java
46
+ System.out.println("tid://@T8acca9eb");
47
+ ```
48
+ * Support for suite before and after output
49
+ * Improved support for artifacts
50
+
51
+ # 1.0.12
52
+
53
+ & Logger refactoring by @olexandr13 in #208
54
+ * fix undefined logs by @olexandr13 in #210
55
+
56
+ # 1.0.11
57
+
58
+ * fix steps duplication for codecept report by @olexandr13 in #209
59
+
60
+ # 1.0.10
61
+
62
+ * Added `TESTOMATIO_PUBLISH=1` variable to automatically publish run report
63
+
64
+ # 1.0.9
65
+
66
+ * Support XUnit format
67
+ * Improved support for parametrized Java tests
68
+
69
+ # 1.0.8
70
+
71
+ * Fixed `Can't read push of undefined` when logging steps
72
+
73
+ # 1.0.6
74
+
75
+ * Testomat.io. Auto-detect current build url and report it to Testomat.io. Manually url can be set with `BUILD_URL` variable:
76
+
77
+ ```
78
+ BUILD_URL=https://.... TESTOMATIO=apiKey <actual test command>
79
+ ```
80
+
81
+ # 1.0.5
82
+
83
+ * Fix "create tests" params processing for testomatio pipe
84
+
85
+ # 1.0.4
86
+
87
+ * Fixed parallel run
88
+
89
+ # 1.0.3
90
+
91
+ * Fixed reporting parallel runs
92
+
93
+ # 1.0.0
94
+
95
+
96
+ * 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
97
+ * Reworked [documentation](https://github.com/testomatio/reporter/tree/master#readme).
98
+ * Added an option to obtain [S3 configuration](https://github.com/testomatio/reporter/blob/master/docs/artifacts.md#configuration) from Testomat.io
99
+ * Introduced [pipes](https://github.com/testomatio/reporter/blob/master/docs/pipes.md):
100
+ * GitHub
101
+ * GitLab
102
+ * CSV Pipe
103
+
104
+
105
+ # 0.7.6
106
+
107
+ * Updated to use AWS S3 3.0 SDK for uploading
108
+
109
+ # 0.7.5
110
+
111
+ * Fixed reporting skipped tests in mocha
112
+
113
+ # 0.7.4
114
+
115
+ * Fixed parsing source code in JUnit files
116
+
117
+ # 0.7.3
118
+
119
+ * CodeceptJS: Upload all traces and videos from artifacts
120
+ * Fixed reporting skipped test in XML
121
+ * added `--timelimit` option to `report-xml` command line
122
+
123
+ # 0.7.2
124
+
125
+ * Fixed uploading non-existing file
126
+
127
+ # 0.7.1
128
+
129
+ * Support for NUnit XML v3 format
130
+
131
+ # 0.7.0
132
+
133
+ * Support for `@cucumber/cucumber` (>= 7.0) added
134
+ * Initial support for C# and NUnit
135
+
136
+ # 0.6.10
137
+
138
+ * Fixed uploading multilpe artifacts in Playwright
139
+
140
+ # 0.6.9
141
+
142
+ * Fixed pending tests reports for Cypress
143
+
144
+ # 0.6.8
145
+ # 0.6.7
146
+
147
+ * Pytest: fixed creating suites from reports
148
+
149
+ # 0.6.6
150
+
151
+ * JUnit reporter: prefer suite title over testcase classname in a report
152
+
153
+ # 0.6.5
154
+
155
+ * Fixed test statuses for runs in JUnit reporter
156
+
157
+ # 0.6.4
158
+
159
+ * Added `TESTOMATIO_PROCEED=1` param to not close current run
160
+ * Fixed priority of commands from `npx @testomatio/reporter`
161
+
162
+ # 0.6.3
163
+
164
+ * Fixed `npx start-test-run` to launch commands
165
+
166
+ # 0.6.2
167
+
168
+ * Added `--env-file` option to load env variables from env file
169
+
170
+ # 0.6.1
171
+
172
+ * Fixed creating RunGroup with JUnit reporter
173
+
174
+ # 0.6.0
175
+
176
+ * JUnit reporter support
177
+
178
+ # 0.5.10
179
+
180
+ * Fixed reporting Scenario Outline in Cypress-Cucumber
181
+ * Fixed error reports for Cypress when running in Chrome
182
+
183
+ # 0.5.9
184
+
185
+ * Added environment on Cypress report
186
+
187
+ # 0.5.8
188
+
189
+ * Fixed Cypress.io reporting
190
+
191
+ # 0.5.7
192
+
193
+ * Fixed webdriverio artifacts
194
+
195
+ # 0.5.6
196
+
197
+ * Unmark failed CodeceptJS tests as skipped
198
+
199
+ # 0.5.5
200
+
201
+ * Fixed `BeforeSuite` failures in CodeceptJS
202
+
203
+ # 0.5.4
204
+
205
+ Added `TESTOMATIO_CREATE=1` option to create unmatched tests on report
206
+
207
+ ```
208
+ TESTOMATIO_CREATE=1 TESTOMATIO=apiKey npx codeceptjs run
209
+ ```
210
+
211
+ # 0.5.3
212
+
213
+ * Fixed parsing suites
214
+
215
+ # 0.5.2
216
+
217
+ * Fixed multiple upload of artifacts in Cypress.io
218
+
219
+ # 0.5.1
220
+
221
+ * Fixed Cypress.io to report tests inside nested suites
222
+
223
+ # 0.5.0
224
+
225
+ * Added Cypress.io plugin
226
+ * Added artifacts upload to webdriverio
227
+
228
+ # 0.4.6
229
+
230
+ - Fixed CodeceptJS reporter to report tests failed in hooks
231
+
232
+ # 0.4.5
233
+
234
+ - Fixed "Total XX artifacts publicly uploaded to S3 bucket" when no S3 bucket is configured
235
+ - Improved S3 connection error messages
236
+
237
+ # 0.4.4
238
+
239
+ - 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.
240
+
241
+ # 0.4.3
242
+
243
+ - Added `TESTOMATIO_DISABLE_ARTIFACTS` env variable to disable publishing artifacts.
244
+
245
+ # 0.4.2
246
+
247
+ - print version of reporter
248
+ - print number of uploaded artifacts
249
+ - print access mode for uploaded artifacts
250
+
251
+ # 0.4.1
252
+
253
+ Added `global.testomatioArtifacts = []` array which can be used to add arbitrary artifacts to a report.
254
+
255
+ ```js
256
+ // inside a running test:
257
+ global.testomatioArtifacts.push('file/to/upload.png');
258
+ ```
259
+
260
+ # 0.4.0
261
+
262
+ - Playwright: Introduced playwright/test support with screenshots and video artifacts
263
+
264
+ > Known issues: reporting using projects configured in Playwright does not work yet
265
+
266
+ - CodeceptJS: added video uploads
267
+
268
+ # 0.3.16
269
+
270
+ - CodeceptJS: fixed reporting tests with empty steps (on retry)
271
+
272
+ # 0.3.15
273
+
274
+ - Finish Run via API:
275
+
276
+ ```
277
+ TESTOMATIO={apiKey} TESTOMATIO_RUN={runId} npx @testomatio/reporter@latest --finish
278
+ ```
279
+
280
+ # 0.3.14
281
+
282
+ - Create an empty Run via API:
283
+
284
+ ```
285
+ TESTOMATIO={apiKey} npx @testomatio/reporter@latest --launch
286
+ ```
287
+
288
+ # 0.3.13
289
+
290
+ - Checking for a valid report URL
291
+ - Sending unlimited data on test report
292
+
293
+ # 0.3.12
294
+
295
+ - Fixed submitting arbitrary data on a test run
296
+ - Jest: fixed sending errors with stack traces
297
+ - Cypress: fixed sending reports
298
+
299
+ # 0.3.11
300
+
301
+ - Fixed circular JSON reference when submitting data to Testomatio
302
+
303
+ # 0.3.10
304
+
305
+ - Minor fixes
306
+
307
+ # 0.3.9
308
+
309
+ - Making all reporters to run without API key
310
+
311
+ # 0.3.8
312
+
313
+ - Fixed `npx start-test-run` to work with empty API keys
314
+
315
+ # 0.3.7
316
+
317
+ - Fixed release
318
+
319
+ # 0.3.6
320
+
321
+ - Update title and rungroup on start for scheduled runs.
322
+
323
+ # 0.3.5
324
+
325
+ - Added `TESTOMATIO_RUN` environment variable to pass id of a specific run to report
326
+
327
+ # 0.3.4
328
+
329
+ - Minor fixes
330
+
331
+ # 0.3.3
332
+
333
+ - [CodeceptJS] Fixed stack trace reporting
334
+ - [CodeceptJS] Fixed displaying of nested steps
335
+ - [CodeceptJS][mocha] Added assertion diff to report
336
+
337
+ # 0.3.2
338
+
339
+ - Fixed error message for S3 uploading
340
+
341
+ # 0.3.1
342
+
343
+ - [CodeceptJS] Better formatter for nested structures and BDD tests
344
+
345
+ # 0.3.0
346
+
347
+ - Added `TESTOMATIO_TITLE` env variable to set a name for Run
348
+ - Added `TESTOMATIO_RUNGROUP_TITLE` env variable to attach Run to RunGroup
349
+ - Added `TESTOMATIO_ENV` env variable to attach additional env values to report
350
+ - [CodeceptJS] **CodeceptJS v3 support**
351
+ - [CodeceptJS] Dropped support for CodeceptJS 2
352
+ - [CodeceptJS] Added support for before hooks
353
+ - [CodeceptJS] Log of steps
354
+ - [CodeceptJS] Upload screenshots of failed tests to S3
355
+ - [CodeceptJS] Updated to use with parallel execution
package/README.md CHANGED
@@ -11,12 +11,12 @@ Testomat.io Reporter (this npm package) supports:
11
11
 
12
12
  * 🏄 Integarion with all popular [JavaScript/TypeScript frameworks](./docs/frameworks.md)
13
13
  * 🗄️ Screenshots, videos, traces [uploaded into S3 bucket](./docs/artifacts.md)
14
- * 🔎 Stack traces and error messages
15
- * 🐙 [GitHub](./docs/pipes.md#github-pipe) & [GitLab](./docs/pipes.md#gitlab-pipe) integration
14
+ * 🔎 [Stack traces](./docs/stacktrace.md) and error messages
15
+ * 🐙 [GitHub](./docs/pipes/github.md) & [GitLab](./docs/pipes/gitlab.md) integration
16
16
  * 🚅 Realtime reports
17
17
  * 🗃️ Other test frameworks supported via [JUNit XML](./docs/junit.md)
18
18
  * 🚶‍♀️ Steps *(work in progress)*
19
- * 📄 Logger *(work in progress, supports Jest for now)*
19
+ * 📄 [Logger](./docs/logger.md) *(work in progress, supports Jest for now)*
20
20
  * ☁️ Custom properties and metadata *(work in progress)*
21
21
  * 💯 Free & open-source.
22
22
  * 📊 Public and private Run reports on cloud via [Testomat.io App](https://testomat.io) 👇
@@ -85,13 +85,13 @@ or any [other via JUnit](./docs/junit.md) report....
85
85
 
86
86
  ### 2️⃣ Configure Reports
87
87
 
88
- * [Create report on Testomat.io](./docs/pipes.md#testomatio-pipe).
89
- * [Create brief summary report for GitHub Pull Request](./docs/pipes.md#github-pipe) 👇
90
- * [Create brief summary report for GitLab Merge Request](./docs/pipes.md#gitlab-pipe).
91
- * [Configure other pipes](./docs/pipes.md) for other ways to process test results output.
88
+ * [Create report on Testomat.io](./docs/pipes/testomatio.md).
89
+ * [Create brief summary report for GitHub Pull Request](./docs/pipes/github.md) 👇
90
+ * [Create brief summary report for GitLab Merge Request](./docs/pipes/gitlab.md).
91
+ * [Configure other pipes](./docs/pipes/md) for other ways to process test results output.
92
92
 
93
93
 
94
- ![GitHub report](./docs/images/github.png)
94
+ ![GitHub report](./docs/pipes/images/github.png)
95
95
 
96
96
  GitHub report published as a comment to Pull Request:
97
97
 
@@ -121,10 +121,14 @@ Bring this reporter on CI and never lose test results again!
121
121
 
122
122
  * 🛠️ [Frameworks](./docs/frameworks.md)
123
123
  * ⛲ [Pipes](./docs/pipes.md)
124
+ * [Testomat.io](./docs/pipes/testomatio.md)
125
+ * [GitHub](./docs/pipes/github.md)
126
+ * [Gitlab](./docs/pipes/gitlab.md)
127
+ * [CSV](./docs/pipes/csv.md)
124
128
  * 📓 [JUnit](./docs/junit.md)
125
129
  * 🗄️ [Artifacts](./docs/artifacts.md)
126
130
  * 🔂 [Workflows](./docs/workflows.md)
127
- * 🔂 [Logger](./docs/logger.md)
131
+ * 🖊️ [Logger](./docs/logger.md)
128
132
 
129
133
  ## Development
130
134
 
@@ -1,9 +1,9 @@
1
1
  const debug = require('debug')('@testomatio/reporter:adapter:codeceptjs');
2
2
  const chalk = require('chalk');
3
3
  const TestomatClient = require('../client');
4
- const { STATUS, APP_PREFIX } = require('../constants');
4
+ const { STATUS, APP_PREFIX, TESTOMAT_TMP_STORAGE_DIR } = require('../constants');
5
5
  const upload = require('../fileUploader');
6
- const Output = require('../output');
6
+ const { parseTest: getIdFromTestTitle, fileSystem } = require('../utils/utils');
7
7
 
8
8
  if (!global.codeceptjs) {
9
9
  // eslint-disable-next-line global-require, import/no-extraneous-dependencies
@@ -16,9 +16,9 @@ let currentMetaStep = [];
16
16
  let error;
17
17
  let stepShift = 0;
18
18
 
19
- const output = new Output({
20
- filterFn: stack => !stack.includes('codeceptjs/lib/output'), // output from codeceptjs
21
- });
19
+ // const output = new Output({
20
+ // filterFn: stack => !stack.includes('codeceptjs/lib/output'), // output from codeceptjs
21
+ // });
22
22
 
23
23
  let stepStart = new Date();
24
24
 
@@ -51,24 +51,36 @@ function CodeceptReporter(config) {
51
51
 
52
52
  recorder.startUnlessRunning();
53
53
 
54
+ global.testomatioRunningEnvironment = 'codeceptjs';
55
+
54
56
  // Listening to events
55
57
  event.dispatcher.on(event.all.before, () => {
58
+ // clear tmp dir
59
+ fileSystem.clearDir(TESTOMAT_TMP_STORAGE_DIR);
60
+
56
61
  recorder.add('Creating new run', () => client.createRun());
57
62
  videos = [];
58
63
  traces = [];
64
+
65
+ if (!global.testomatioDataStore) global.testomatioDataStore = {};
59
66
  });
60
67
 
61
68
  event.dispatcher.on(event.test.before, () => {
62
69
  recorder.add(() => {
63
70
  currentMetaStep = [];
64
- output.reset();
65
- output.start();
71
+ // output.reset();
72
+ // output.start();
66
73
  stepShift = 0;
67
74
  });
75
+
76
+ if (!global.testomatioDataStore) global.testomatioDataStore = {};
77
+ // reset steps
78
+ global.testomatioDataStore.steps = [];
68
79
  });
69
80
 
70
81
  event.dispatcher.on(event.test.started, test => {
71
82
  testTimeMap[test.id] = Date.now();
83
+ if (global.testomatioDataStore) global.testomatioDataStore.currentlyRunningTestId = getIdFromTestTitle(test.title);
72
84
  });
73
85
 
74
86
  event.dispatcher.on(event.all.result, async () => {
@@ -97,10 +109,10 @@ function CodeceptReporter(config) {
97
109
  suite_title: test.parent && test.parent.title,
98
110
  message: testObj.message,
99
111
  time: getDuration(test),
100
- steps: output.text(),
112
+ steps: global.testomatioDataStore.steps.join('\n') || null,
101
113
  test_id: testId,
102
114
  });
103
- output.stop();
115
+ // output.stop();
104
116
  });
105
117
 
106
118
  event.dispatcher.on(event.test.failed, (test, err) => {
@@ -125,7 +137,7 @@ function CodeceptReporter(config) {
125
137
  time: 0,
126
138
  });
127
139
  }
128
- output.stop();
140
+ // output.stop();
129
141
  });
130
142
 
131
143
  event.dispatcher.on(event.test.after, test => {
@@ -141,32 +153,33 @@ function CodeceptReporter(config) {
141
153
 
142
154
  const files = [];
143
155
  if (artifacts.screenshot) files.push({ path: artifacts.screenshot, type: 'image/png' });
144
- // todo: video must be uploaded later....
156
+ // todo: video must be uploaded later....
145
157
 
146
-
147
- const reportTestPromise = client.addTestRun(STATUS.FAILED, {
148
- ...stripExampleFromTitle(title),
149
- test_id: testId,
150
- suite_title: test.parent && test.parent.title,
151
- error,
152
- message: testObj.message,
153
- time: getDuration(test),
154
- files,
155
- steps: output.text(),
156
- }).then(pipes => {
157
- testId = pipes.filter(p => p.pipe.includes('Testomatio'))[0]?.result?.data?.test_id;
158
-
159
- debug("artifacts", artifacts);
160
-
161
- for (const aid in artifacts) {
162
- if (aid.startsWith('video')) videos.push({ testId, title, path: artifacts[aid], type: 'video/webm' });
163
- if (aid.startsWith('trace')) traces.push({ testId, title, path: artifacts[aid], type: 'application/zip' });
164
- }
165
- });
158
+ const reportTestPromise = client
159
+ .addTestRun(STATUS.FAILED, {
160
+ ...stripExampleFromTitle(title),
161
+ test_id: testId,
162
+ suite_title: test.parent && test.parent.title,
163
+ error,
164
+ message: testObj.message,
165
+ time: getDuration(test),
166
+ files,
167
+ steps: global.testomatioDataStore?.steps?.join('\n') || null,
168
+ })
169
+ .then(pipes => {
170
+ testId = pipes.filter(p => p.pipe.includes('Testomatio'))[0]?.result?.data?.test_id;
171
+
172
+ debug('artifacts', artifacts);
173
+
174
+ for (const aid in artifacts) {
175
+ if (aid.startsWith('video')) videos.push({ testId, title, path: artifacts[aid], type: 'video/webm' });
176
+ if (aid.startsWith('trace')) traces.push({ testId, title, path: artifacts[aid], type: 'application/zip' });
177
+ }
178
+ });
166
179
 
167
180
  reportTestPromises.push(reportTestPromise);
168
181
 
169
- output.stop();
182
+ // output.stop();
170
183
  });
171
184
 
172
185
  event.dispatcher.on(event.test.skipped, test => {
@@ -182,7 +195,7 @@ function CodeceptReporter(config) {
182
195
  message: testObj.message,
183
196
  time: getDuration(test),
184
197
  });
185
- output.stop();
198
+ // output.stop();
186
199
  });
187
200
 
188
201
  event.dispatcher.on(event.step.started, step => {
@@ -207,30 +220,37 @@ function CodeceptReporter(config) {
207
220
  // eslint-disable-next-line no-continue
208
221
  if (!metaSteps[i]) continue;
209
222
  if (metaSteps[i].isBDD()) {
210
- output.push(repeat(stepShift) + chalk.bold(metaSteps[i].toString()) + metaSteps[i].comment);
223
+ // output.push(repeat(stepShift) + chalk.bold(metaSteps[i].toString()) + metaSteps[i].comment);
224
+ global.testomatioDataStore?.steps?.push(
225
+ repeat(stepShift) + chalk.bold(metaSteps[i].toString()) + metaSteps[i].comment,
226
+ );
211
227
  } else {
212
- output.push(repeat(stepShift) + chalk.green.bold(metaSteps[i].toString()));
228
+ // output.push(repeat(stepShift) + chalk.green.bold(metaSteps[i].toString()));
229
+ global.testomatioDataStore?.steps?.push(repeat(stepShift) + chalk.green.bold(metaSteps[i].toString()));
213
230
  }
214
231
  }
215
232
  }
216
233
  currentMetaStep = metaSteps;
217
234
  stepShift = 2 * shift;
218
235
 
219
- const durationMs = (+new Date() - (+stepStart));
236
+ const durationMs = +new Date() - (+stepStart);
220
237
  let duration = '';
221
238
  if (durationMs) {
222
239
  duration = repeat(1) + chalk.grey(`(${durationMs}ms)`);
223
240
  }
224
241
 
225
242
  if (step.status === STATUS.FAILED) {
226
- output.push(repeat(stepShift) + chalk.red(step.toString()) + duration);
243
+ // output.push(repeat(stepShift) + chalk.red(step.toString()) + duration);
244
+ global.testomatioDataStore?.steps?.push(repeat(stepShift) + chalk.red(step.toString()) + duration);
227
245
  } else {
228
- output.push(repeat(stepShift) + step.toString() + duration);
246
+ // output.push(repeat(stepShift) + step.toString() + duration);
247
+ global.testomatioDataStore?.steps?.push(repeat(stepShift) + step.toString() + duration);
229
248
  }
230
249
  });
231
250
 
232
251
  event.dispatcher.on(event.step.comment, step => {
233
- output.push(chalk.cyan.bold(step.toString()));
252
+ // output.push(chalk.cyan.bold(step.toString()));
253
+ global.testomatioDataStore?.steps?.push(chalk.cyan.bold(step.toString()));
234
254
  });
235
255
  }
236
256