@testomatio/reporter 1.0.2 → 1.0.4

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,269 @@
1
+ <!-- pending release updates -->
2
+
3
+ # 1.0.3
4
+
5
+ * Fixed reporting parallel runs
6
+
7
+ # 1.0.0
8
+
9
+
10
+ * 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
11
+ * Reworked [documentation](https://github.com/testomatio/reporter/tree/master#readme).
12
+ * Added an option to obtain [S3 configuration](https://github.com/testomatio/reporter/blob/master/docs/artifacts.md#configuration) from Testomat.io
13
+ * Introduced [pipes](https://github.com/testomatio/reporter/blob/master/docs/pipes.md):
14
+ * GitHub
15
+ * GitLab
16
+ * CSV Pipe
17
+
18
+
19
+ # 0.7.6
20
+
21
+ * Updated to use AWS S3 3.0 SDK for uploading
22
+
23
+ # 0.7.5
24
+
25
+ * Fixed reporting skipped tests in mocha
26
+
27
+ # 0.7.4
28
+
29
+ * Fixed parsing source code in JUnit files
30
+
31
+ # 0.7.3
32
+
33
+ * CodeceptJS: Upload all traces and videos from artifacts
34
+ * Fixed reporting skipped test in XML
35
+ * added `--timelimit` option to `report-xml` command line
36
+
37
+ # 0.7.2
38
+
39
+ * Fixed uploading non-existing file
40
+
41
+ # 0.7.1
42
+
43
+ * Support for NUnit XML v3 format
44
+
45
+ # 0.7.0
46
+
47
+ * Support for `@cucumber/cucumber` (>= 7.0) added
48
+ * Initial support for C# and NUnit
49
+
50
+ # 0.6.10
51
+
52
+ * Fixed uploading multilpe artifacts in Playwright
53
+
54
+ # 0.6.9
55
+
56
+ * Fixed pending tests reports for Cypress
57
+
58
+ # 0.6.8
59
+ # 0.6.7
60
+
61
+ * Pytest: fixed creating suites from reports
62
+
63
+ # 0.6.6
64
+
65
+ * JUnit reporter: prefer suite title over testcase classname in a report
66
+
67
+ # 0.6.5
68
+
69
+ * Fixed test statuses for runs in JUnit reporter
70
+
71
+ # 0.6.4
72
+
73
+ * Added `TESTOMATIO_PROCEED=1` param to not close current run
74
+ * Fixed priority of commands from `npx @testomatio/reporter`
75
+
76
+ # 0.6.3
77
+
78
+ * Fixed `npx start-test-run` to launch commands
79
+
80
+ # 0.6.2
81
+
82
+ * Added `--env-file` option to load env variables from env file
83
+
84
+ # 0.6.1
85
+
86
+ * Fixed creating RunGroup with JUnit reporter
87
+
88
+ # 0.6.0
89
+
90
+ * JUnit reporter support
91
+
92
+ # 0.5.10
93
+
94
+ * Fixed reporting Scenario Outline in Cypress-Cucumber
95
+ * Fixed error reports for Cypress when running in Chrome
96
+
97
+ # 0.5.9
98
+
99
+ * Added environment on Cypress report
100
+
101
+ # 0.5.8
102
+
103
+ * Fixed Cypress.io reporting
104
+
105
+ # 0.5.7
106
+
107
+ * Fixed webdriverio artifacts
108
+
109
+ # 0.5.6
110
+
111
+ * Unmark failed CodeceptJS tests as skipped
112
+
113
+ # 0.5.5
114
+
115
+ * Fixed `BeforeSuite` failures in CodeceptJS
116
+
117
+ # 0.5.4
118
+
119
+ Added `TESTOMATIO_CREATE=1` option to create unmatched tests on report
120
+
121
+ ```
122
+ TESTOMATIO_CREATE=1 TESTOMATIO=apiKey npx codeceptjs run
123
+ ```
124
+
125
+ # 0.5.3
126
+
127
+ * Fixed parsing suites
128
+
129
+ # 0.5.2
130
+
131
+ * Fixed multiple upload of artifacts in Cypress.io
132
+
133
+ # 0.5.1
134
+
135
+ * Fixed Cypress.io to report tests inside nested suites
136
+
137
+ # 0.5.0
138
+
139
+ * Added Cypress.io plugin
140
+ * Added artifacts upload to webdriverio
141
+
142
+ # 0.4.6
143
+
144
+ - Fixed CodeceptJS reporter to report tests failed in hooks
145
+
146
+ # 0.4.5
147
+
148
+ - Fixed "Total XX artifacts publicly uploaded to S3 bucket" when no S3 bucket is configured
149
+ - Improved S3 connection error messages
150
+
151
+ # 0.4.4
152
+
153
+ - 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.
154
+
155
+ # 0.4.3
156
+
157
+ - Added `TESTOMATIO_DISABLE_ARTIFACTS` env variable to disable publishing artifacts.
158
+
159
+ # 0.4.2
160
+
161
+ - print version of reporter
162
+ - print number of uploaded artifacts
163
+ - print access mode for uploaded artifacts
164
+
165
+ # 0.4.1
166
+
167
+ Added `global.testomatioArtifacts = []` array which can be used to add arbitrary artifacts to a report.
168
+
169
+ ```js
170
+ // inside a running test:
171
+ global.testomatioArtifacts.push('file/to/upload.png');
172
+ ```
173
+
174
+ # 0.4.0
175
+
176
+ - Playwright: Introduced playwright/test support with screenshots and video artifacts
177
+
178
+ > Known issues: reporting using projects configured in Playwright does not work yet
179
+
180
+ - CodeceptJS: added video uploads
181
+
182
+ # 0.3.16
183
+
184
+ - CodeceptJS: fixed reporting tests with empty steps (on retry)
185
+
186
+ # 0.3.15
187
+
188
+ - Finish Run via API:
189
+
190
+ ```
191
+ TESTOMATIO={apiKey} TESTOMATIO_RUN={runId} npx @testomatio/reporter@latest --finish
192
+ ```
193
+
194
+ # 0.3.14
195
+
196
+ - Create an empty Run via API:
197
+
198
+ ```
199
+ TESTOMATIO={apiKey} npx @testomatio/reporter@latest --launch
200
+ ```
201
+
202
+ # 0.3.13
203
+
204
+ - Checking for a valid report URL
205
+ - Sending unlimited data on test report
206
+
207
+ # 0.3.12
208
+
209
+ - Fixed submitting arbitrary data on a test run
210
+ - Jest: fixed sending errors with stack traces
211
+ - Cypress: fixed sending reports
212
+
213
+ # 0.3.11
214
+
215
+ - Fixed circular JSON reference when submitting data to Testomatio
216
+
217
+ # 0.3.10
218
+
219
+ - Minor fixes
220
+
221
+ # 0.3.9
222
+
223
+ - Making all reporters to run without API key
224
+
225
+ # 0.3.8
226
+
227
+ - Fixed `npx start-test-run` to work with empty API keys
228
+
229
+ # 0.3.7
230
+
231
+ - Fixed release
232
+
233
+ # 0.3.6
234
+
235
+ - Update title and rungroup on start for scheduled runs.
236
+
237
+ # 0.3.5
238
+
239
+ - Added `TESTOMATIO_RUN` environment variable to pass id of a specific run to report
240
+
241
+ # 0.3.4
242
+
243
+ - Minor fixes
244
+
245
+ # 0.3.3
246
+
247
+ - [CodeceptJS] Fixed stack trace reporting
248
+ - [CodeceptJS] Fixed displaying of nested steps
249
+ - [CodeceptJS][mocha] Added assertion diff to report
250
+
251
+ # 0.3.2
252
+
253
+ - Fixed error message for S3 uploading
254
+
255
+ # 0.3.1
256
+
257
+ - [CodeceptJS] Better formatter for nested structures and BDD tests
258
+
259
+ # 0.3.0
260
+
261
+ - Added `TESTOMATIO_TITLE` env variable to set a name for Run
262
+ - Added `TESTOMATIO_RUNGROUP_TITLE` env variable to attach Run to RunGroup
263
+ - Added `TESTOMATIO_ENV` env variable to attach additional env values to report
264
+ - [CodeceptJS] **CodeceptJS v3 support**
265
+ - [CodeceptJS] Dropped support for CodeceptJS 2
266
+ - [CodeceptJS] Added support for before hooks
267
+ - [CodeceptJS] Log of steps
268
+ - [CodeceptJS] Upload screenshots of failed tests to S3
269
+ - [CodeceptJS] Updated to use with parallel execution
package/README.md CHANGED
@@ -12,7 +12,7 @@ Testomat.io Reporter (this npm package) supports:
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
14
  * 🔎 Stack traces and error messages
15
- * 🐙 [GitHub](./docs/pipes.md#github-pipe) & [GitLab](./docs/pipes.md#gitlab-pipe) integration
15
+ * 🐙 [GitHub](./docs/pipes/github.d) & [GitLab](./docs/pipes/gitlab.d) integration
16
16
  * 🚅 Realtime reports
17
17
  * 🗃️ Other test frameworks supported via [JUNit XML](./docs/junit.md)
18
18
  * 🚶‍♀️ Steps *(work in progress)*
@@ -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,6 +121,10 @@ 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)
@@ -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 } = require('../constants');
5
5
  const upload = require('../fileUploader');
6
- const Output = require('../output');
6
+ const { parseTest: getIdFromTestTitle, fileSystem } = require('../util');
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,34 @@ 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.mainDir);
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
+ global.testomatioDataStore.steps = [];
68
77
  });
69
78
 
70
79
  event.dispatcher.on(event.test.started, test => {
71
80
  testTimeMap[test.id] = Date.now();
81
+ if (global.testomatioDataStore) global.testomatioDataStore.currentlyRunningTestId = getIdFromTestTitle(test.title);
72
82
  });
73
83
 
74
84
  event.dispatcher.on(event.all.result, async () => {
@@ -97,10 +107,10 @@ function CodeceptReporter(config) {
97
107
  suite_title: test.parent && test.parent.title,
98
108
  message: testObj.message,
99
109
  time: getDuration(test),
100
- steps: output.text(),
110
+ steps: global.testomatioDataStore.steps.join('\n') || null,
101
111
  test_id: testId,
102
112
  });
103
- output.stop();
113
+ // output.stop();
104
114
  });
105
115
 
106
116
  event.dispatcher.on(event.test.failed, (test, err) => {
@@ -125,7 +135,7 @@ function CodeceptReporter(config) {
125
135
  time: 0,
126
136
  });
127
137
  }
128
- output.stop();
138
+ // output.stop();
129
139
  });
130
140
 
131
141
  event.dispatcher.on(event.test.after, test => {
@@ -141,32 +151,33 @@ function CodeceptReporter(config) {
141
151
 
142
152
  const files = [];
143
153
  if (artifacts.screenshot) files.push({ path: artifacts.screenshot, type: 'image/png' });
144
- // todo: video must be uploaded later....
154
+ // todo: video must be uploaded later....
145
155
 
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
- });
156
+ const reportTestPromise = client
157
+ .addTestRun(STATUS.FAILED, {
158
+ ...stripExampleFromTitle(title),
159
+ test_id: testId,
160
+ suite_title: test.parent && test.parent.title,
161
+ error,
162
+ message: testObj.message,
163
+ time: getDuration(test),
164
+ files,
165
+ steps: global.testomatioDataStore.steps.join('\n') || null,
166
+ })
167
+ .then(pipes => {
168
+ testId = pipes.filter(p => p.pipe.includes('Testomatio'))[0]?.result?.data?.test_id;
169
+
170
+ debug('artifacts', artifacts);
171
+
172
+ for (const aid in artifacts) {
173
+ if (aid.startsWith('video')) videos.push({ testId, title, path: artifacts[aid], type: 'video/webm' });
174
+ if (aid.startsWith('trace')) traces.push({ testId, title, path: artifacts[aid], type: 'application/zip' });
175
+ }
176
+ });
166
177
 
167
178
  reportTestPromises.push(reportTestPromise);
168
179
 
169
- output.stop();
180
+ // output.stop();
170
181
  });
171
182
 
172
183
  event.dispatcher.on(event.test.skipped, test => {
@@ -182,7 +193,7 @@ function CodeceptReporter(config) {
182
193
  message: testObj.message,
183
194
  time: getDuration(test),
184
195
  });
185
- output.stop();
196
+ // output.stop();
186
197
  });
187
198
 
188
199
  event.dispatcher.on(event.step.started, step => {
@@ -207,30 +218,37 @@ function CodeceptReporter(config) {
207
218
  // eslint-disable-next-line no-continue
208
219
  if (!metaSteps[i]) continue;
209
220
  if (metaSteps[i].isBDD()) {
210
- output.push(repeat(stepShift) + chalk.bold(metaSteps[i].toString()) + metaSteps[i].comment);
221
+ // output.push(repeat(stepShift) + chalk.bold(metaSteps[i].toString()) + metaSteps[i].comment);
222
+ global.testomatioDataStore.steps.push(
223
+ repeat(stepShift) + chalk.bold(metaSteps[i].toString()) + metaSteps[i].comment,
224
+ );
211
225
  } else {
212
- output.push(repeat(stepShift) + chalk.green.bold(metaSteps[i].toString()));
226
+ // output.push(repeat(stepShift) + chalk.green.bold(metaSteps[i].toString()));
227
+ global.testomatioDataStore.steps.push(repeat(stepShift) + chalk.green.bold(metaSteps[i].toString()));
213
228
  }
214
229
  }
215
230
  }
216
231
  currentMetaStep = metaSteps;
217
232
  stepShift = 2 * shift;
218
233
 
219
- const durationMs = (+new Date() - (+stepStart));
234
+ const durationMs = +new Date() - (+stepStart);
220
235
  let duration = '';
221
236
  if (durationMs) {
222
237
  duration = repeat(1) + chalk.grey(`(${durationMs}ms)`);
223
238
  }
224
239
 
225
240
  if (step.status === STATUS.FAILED) {
226
- output.push(repeat(stepShift) + chalk.red(step.toString()) + duration);
241
+ // output.push(repeat(stepShift) + chalk.red(step.toString()) + duration);
242
+ global.testomatioDataStore.steps.push(repeat(stepShift) + chalk.red(step.toString()) + duration);
227
243
  } else {
228
- output.push(repeat(stepShift) + step.toString() + duration);
244
+ // output.push(repeat(stepShift) + step.toString() + duration);
245
+ global.testomatioDataStore.steps.push(repeat(stepShift) + step.toString() + duration);
229
246
  }
230
247
  });
231
248
 
232
249
  event.dispatcher.on(event.step.comment, step => {
233
- output.push(chalk.cyan.bold(step.toString()));
250
+ // output.push(chalk.cyan.bold(step.toString()));
251
+ global.testomatioDataStore.steps.push(chalk.cyan.bold(step.toString()));
234
252
  });
235
253
  }
236
254