@testomatio/reporter 1.0.13 → 1.0.14-beta

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/lib/client.js CHANGED
@@ -36,6 +36,7 @@ class Client {
36
36
  * @returns {Promise<any>} - resolves to Run id which should be used to update / add test
37
37
  */
38
38
  createRun() {
39
+ debug('Creating run...');
39
40
  // all pipes disabled, skipping
40
41
  if (!this.pipes?.filter(p => p.isEnabled).length) return Promise.resolve();
41
42
 
@@ -59,6 +60,7 @@ class Client {
59
60
  * @returns {Promise<PipeResult[]>}
60
61
  */
61
62
  async addTestRun(status, testData, storeArtifacts = []) {
63
+ debug('Adding test run for test', testData?.test_id || 'unknown test');
62
64
  // all pipes disabled, skipping
63
65
  if (!this.pipes?.filter(p => p.isEnabled).length) return [];
64
66
 
@@ -170,6 +172,7 @@ class Client {
170
172
  * @returns {Promise<any>} - A Promise that resolves when finishes the run.
171
173
  */
172
174
  updateRunStatus(status, isParallel = false) {
175
+ debug('Updating run status...');
173
176
  // all pipes disabled, skipping
174
177
  if (!this.pipes?.filter(p => p.isEnabled).length) return Promise.resolve();
175
178
 
@@ -33,7 +33,9 @@ class TestomatioPipe {
33
33
  this.sharedRun = !!process.env.TESTOMATIO_SHARED_RUN;
34
34
  this.groupTitle = params.groupTitle || process.env.TESTOMATIO_RUNGROUP_TITLE;
35
35
  this.env = process.env.TESTOMATIO_ENV;
36
- this.axios = axios.create();
36
+ this.axios = axios.create({
37
+ timeout: 30000,
38
+ });
37
39
  this.isEnabled = true;
38
40
  // do not finish this run (for parallel testing)
39
41
  this.proceed = process.env.TESTOMATIO_PROCEED;
@@ -51,6 +53,7 @@ class TestomatioPipe {
51
53
  * @returns Promise<void>
52
54
  */
53
55
  async createRun() {
56
+ debug('Creating run...');
54
57
  if (!this.isEnabled) return;
55
58
 
56
59
  let buildUrl = process.env.BUILD_URL || process.env.CI_JOB_URL || process.env.CIRCLE_BUILD_URL;
@@ -58,7 +61,7 @@ class TestomatioPipe {
58
61
  // GitHub Actions Url
59
62
  if (!buildUrl && process.env.GITHUB_RUN_ID) {
60
63
  // eslint-disable-next-line max-len
61
- buildUrl = `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`
64
+ buildUrl = `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`;
62
65
  }
63
66
 
64
67
  // Azure DevOps Url
@@ -83,7 +86,7 @@ class TestomatioPipe {
83
86
  env: this.env,
84
87
  title: this.title,
85
88
  shared_run: this.sharedRun,
86
- }).filter(([, value]) => !!value)
89
+ }).filter(([, value]) => !!value),
87
90
  );
88
91
 
89
92
  if (this.runId) {
@@ -110,57 +113,65 @@ class TestomatioPipe {
110
113
  console.error(
111
114
  APP_PREFIX,
112
115
  'Error creating Testomat.io report, please check if your API key is valid. Skipping report',
116
+ err,
113
117
  );
114
118
  }
119
+ debug('Run created');
115
120
  }
116
121
 
117
122
  /**
118
- *
119
- * @param testData data
120
- * @returns
123
+ *
124
+ * @param testData data
125
+ * @returns
121
126
  */
122
127
  addTest(data) {
128
+ debug('Adding test...');
123
129
  if (!this.isEnabled) return;
124
130
  if (!this.runId) return;
125
131
  data.api_key = this.apiKey;
126
132
  data.create = this.createNewTests;
127
133
  const json = JsonCycle.stringify(data);
128
134
 
129
- return this.axios.post(`${this.url}/api/reporter/${this.runId}/testrun`, json, {
130
- maxContentLength: Infinity,
131
- maxBodyLength: Infinity,
132
- headers: {
133
- // Overwrite Axios's automatically set Content-Type
134
- 'Content-Type': 'application/json',
135
- },
136
- })
137
- .catch((err) => {
138
- if (err.response) {
139
- if (err.response.status >= 400) {
140
- const responseData = err.response.data || { message: '' };
135
+ return this.axios
136
+ .post(`${this.url}/api/reporter/${this.runId}/testrun`, json, {
137
+ maxContentLength: Infinity,
138
+ maxBodyLength: Infinity,
139
+ headers: {
140
+ // Overwrite Axios's automatically set Content-Type
141
+ 'Content-Type': 'application/json',
142
+ },
143
+ })
144
+ .catch(err => {
145
+ if (err.response) {
146
+ if (err.response.status >= 400) {
147
+ const responseData = err.response.data || { message: '' };
148
+ console.log(
149
+ APP_PREFIX,
150
+ chalk.yellow(`Warning: ${responseData.message} (${err.response.status})`),
151
+ chalk.grey(data?.title || ''),
152
+ );
153
+ if (err.response.data.message.includes('could not be matched')) {
154
+ this.hasUnmatchedTests = true;
155
+ }
156
+ return;
157
+ }
141
158
  console.log(
142
159
  APP_PREFIX,
143
- chalk.yellow(`Warning: ${responseData.message} (${err.response.status})`),
144
- chalk.grey(data?.title || ''),
160
+ chalk.yellow(`Warning: ${data?.title || ''} (${err.response?.status})`),
161
+ `Report couldn't be processed: ${err?.response?.data?.message}`,
145
162
  );
146
- if (err.response.data.message.includes('could not be matched')) {
147
- this.hasUnmatchedTests = true;
148
- }
149
- return;
163
+ } else {
164
+ console.log(APP_PREFIX, chalk.blue(data?.title || ''), "Report couldn't be processed", err);
150
165
  }
151
- // eslint-disable-next-line max-len
152
- console.log(APP_PREFIX, chalk.blue(data?.title || ''), `Report couldn't be processed: ${err.response.data.message}`);
153
- } else {
154
- console.log(APP_PREFIX, chalk.blue(data?.title || ''), "Report couldn't be processed", err);
155
- }
156
- });
166
+ });
157
167
  }
158
168
 
159
169
  /**
160
- * @param {import('../../types').RunData} params
161
- * @returns
170
+ * @param {import('../../types').RunData} params
171
+ * @returns
162
172
  */
163
173
  async finishRun(params) {
174
+ debug('Finishing run...');
164
175
  if (!this.isEnabled) return;
165
176
 
166
177
  const { status, parallel } = params;
@@ -185,7 +196,6 @@ class TestomatioPipe {
185
196
  if (this.runPublicUrl) {
186
197
  console.log(APP_PREFIX, '🌟 Public URL:', chalk.magenta(this.runPublicUrl));
187
198
  }
188
-
189
199
  }
190
200
  if (this.runUrl && this.proceed) {
191
201
  const notFinishedMessage = chalk.yellow.bold('Run was not finished because of $TESTOMATIO_PROCEED');
@@ -197,19 +207,30 @@ class TestomatioPipe {
197
207
  // eslint-disable-next-line max-len
198
208
  console.log(APP_PREFIX, chalk.yellow.bold('⚠️ Some reported tests were not found in Testomat.io project'));
199
209
  // eslint-disable-next-line max-len
200
- console.log(APP_PREFIX, `If you use Testomat.io as a reporter only, please re-run tests using ${chalk.bold('TESTOMATIO_CREATE=1')}`);
210
+ console.log(
211
+ APP_PREFIX,
212
+ `If you use Testomat.io as a reporter only, please re-run tests using ${chalk.bold('TESTOMATIO_CREATE=1')}`,
213
+ );
201
214
  // eslint-disable-next-line max-len
202
- console.log(APP_PREFIX, `But to keep your tests consistent it is recommended to ${chalk.bold('import tests first')}`);
215
+ console.log(
216
+ APP_PREFIX,
217
+ `But to keep your tests consistent it is recommended to ${chalk.bold('import tests first')}`,
218
+ );
203
219
  console.log(APP_PREFIX, 'If tests were imported but still not matched, assign test IDs to your tests.');
204
220
  console.log(APP_PREFIX, 'You can do that automatically via command line tools:');
205
221
  console.log(APP_PREFIX, chalk.bold('npx check-tests ... --update-ids'), 'See: https://bit.ly/js-update-ids');
206
222
  console.log(APP_PREFIX, 'or for Cucumber:');
207
223
  // eslint-disable-next-line max-len
208
- console.log(APP_PREFIX, chalk.bold('npx check-cucumber ... --update-ids'), 'See: https://bit.ly/bdd-update-ids');
224
+ console.log(
225
+ APP_PREFIX,
226
+ chalk.bold('npx check-cucumber ... --update-ids'),
227
+ 'See: https://bit.ly/bdd-update-ids',
228
+ );
209
229
  }
210
230
  } catch (err) {
211
231
  console.log(APP_PREFIX, 'Error updating status, skipping...', err);
212
232
  }
233
+ debug('Run finished');
213
234
  }
214
235
 
215
236
  toString() {
@@ -219,17 +240,16 @@ class TestomatioPipe {
219
240
 
220
241
  module.exports = TestomatioPipe;
221
242
 
222
-
223
- function setS3Credentials(artifacts) {
243
+ function setS3Credentials(artifacts) {
224
244
  if (!Object.keys(artifacts).length) return;
225
245
 
226
246
  console.log(APP_PREFIX, 'S3 were credentials obtained from Testomat.io...');
227
247
 
228
- if (artifacts.ACCESS_KEY_ID) process.env.S3_ACCESS_KEY_ID = artifacts.ACCESS_KEY_ID;
229
- if (artifacts.SECRET_ACCESS_KEY) process.env.S3_SECRET_ACCESS_KEY = artifacts.SECRET_ACCESS_KEY;
230
- if (artifacts.REGION) process.env.S3_REGION = artifacts.REGION;
231
- if (artifacts.BUCKET) process.env.S3_BUCKET = artifacts.BUCKET;
232
- if (artifacts.ENDPOINT) process.env.S3_ENDPOINT = artifacts.ENDPOINT;
233
- if (artifacts.presign) process.env.TESTOMATIO_PRIVATE_ARTIFACTS = '1';
248
+ if (artifacts.ACCESS_KEY_ID) process.env.S3_ACCESS_KEY_ID = artifacts.ACCESS_KEY_ID;
249
+ if (artifacts.SECRET_ACCESS_KEY) process.env.S3_SECRET_ACCESS_KEY = artifacts.SECRET_ACCESS_KEY;
250
+ if (artifacts.REGION) process.env.S3_REGION = artifacts.REGION;
251
+ if (artifacts.BUCKET) process.env.S3_BUCKET = artifacts.BUCKET;
252
+ if (artifacts.ENDPOINT) process.env.S3_ENDPOINT = artifacts.ENDPOINT;
253
+ if (artifacts.presign) process.env.TESTOMATIO_PRIVATE_ARTIFACTS = '1';
234
254
  resetConfig();
235
255
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testomatio/reporter",
3
- "version": "1.0.13",
3
+ "version": "1.0.14-beta",
4
4
  "description": "Testomatio Reporter Client",
5
5
  "main": "./lib/reporter.js",
6
6
  "typings": "typings/index.d.ts",
package/Changelog.md DELETED
@@ -1,322 +0,0 @@
1
- <!-- pending release updates -->
2
- # 1.0.13
3
-
4
- * JUnit improvements
5
- * Match test from source code by adding Test ID as a comment:
6
-
7
- ```java
8
- // @T8acca9eb
9
- ```
10
- * Match test from output by adding Test ID as output:
11
-
12
- ```java
13
- System.out.println("tid://@T8acca9eb");
14
- ```
15
- * Support for suite before and after output
16
- * Improved support for artifacts
17
-
18
- # 1.0.12
19
-
20
- & Logger refactoring by @olexandr13 in #208
21
- * fix undefined logs by @olexandr13 in #210
22
-
23
- # 1.0.11
24
-
25
- * fix steps duplication for codecept report by @olexandr13 in #209
26
-
27
- # 1.0.10
28
-
29
- * Added `TESTOMATIO_PUBLISH=1` variable to automatically publish run report
30
-
31
- # 1.0.9
32
-
33
- * Support XUnit format
34
- * Improved support for parametrized Java tests
35
-
36
- # 1.0.8
37
-
38
- * Fixed `Can't read push of undefined` when logging steps
39
-
40
- # 1.0.6
41
-
42
- * Testomat.io. Auto-detect current build url and report it to Testomat.io. Manually url can be set with `BUILD_URL` variable:
43
-
44
- ```
45
- BUILD_URL=https://.... TESTOMATIO=apiKey <actual test command>
46
- ```
47
-
48
- # 1.0.5
49
-
50
- * Fix "create tests" params processing for testomatio pipe
51
-
52
- # 1.0.4
53
-
54
- * Fixed parallel run
55
-
56
- # 1.0.3
57
-
58
- * Fixed reporting parallel runs
59
-
60
- # 1.0.0
61
-
62
-
63
- * 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
64
- * Reworked [documentation](https://github.com/testomatio/reporter/tree/master#readme).
65
- * Added an option to obtain [S3 configuration](https://github.com/testomatio/reporter/blob/master/docs/artifacts.md#configuration) from Testomat.io
66
- * Introduced [pipes](https://github.com/testomatio/reporter/blob/master/docs/pipes.md):
67
- * GitHub
68
- * GitLab
69
- * CSV Pipe
70
-
71
-
72
- # 0.7.6
73
-
74
- * Updated to use AWS S3 3.0 SDK for uploading
75
-
76
- # 0.7.5
77
-
78
- * Fixed reporting skipped tests in mocha
79
-
80
- # 0.7.4
81
-
82
- * Fixed parsing source code in JUnit files
83
-
84
- # 0.7.3
85
-
86
- * CodeceptJS: Upload all traces and videos from artifacts
87
- * Fixed reporting skipped test in XML
88
- * added `--timelimit` option to `report-xml` command line
89
-
90
- # 0.7.2
91
-
92
- * Fixed uploading non-existing file
93
-
94
- # 0.7.1
95
-
96
- * Support for NUnit XML v3 format
97
-
98
- # 0.7.0
99
-
100
- * Support for `@cucumber/cucumber` (>= 7.0) added
101
- * Initial support for C# and NUnit
102
-
103
- # 0.6.10
104
-
105
- * Fixed uploading multilpe artifacts in Playwright
106
-
107
- # 0.6.9
108
-
109
- * Fixed pending tests reports for Cypress
110
-
111
- # 0.6.8
112
- # 0.6.7
113
-
114
- * Pytest: fixed creating suites from reports
115
-
116
- # 0.6.6
117
-
118
- * JUnit reporter: prefer suite title over testcase classname in a report
119
-
120
- # 0.6.5
121
-
122
- * Fixed test statuses for runs in JUnit reporter
123
-
124
- # 0.6.4
125
-
126
- * Added `TESTOMATIO_PROCEED=1` param to not close current run
127
- * Fixed priority of commands from `npx @testomatio/reporter`
128
-
129
- # 0.6.3
130
-
131
- * Fixed `npx start-test-run` to launch commands
132
-
133
- # 0.6.2
134
-
135
- * Added `--env-file` option to load env variables from env file
136
-
137
- # 0.6.1
138
-
139
- * Fixed creating RunGroup with JUnit reporter
140
-
141
- # 0.6.0
142
-
143
- * JUnit reporter support
144
-
145
- # 0.5.10
146
-
147
- * Fixed reporting Scenario Outline in Cypress-Cucumber
148
- * Fixed error reports for Cypress when running in Chrome
149
-
150
- # 0.5.9
151
-
152
- * Added environment on Cypress report
153
-
154
- # 0.5.8
155
-
156
- * Fixed Cypress.io reporting
157
-
158
- # 0.5.7
159
-
160
- * Fixed webdriverio artifacts
161
-
162
- # 0.5.6
163
-
164
- * Unmark failed CodeceptJS tests as skipped
165
-
166
- # 0.5.5
167
-
168
- * Fixed `BeforeSuite` failures in CodeceptJS
169
-
170
- # 0.5.4
171
-
172
- Added `TESTOMATIO_CREATE=1` option to create unmatched tests on report
173
-
174
- ```
175
- TESTOMATIO_CREATE=1 TESTOMATIO=apiKey npx codeceptjs run
176
- ```
177
-
178
- # 0.5.3
179
-
180
- * Fixed parsing suites
181
-
182
- # 0.5.2
183
-
184
- * Fixed multiple upload of artifacts in Cypress.io
185
-
186
- # 0.5.1
187
-
188
- * Fixed Cypress.io to report tests inside nested suites
189
-
190
- # 0.5.0
191
-
192
- * Added Cypress.io plugin
193
- * Added artifacts upload to webdriverio
194
-
195
- # 0.4.6
196
-
197
- - Fixed CodeceptJS reporter to report tests failed in hooks
198
-
199
- # 0.4.5
200
-
201
- - Fixed "Total XX artifacts publicly uploaded to S3 bucket" when no S3 bucket is configured
202
- - Improved S3 connection error messages
203
-
204
- # 0.4.4
205
-
206
- - 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.
207
-
208
- # 0.4.3
209
-
210
- - Added `TESTOMATIO_DISABLE_ARTIFACTS` env variable to disable publishing artifacts.
211
-
212
- # 0.4.2
213
-
214
- - print version of reporter
215
- - print number of uploaded artifacts
216
- - print access mode for uploaded artifacts
217
-
218
- # 0.4.1
219
-
220
- Added `global.testomatioArtifacts = []` array which can be used to add arbitrary artifacts to a report.
221
-
222
- ```js
223
- // inside a running test:
224
- global.testomatioArtifacts.push('file/to/upload.png');
225
- ```
226
-
227
- # 0.4.0
228
-
229
- - Playwright: Introduced playwright/test support with screenshots and video artifacts
230
-
231
- > Known issues: reporting using projects configured in Playwright does not work yet
232
-
233
- - CodeceptJS: added video uploads
234
-
235
- # 0.3.16
236
-
237
- - CodeceptJS: fixed reporting tests with empty steps (on retry)
238
-
239
- # 0.3.15
240
-
241
- - Finish Run via API:
242
-
243
- ```
244
- TESTOMATIO={apiKey} TESTOMATIO_RUN={runId} npx @testomatio/reporter@latest --finish
245
- ```
246
-
247
- # 0.3.14
248
-
249
- - Create an empty Run via API:
250
-
251
- ```
252
- TESTOMATIO={apiKey} npx @testomatio/reporter@latest --launch
253
- ```
254
-
255
- # 0.3.13
256
-
257
- - Checking for a valid report URL
258
- - Sending unlimited data on test report
259
-
260
- # 0.3.12
261
-
262
- - Fixed submitting arbitrary data on a test run
263
- - Jest: fixed sending errors with stack traces
264
- - Cypress: fixed sending reports
265
-
266
- # 0.3.11
267
-
268
- - Fixed circular JSON reference when submitting data to Testomatio
269
-
270
- # 0.3.10
271
-
272
- - Minor fixes
273
-
274
- # 0.3.9
275
-
276
- - Making all reporters to run without API key
277
-
278
- # 0.3.8
279
-
280
- - Fixed `npx start-test-run` to work with empty API keys
281
-
282
- # 0.3.7
283
-
284
- - Fixed release
285
-
286
- # 0.3.6
287
-
288
- - Update title and rungroup on start for scheduled runs.
289
-
290
- # 0.3.5
291
-
292
- - Added `TESTOMATIO_RUN` environment variable to pass id of a specific run to report
293
-
294
- # 0.3.4
295
-
296
- - Minor fixes
297
-
298
- # 0.3.3
299
-
300
- - [CodeceptJS] Fixed stack trace reporting
301
- - [CodeceptJS] Fixed displaying of nested steps
302
- - [CodeceptJS][mocha] Added assertion diff to report
303
-
304
- # 0.3.2
305
-
306
- - Fixed error message for S3 uploading
307
-
308
- # 0.3.1
309
-
310
- - [CodeceptJS] Better formatter for nested structures and BDD tests
311
-
312
- # 0.3.0
313
-
314
- - Added `TESTOMATIO_TITLE` env variable to set a name for Run
315
- - Added `TESTOMATIO_RUNGROUP_TITLE` env variable to attach Run to RunGroup
316
- - Added `TESTOMATIO_ENV` env variable to attach additional env values to report
317
- - [CodeceptJS] **CodeceptJS v3 support**
318
- - [CodeceptJS] Dropped support for CodeceptJS 2
319
- - [CodeceptJS] Added support for before hooks
320
- - [CodeceptJS] Log of steps
321
- - [CodeceptJS] Upload screenshots of failed tests to S3
322
- - [CodeceptJS] Updated to use with parallel execution