@testomatio/reporter 1.0.15-beta → 1.0.15-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 +340 -0
- package/lib/_ArtifactStorageOld.js +1 -1
- package/lib/adapter/codecept.js +1 -1
- package/lib/adapter/cucumber/current.js +1 -1
- package/lib/adapter/cucumber/legacy.js +1 -1
- package/lib/adapter/cypress-plugin/index.js +1 -1
- package/lib/adapter/jasmine.js +1 -1
- package/lib/adapter/jest.js +1 -1
- package/lib/adapter/mocha.js +1 -1
- package/lib/adapter/playwright.js +1 -1
- package/lib/adapter/webdriver.js +1 -1
- package/lib/bin/startTest.js +25 -4
- package/lib/client.js +55 -0
- package/lib/dataStorage.js +2 -2
- package/lib/pipe/csv.js +4 -1
- package/lib/pipe/github.js +5 -16
- package/lib/pipe/gitlab.js +5 -16
- package/lib/pipe/testomatio.js +79 -48
- package/lib/utils/pipe_utils.js +135 -0
- package/lib/{util.js → utils/utils.js} +11 -1
- package/lib/xmlReader.js +3 -3
- package/package.json +2 -2
package/Changelog.md
ADDED
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
<!-- pending release updates -->
|
|
2
|
+
# 1.0.15
|
|
3
|
+
|
|
4
|
+
* Attach Run to Jira Issue via `TESTOMATIO_JIRA_ID` env variable:
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
TESTOMATIO_JIRA_ID=TST-12 <actual run command>
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
# 1.0.14
|
|
11
|
+
|
|
12
|
+
* Execute tests by tag names. Use this filter to select tests associated with specific tags.
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
TESTOMATIO={API_KEY} npx start-test-run -c 'actual run command' --filter 'testomatio:tag-name=smoke'
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
* more instruction you can find in docs/pipes/testomatio.md
|
|
19
|
+
|
|
20
|
+
# 1.0.13
|
|
21
|
+
|
|
22
|
+
* JUnit improvements
|
|
23
|
+
* Match test from source code by adding Test ID as a comment:
|
|
24
|
+
|
|
25
|
+
```java
|
|
26
|
+
// @T8acca9eb
|
|
27
|
+
```
|
|
28
|
+
* Match test from output by adding Test ID as output:
|
|
29
|
+
|
|
30
|
+
```java
|
|
31
|
+
System.out.println("tid://@T8acca9eb");
|
|
32
|
+
```
|
|
33
|
+
* Support for suite before and after output
|
|
34
|
+
* Improved support for artifacts
|
|
35
|
+
|
|
36
|
+
# 1.0.12
|
|
37
|
+
|
|
38
|
+
& Logger refactoring by @olexandr13 in #208
|
|
39
|
+
* fix undefined logs by @olexandr13 in #210
|
|
40
|
+
|
|
41
|
+
# 1.0.11
|
|
42
|
+
|
|
43
|
+
* fix steps duplication for codecept report by @olexandr13 in #209
|
|
44
|
+
|
|
45
|
+
# 1.0.10
|
|
46
|
+
|
|
47
|
+
* Added `TESTOMATIO_PUBLISH=1` variable to automatically publish run report
|
|
48
|
+
|
|
49
|
+
# 1.0.9
|
|
50
|
+
|
|
51
|
+
* Support XUnit format
|
|
52
|
+
* Improved support for parametrized Java tests
|
|
53
|
+
|
|
54
|
+
# 1.0.8
|
|
55
|
+
|
|
56
|
+
* Fixed `Can't read push of undefined` when logging steps
|
|
57
|
+
|
|
58
|
+
# 1.0.6
|
|
59
|
+
|
|
60
|
+
* Testomat.io. Auto-detect current build url and report it to Testomat.io. Manually url can be set with `BUILD_URL` variable:
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
BUILD_URL=https://.... TESTOMATIO=apiKey <actual test command>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
# 1.0.5
|
|
67
|
+
|
|
68
|
+
* Fix "create tests" params processing for testomatio pipe
|
|
69
|
+
|
|
70
|
+
# 1.0.4
|
|
71
|
+
|
|
72
|
+
* Fixed parallel run
|
|
73
|
+
|
|
74
|
+
# 1.0.3
|
|
75
|
+
|
|
76
|
+
* Fixed reporting parallel runs
|
|
77
|
+
|
|
78
|
+
# 1.0.0
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
* 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
|
|
82
|
+
* Reworked [documentation](https://github.com/testomatio/reporter/tree/master#readme).
|
|
83
|
+
* Added an option to obtain [S3 configuration](https://github.com/testomatio/reporter/blob/master/docs/artifacts.md#configuration) from Testomat.io
|
|
84
|
+
* Introduced [pipes](https://github.com/testomatio/reporter/blob/master/docs/pipes.md):
|
|
85
|
+
* GitHub
|
|
86
|
+
* GitLab
|
|
87
|
+
* CSV Pipe
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
# 0.7.6
|
|
91
|
+
|
|
92
|
+
* Updated to use AWS S3 3.0 SDK for uploading
|
|
93
|
+
|
|
94
|
+
# 0.7.5
|
|
95
|
+
|
|
96
|
+
* Fixed reporting skipped tests in mocha
|
|
97
|
+
|
|
98
|
+
# 0.7.4
|
|
99
|
+
|
|
100
|
+
* Fixed parsing source code in JUnit files
|
|
101
|
+
|
|
102
|
+
# 0.7.3
|
|
103
|
+
|
|
104
|
+
* CodeceptJS: Upload all traces and videos from artifacts
|
|
105
|
+
* Fixed reporting skipped test in XML
|
|
106
|
+
* added `--timelimit` option to `report-xml` command line
|
|
107
|
+
|
|
108
|
+
# 0.7.2
|
|
109
|
+
|
|
110
|
+
* Fixed uploading non-existing file
|
|
111
|
+
|
|
112
|
+
# 0.7.1
|
|
113
|
+
|
|
114
|
+
* Support for NUnit XML v3 format
|
|
115
|
+
|
|
116
|
+
# 0.7.0
|
|
117
|
+
|
|
118
|
+
* Support for `@cucumber/cucumber` (>= 7.0) added
|
|
119
|
+
* Initial support for C# and NUnit
|
|
120
|
+
|
|
121
|
+
# 0.6.10
|
|
122
|
+
|
|
123
|
+
* Fixed uploading multilpe artifacts in Playwright
|
|
124
|
+
|
|
125
|
+
# 0.6.9
|
|
126
|
+
|
|
127
|
+
* Fixed pending tests reports for Cypress
|
|
128
|
+
|
|
129
|
+
# 0.6.8
|
|
130
|
+
# 0.6.7
|
|
131
|
+
|
|
132
|
+
* Pytest: fixed creating suites from reports
|
|
133
|
+
|
|
134
|
+
# 0.6.6
|
|
135
|
+
|
|
136
|
+
* JUnit reporter: prefer suite title over testcase classname in a report
|
|
137
|
+
|
|
138
|
+
# 0.6.5
|
|
139
|
+
|
|
140
|
+
* Fixed test statuses for runs in JUnit reporter
|
|
141
|
+
|
|
142
|
+
# 0.6.4
|
|
143
|
+
|
|
144
|
+
* Added `TESTOMATIO_PROCEED=1` param to not close current run
|
|
145
|
+
* Fixed priority of commands from `npx @testomatio/reporter`
|
|
146
|
+
|
|
147
|
+
# 0.6.3
|
|
148
|
+
|
|
149
|
+
* Fixed `npx start-test-run` to launch commands
|
|
150
|
+
|
|
151
|
+
# 0.6.2
|
|
152
|
+
|
|
153
|
+
* Added `--env-file` option to load env variables from env file
|
|
154
|
+
|
|
155
|
+
# 0.6.1
|
|
156
|
+
|
|
157
|
+
* Fixed creating RunGroup with JUnit reporter
|
|
158
|
+
|
|
159
|
+
# 0.6.0
|
|
160
|
+
|
|
161
|
+
* JUnit reporter support
|
|
162
|
+
|
|
163
|
+
# 0.5.10
|
|
164
|
+
|
|
165
|
+
* Fixed reporting Scenario Outline in Cypress-Cucumber
|
|
166
|
+
* Fixed error reports for Cypress when running in Chrome
|
|
167
|
+
|
|
168
|
+
# 0.5.9
|
|
169
|
+
|
|
170
|
+
* Added environment on Cypress report
|
|
171
|
+
|
|
172
|
+
# 0.5.8
|
|
173
|
+
|
|
174
|
+
* Fixed Cypress.io reporting
|
|
175
|
+
|
|
176
|
+
# 0.5.7
|
|
177
|
+
|
|
178
|
+
* Fixed webdriverio artifacts
|
|
179
|
+
|
|
180
|
+
# 0.5.6
|
|
181
|
+
|
|
182
|
+
* Unmark failed CodeceptJS tests as skipped
|
|
183
|
+
|
|
184
|
+
# 0.5.5
|
|
185
|
+
|
|
186
|
+
* Fixed `BeforeSuite` failures in CodeceptJS
|
|
187
|
+
|
|
188
|
+
# 0.5.4
|
|
189
|
+
|
|
190
|
+
Added `TESTOMATIO_CREATE=1` option to create unmatched tests on report
|
|
191
|
+
|
|
192
|
+
```
|
|
193
|
+
TESTOMATIO_CREATE=1 TESTOMATIO=apiKey npx codeceptjs run
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
# 0.5.3
|
|
197
|
+
|
|
198
|
+
* Fixed parsing suites
|
|
199
|
+
|
|
200
|
+
# 0.5.2
|
|
201
|
+
|
|
202
|
+
* Fixed multiple upload of artifacts in Cypress.io
|
|
203
|
+
|
|
204
|
+
# 0.5.1
|
|
205
|
+
|
|
206
|
+
* Fixed Cypress.io to report tests inside nested suites
|
|
207
|
+
|
|
208
|
+
# 0.5.0
|
|
209
|
+
|
|
210
|
+
* Added Cypress.io plugin
|
|
211
|
+
* Added artifacts upload to webdriverio
|
|
212
|
+
|
|
213
|
+
# 0.4.6
|
|
214
|
+
|
|
215
|
+
- Fixed CodeceptJS reporter to report tests failed in hooks
|
|
216
|
+
|
|
217
|
+
# 0.4.5
|
|
218
|
+
|
|
219
|
+
- Fixed "Total XX artifacts publicly uploaded to S3 bucket" when no S3 bucket is configured
|
|
220
|
+
- Improved S3 connection error messages
|
|
221
|
+
|
|
222
|
+
# 0.4.4
|
|
223
|
+
|
|
224
|
+
- 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.
|
|
225
|
+
|
|
226
|
+
# 0.4.3
|
|
227
|
+
|
|
228
|
+
- Added `TESTOMATIO_DISABLE_ARTIFACTS` env variable to disable publishing artifacts.
|
|
229
|
+
|
|
230
|
+
# 0.4.2
|
|
231
|
+
|
|
232
|
+
- print version of reporter
|
|
233
|
+
- print number of uploaded artifacts
|
|
234
|
+
- print access mode for uploaded artifacts
|
|
235
|
+
|
|
236
|
+
# 0.4.1
|
|
237
|
+
|
|
238
|
+
Added `global.testomatioArtifacts = []` array which can be used to add arbitrary artifacts to a report.
|
|
239
|
+
|
|
240
|
+
```js
|
|
241
|
+
// inside a running test:
|
|
242
|
+
global.testomatioArtifacts.push('file/to/upload.png');
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
# 0.4.0
|
|
246
|
+
|
|
247
|
+
- Playwright: Introduced playwright/test support with screenshots and video artifacts
|
|
248
|
+
|
|
249
|
+
> Known issues: reporting using projects configured in Playwright does not work yet
|
|
250
|
+
|
|
251
|
+
- CodeceptJS: added video uploads
|
|
252
|
+
|
|
253
|
+
# 0.3.16
|
|
254
|
+
|
|
255
|
+
- CodeceptJS: fixed reporting tests with empty steps (on retry)
|
|
256
|
+
|
|
257
|
+
# 0.3.15
|
|
258
|
+
|
|
259
|
+
- Finish Run via API:
|
|
260
|
+
|
|
261
|
+
```
|
|
262
|
+
TESTOMATIO={apiKey} TESTOMATIO_RUN={runId} npx @testomatio/reporter@latest --finish
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
# 0.3.14
|
|
266
|
+
|
|
267
|
+
- Create an empty Run via API:
|
|
268
|
+
|
|
269
|
+
```
|
|
270
|
+
TESTOMATIO={apiKey} npx @testomatio/reporter@latest --launch
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
# 0.3.13
|
|
274
|
+
|
|
275
|
+
- Checking for a valid report URL
|
|
276
|
+
- Sending unlimited data on test report
|
|
277
|
+
|
|
278
|
+
# 0.3.12
|
|
279
|
+
|
|
280
|
+
- Fixed submitting arbitrary data on a test run
|
|
281
|
+
- Jest: fixed sending errors with stack traces
|
|
282
|
+
- Cypress: fixed sending reports
|
|
283
|
+
|
|
284
|
+
# 0.3.11
|
|
285
|
+
|
|
286
|
+
- Fixed circular JSON reference when submitting data to Testomatio
|
|
287
|
+
|
|
288
|
+
# 0.3.10
|
|
289
|
+
|
|
290
|
+
- Minor fixes
|
|
291
|
+
|
|
292
|
+
# 0.3.9
|
|
293
|
+
|
|
294
|
+
- Making all reporters to run without API key
|
|
295
|
+
|
|
296
|
+
# 0.3.8
|
|
297
|
+
|
|
298
|
+
- Fixed `npx start-test-run` to work with empty API keys
|
|
299
|
+
|
|
300
|
+
# 0.3.7
|
|
301
|
+
|
|
302
|
+
- Fixed release
|
|
303
|
+
|
|
304
|
+
# 0.3.6
|
|
305
|
+
|
|
306
|
+
- Update title and rungroup on start for scheduled runs.
|
|
307
|
+
|
|
308
|
+
# 0.3.5
|
|
309
|
+
|
|
310
|
+
- Added `TESTOMATIO_RUN` environment variable to pass id of a specific run to report
|
|
311
|
+
|
|
312
|
+
# 0.3.4
|
|
313
|
+
|
|
314
|
+
- Minor fixes
|
|
315
|
+
|
|
316
|
+
# 0.3.3
|
|
317
|
+
|
|
318
|
+
- [CodeceptJS] Fixed stack trace reporting
|
|
319
|
+
- [CodeceptJS] Fixed displaying of nested steps
|
|
320
|
+
- [CodeceptJS][mocha] Added assertion diff to report
|
|
321
|
+
|
|
322
|
+
# 0.3.2
|
|
323
|
+
|
|
324
|
+
- Fixed error message for S3 uploading
|
|
325
|
+
|
|
326
|
+
# 0.3.1
|
|
327
|
+
|
|
328
|
+
- [CodeceptJS] Better formatter for nested structures and BDD tests
|
|
329
|
+
|
|
330
|
+
# 0.3.0
|
|
331
|
+
|
|
332
|
+
- Added `TESTOMATIO_TITLE` env variable to set a name for Run
|
|
333
|
+
- Added `TESTOMATIO_RUNGROUP_TITLE` env variable to attach Run to RunGroup
|
|
334
|
+
- Added `TESTOMATIO_ENV` env variable to attach additional env values to report
|
|
335
|
+
- [CodeceptJS] **CodeceptJS v3 support**
|
|
336
|
+
- [CodeceptJS] Dropped support for CodeceptJS 2
|
|
337
|
+
- [CodeceptJS] Added support for before hooks
|
|
338
|
+
- [CodeceptJS] Log of steps
|
|
339
|
+
- [CodeceptJS] Upload screenshots of failed tests to S3
|
|
340
|
+
- [CodeceptJS] Updated to use with parallel execution
|
|
@@ -4,7 +4,7 @@ const fs = require('fs');
|
|
|
4
4
|
const os = require('os');
|
|
5
5
|
const uuid = require('uuid');
|
|
6
6
|
const { TESTOMAT_ARTIFACT_SUFFIX } = require('./constants');
|
|
7
|
-
const { specificTestInfo } = require('./
|
|
7
|
+
const { specificTestInfo } = require('./utils/utils');
|
|
8
8
|
|
|
9
9
|
class ArtifactStorage {
|
|
10
10
|
|
package/lib/adapter/codecept.js
CHANGED
|
@@ -3,7 +3,7 @@ const chalk = require('chalk');
|
|
|
3
3
|
const TestomatClient = require('../client');
|
|
4
4
|
const { STATUS, APP_PREFIX, TESTOMAT_TMP_STORAGE } = require('../constants');
|
|
5
5
|
const upload = require('../fileUploader');
|
|
6
|
-
const { parseTest: getIdFromTestTitle, fileSystem } = require('../
|
|
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
|
|
@@ -5,7 +5,7 @@ const fs = require('fs');
|
|
|
5
5
|
const { STATUS, TESTOMAT_TMP_STORAGE } = require('../../constants');
|
|
6
6
|
const TestomatClient = require('../../client');
|
|
7
7
|
const logger = require('../../logger');
|
|
8
|
-
const { parseTest, fileSystem } = require('../../
|
|
8
|
+
const { parseTest, fileSystem } = require('../../utils/utils');
|
|
9
9
|
|
|
10
10
|
const { GherkinDocumentParser, PickleParser } = formatterHelpers;
|
|
11
11
|
const { getGherkinScenarioLocationMap, getGherkinStepMap } = GherkinDocumentParser;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// eslint-disable-next-line global-require, import/no-extraneous-dependencies, import/no-unresolved
|
|
2
2
|
const { Formatter } = require('cucumber');
|
|
3
3
|
const chalk = require('chalk');
|
|
4
|
-
const { parseTest, fileSystem } = require('../../
|
|
4
|
+
const { parseTest, fileSystem } = require('../../utils/utils');
|
|
5
5
|
const { STATUS, TESTOMAT_TMP_STORAGE } = require('../../constants');
|
|
6
6
|
const TestomatClient = require('../../client');
|
|
7
7
|
|
package/lib/adapter/jasmine.js
CHANGED
package/lib/adapter/jest.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const TestomatClient = require('../client');
|
|
2
2
|
const { STATUS, TESTOMAT_TMP_STORAGE } = require('../constants');
|
|
3
|
-
const { parseTest, ansiRegExp, fileSystem } = require('../
|
|
3
|
+
const { parseTest, ansiRegExp, fileSystem } = require('../utils/utils');
|
|
4
4
|
|
|
5
5
|
class JestReporter {
|
|
6
6
|
constructor(globalConfig, options) {
|
package/lib/adapter/mocha.js
CHANGED
|
@@ -4,7 +4,7 @@ const debug = require('debug')('@testomatio/reporter:adapter:mocha');
|
|
|
4
4
|
const chalk = require('chalk');
|
|
5
5
|
const TestomatClient = require('../client');
|
|
6
6
|
const { STATUS, TESTOMAT_TMP_STORAGE } = require('../constants');
|
|
7
|
-
const { parseTest, specificTestInfo, fileSystem } = require('../
|
|
7
|
+
const { parseTest, specificTestInfo, fileSystem } = require('../utils/utils');
|
|
8
8
|
const ArtifactStorage = require('../_ArtifactStorageOld');
|
|
9
9
|
|
|
10
10
|
const { EVENT_RUN_BEGIN, EVENT_RUN_END, EVENT_TEST_FAIL, EVENT_TEST_PASS, EVENT_TEST_PENDING } =
|
|
@@ -6,7 +6,7 @@ const fs = require('fs');
|
|
|
6
6
|
const { APP_PREFIX, STATUS: Status, TESTOMAT_TMP_STORAGE } = require('../constants');
|
|
7
7
|
const TestomatioClient = require('../client');
|
|
8
8
|
const { isArtifactsEnabled } = require('../fileUploader');
|
|
9
|
-
const { parseTest, fileSystem } = require('../
|
|
9
|
+
const { parseTest, fileSystem } = require('../utils/utils');
|
|
10
10
|
|
|
11
11
|
const reportTestPromises = [];
|
|
12
12
|
|
package/lib/adapter/webdriver.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// eslint-disable-next-line global-require, import/no-extraneous-dependencies
|
|
2
2
|
const WDIOReporter = require('@wdio/reporter').default;
|
|
3
3
|
const TestomatClient = require('../client');
|
|
4
|
-
const { parseTest } = require('../
|
|
4
|
+
const { parseTest } = require('../utils/utils');
|
|
5
5
|
|
|
6
6
|
class WebdriverReporter extends WDIOReporter {
|
|
7
7
|
constructor(options) {
|
package/lib/bin/startTest.js
CHANGED
|
@@ -13,9 +13,11 @@ program
|
|
|
13
13
|
.option('--launch', 'Start a new run and return its ID')
|
|
14
14
|
.option('--finish', 'Finish Run by its ID')
|
|
15
15
|
.option("--env-file <envfile>", "Load environment variables from env file")
|
|
16
|
-
.
|
|
16
|
+
.option("--filter <filter>", "Additional execution filter")
|
|
17
|
+
.action(async (opts) => {
|
|
18
|
+
const { launch, finish, filter } = opts;
|
|
19
|
+
let { command } = opts;
|
|
17
20
|
|
|
18
|
-
const { command, launch, finish } = opts;
|
|
19
21
|
if (opts.envFile) require('dotenv').config(opts.envFile); // eslint-disable-line
|
|
20
22
|
|
|
21
23
|
const apiKey = process.env['INPUT_TESTOMATIO-KEY'] || process.env.TESTOMATIO;
|
|
@@ -51,6 +53,27 @@ program
|
|
|
51
53
|
|
|
52
54
|
let exitCode = 0;
|
|
53
55
|
|
|
56
|
+
const client = new TestomatClient({ apiKey, title, parallel: true });
|
|
57
|
+
|
|
58
|
+
if(filter) {
|
|
59
|
+
const [pipe, ...optsArray] = filter.split(":");
|
|
60
|
+
const pipeOptions = optsArray.join(":");
|
|
61
|
+
|
|
62
|
+
try {
|
|
63
|
+
const tests = await client.prepareRun({pipe, pipeOptions});
|
|
64
|
+
|
|
65
|
+
if(!tests || tests.length === 0) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const grep = ` --grep (${tests.join('|')})`;
|
|
70
|
+
command += grep;
|
|
71
|
+
}
|
|
72
|
+
catch(err) {
|
|
73
|
+
console.log(APP_PREFIX, err);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
54
77
|
if (!command.split) {
|
|
55
78
|
process.exitCode = 255;
|
|
56
79
|
console.log(APP_PREFIX, `No command provided. Use -c option to launch a test runner.`);
|
|
@@ -73,8 +96,6 @@ program
|
|
|
73
96
|
return;
|
|
74
97
|
}
|
|
75
98
|
|
|
76
|
-
const client = new TestomatClient({ apiKey, title, parallel: true });
|
|
77
|
-
|
|
78
99
|
client.createRun().then(() => {
|
|
79
100
|
const cmd = spawn(testCmds[0], testCmds.slice(1), { stdio: 'inherit' });
|
|
80
101
|
|
package/lib/client.js
CHANGED
|
@@ -27,9 +27,64 @@ class Client {
|
|
|
27
27
|
this.queue = Promise.resolve();
|
|
28
28
|
this.totalUploaded = 0;
|
|
29
29
|
this.version = JSON.parse(fs.readFileSync(join(__dirname, '..', 'package.json')).toString()).version;
|
|
30
|
+
this.executionList = Promise.resolve();
|
|
31
|
+
|
|
30
32
|
console.log(APP_PREFIX, `Testomatio Reporter v${this.version}`);
|
|
31
33
|
}
|
|
32
34
|
|
|
35
|
+
/**
|
|
36
|
+
* Asynchronously prepares the execution list for running tests through various pipes.
|
|
37
|
+
* Each pipe in the client is checked for enablement,
|
|
38
|
+
* and if all pipes are disabled, the function returns a resolved Promise.
|
|
39
|
+
* Otherwise, it executes the `prepareRun` method for each enabled pipe and collects the results.
|
|
40
|
+
* The results are then filtered to remove any undefined values.
|
|
41
|
+
* If no valid results are found, the function returns undefined.
|
|
42
|
+
* Otherwise, it returns the first non-empty array from the filtered results.
|
|
43
|
+
*
|
|
44
|
+
* @param {Object} params - The options for preparing the test execution list.
|
|
45
|
+
* @param {string} params.pipe - Name of the executed pipe.
|
|
46
|
+
* @param {string} params.pipeOptions - Filter option.
|
|
47
|
+
* @returns {Promise<any>} - A Promise that resolves to an
|
|
48
|
+
* array containing the prepared execution list,
|
|
49
|
+
* or resolves to undefined if no valid results are found or if all pipes are disabled.
|
|
50
|
+
*/
|
|
51
|
+
async prepareRun(params) {
|
|
52
|
+
const { pipe, pipeOptions } = params;
|
|
53
|
+
// all pipes disabled, skipping
|
|
54
|
+
if (!this.pipes.some(p => p.isEnabled)) {
|
|
55
|
+
return Promise.resolve();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
try {
|
|
59
|
+
const filterPipe = this.pipes.find(p => p.constructor.name.toLowerCase() === `${pipe.toLowerCase()}pipe`);
|
|
60
|
+
|
|
61
|
+
if (!filterPipe.isEnabled) {
|
|
62
|
+
// TODO:for the future for the another pipes
|
|
63
|
+
console.warn(
|
|
64
|
+
APP_PREFIX,
|
|
65
|
+
`At the moment processing is available only for the "testomatio" key. Example: "testomatio:tag-name=xxx"`
|
|
66
|
+
);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const results = await Promise.all(this.pipes.map(async p =>
|
|
71
|
+
({ pipe: p.toString(), result: await p.prepareRun(pipeOptions) })
|
|
72
|
+
));
|
|
73
|
+
|
|
74
|
+
const result = results.filter(p => p.pipe.includes('Testomatio'))[0]?.result;
|
|
75
|
+
|
|
76
|
+
if (!result || result.length === 0) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
debug('Execution tests list', result);
|
|
81
|
+
|
|
82
|
+
return result;
|
|
83
|
+
} catch (err) {
|
|
84
|
+
console.error(APP_PREFIX, err);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
33
88
|
/**
|
|
34
89
|
* Used to create a new Test run
|
|
35
90
|
*
|
package/lib/dataStorage.js
CHANGED
|
@@ -5,8 +5,8 @@ const os = require('os');
|
|
|
5
5
|
const { join } = require('path');
|
|
6
6
|
const JestReporter = require('./adapter/jest');
|
|
7
7
|
const { TESTOMAT_TMP_STORAGE } = require('./constants');
|
|
8
|
-
const { fileSystem } = require('./
|
|
9
|
-
const getTestIdFromTestTitle = require('./
|
|
8
|
+
const { fileSystem } = require('./utils/utils');
|
|
9
|
+
const getTestIdFromTestTitle = require('./utils/utils').parseTest;
|
|
10
10
|
|
|
11
11
|
class DataStorage {
|
|
12
12
|
/**
|
package/lib/pipe/csv.js
CHANGED
|
@@ -4,7 +4,7 @@ const fs = require('fs');
|
|
|
4
4
|
const csvWriter = require('csv-writer');
|
|
5
5
|
const chalk = require('chalk');
|
|
6
6
|
const merge = require('lodash.merge');
|
|
7
|
-
const { isSameTest, getCurrentDateTime } = require('../
|
|
7
|
+
const { isSameTest, getCurrentDateTime } = require('../utils/utils');
|
|
8
8
|
const { CSV_HEADERS } = require('../constants');
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -40,6 +40,9 @@ class CsvPipe {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
// TODO: to using SET opts as argument => prepareRun(opts)
|
|
44
|
+
async prepareRun() {}
|
|
45
|
+
|
|
43
46
|
async createRun() {
|
|
44
47
|
// empty
|
|
45
48
|
}
|
package/lib/pipe/github.js
CHANGED
|
@@ -5,7 +5,8 @@ const humanizeDuration = require('humanize-duration');
|
|
|
5
5
|
const merge = require('lodash.merge');
|
|
6
6
|
const { Octokit } = require('@octokit/rest');
|
|
7
7
|
const { APP_PREFIX } = require('../constants');
|
|
8
|
-
const { ansiRegExp, isSameTest } = require('../
|
|
8
|
+
const { ansiRegExp, isSameTest } = require('../utils/utils');
|
|
9
|
+
const { statusEmoji, fullName } = require('../utils/pipe_utils');
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* @typedef {import('../../types').Pipe} Pipe
|
|
@@ -37,6 +38,9 @@ class GitHubPipe {
|
|
|
37
38
|
debug('GitHub Pipe: Enabled');
|
|
38
39
|
}
|
|
39
40
|
|
|
41
|
+
// TODO: to using SET opts as argument => prepareRun(opts)
|
|
42
|
+
async prepareRun() {}
|
|
43
|
+
|
|
40
44
|
async createRun() {}
|
|
41
45
|
|
|
42
46
|
addTest(test) {
|
|
@@ -182,21 +186,6 @@ class GitHubPipe {
|
|
|
182
186
|
}
|
|
183
187
|
}
|
|
184
188
|
|
|
185
|
-
function statusEmoji(status) {
|
|
186
|
-
if (status === 'passed') return '🟢';
|
|
187
|
-
if (status === 'failed') return '🔴';
|
|
188
|
-
if (status === 'skipped') return '🟡';
|
|
189
|
-
return '';
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
function fullName(t) {
|
|
193
|
-
let line = '';
|
|
194
|
-
if (t.suite_title) line = `${t.suite_title}: `;
|
|
195
|
-
line += `**${t.title}**`;
|
|
196
|
-
if (t.example) line += ` \`[${Object.values(t.example)}]\``;
|
|
197
|
-
return line;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
189
|
async function deletePreviousReport(octokit, owner, repo, issue, hiddenCommentData) {
|
|
201
190
|
if (process.env.GH_KEEP_OUTDATED_REPORTS) return;
|
|
202
191
|
|
package/lib/pipe/gitlab.js
CHANGED
|
@@ -5,7 +5,8 @@ const humanizeDuration = require('humanize-duration');
|
|
|
5
5
|
const merge = require('lodash.merge');
|
|
6
6
|
const path = require('path');
|
|
7
7
|
const { APP_PREFIX } = require('../constants');
|
|
8
|
-
const { ansiRegExp, isSameTest } = require('../
|
|
8
|
+
const { ansiRegExp, isSameTest } = require('../utils/utils');
|
|
9
|
+
const { statusEmoji, fullName } = require('../utils/pipe_utils');
|
|
9
10
|
|
|
10
11
|
//! GITLAB_PAT environment variable is required for this functionality to work
|
|
11
12
|
//! and your pipeline trigger should be merge_request
|
|
@@ -46,6 +47,9 @@ class GitLabPipe {
|
|
|
46
47
|
debug('GitLab Pipe: Enabled');
|
|
47
48
|
}
|
|
48
49
|
|
|
50
|
+
// TODO: to using SET opts as argument => prepareRun(opts)
|
|
51
|
+
async prepareRun() {}
|
|
52
|
+
|
|
49
53
|
async createRun() {}
|
|
50
54
|
|
|
51
55
|
addTest(test) {
|
|
@@ -179,21 +183,6 @@ class GitLabPipe {
|
|
|
179
183
|
updateRun() {}
|
|
180
184
|
}
|
|
181
185
|
|
|
182
|
-
function statusEmoji(status) {
|
|
183
|
-
if (status === 'passed') return '🟢';
|
|
184
|
-
if (status === 'failed') return '🔴';
|
|
185
|
-
if (status === 'skipped') return '🟡';
|
|
186
|
-
return '';
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
function fullName(t) {
|
|
190
|
-
let line = '';
|
|
191
|
-
if (t.suite_title) line = `${t.suite_title}: `;
|
|
192
|
-
line += `**${t.title}**`;
|
|
193
|
-
if (t.example) line += ` \`[${Object.values(t.example)}]\``;
|
|
194
|
-
return line;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
186
|
async function deletePreviousReport(axiosInstance, commentsRequestURL, hiddenCommentData, token) {
|
|
198
187
|
if (process.env.GITLAB_KEEP_OUTDATED_REPORTS) return;
|
|
199
188
|
|
package/lib/pipe/testomatio.js
CHANGED
|
@@ -3,8 +3,8 @@ const chalk = require('chalk');
|
|
|
3
3
|
const axios = require('axios');
|
|
4
4
|
const JsonCycle = require('json-cycle');
|
|
5
5
|
const { APP_PREFIX, STATUS } = require('../constants');
|
|
6
|
-
const { isValidUrl } = require('../
|
|
7
|
-
const {
|
|
6
|
+
const { isValidUrl, foundedTestLog } = require('../utils/utils');
|
|
7
|
+
const { parseFilterParams, generateFilterRequestParams, setS3Credentials, } = require('../utils/pipe_utils');
|
|
8
8
|
|
|
9
9
|
const { TESTOMATIO_RUN } = process.env;
|
|
10
10
|
if (TESTOMATIO_RUN) {
|
|
@@ -33,12 +33,16 @@ 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
|
+
|
|
36
37
|
this.axios = axios.create({
|
|
37
|
-
|
|
38
|
+
baseURL: `${this.url.trim()}`,
|
|
39
|
+
timeout: 30000
|
|
38
40
|
});
|
|
41
|
+
|
|
39
42
|
this.isEnabled = true;
|
|
40
43
|
// do not finish this run (for parallel testing)
|
|
41
44
|
this.proceed = process.env.TESTOMATIO_PROCEED;
|
|
45
|
+
this.jiraId = process.env.TESTOMATIO_JIRA_ID;
|
|
42
46
|
this.runId = params.runId || process.env.runId;
|
|
43
47
|
this.createNewTests = params.createNewTests ?? !!process.env.TESTOMATIO_CREATE;
|
|
44
48
|
this.hasUnmatchedTests = false;
|
|
@@ -49,6 +53,47 @@ class TestomatioPipe {
|
|
|
49
53
|
}
|
|
50
54
|
}
|
|
51
55
|
|
|
56
|
+
/**
|
|
57
|
+
* Asynchronously prepares and retrieves the Testomat.io test grepList based on the provided options.
|
|
58
|
+
* @param {Object} opts - The options for preparing the test grepList.
|
|
59
|
+
* @returns {Promise<string[]>} - An array containing the retrieved
|
|
60
|
+
* test grepList, or an empty array if no tests are found or the request is disabled.
|
|
61
|
+
* @throws {Error} - Throws an error if there was a problem while making the request.
|
|
62
|
+
*/
|
|
63
|
+
async prepareRun(opts) {
|
|
64
|
+
if (!this.isEnabled) return [];
|
|
65
|
+
|
|
66
|
+
const { type, id } = parseFilterParams(opts);
|
|
67
|
+
|
|
68
|
+
try {
|
|
69
|
+
const q = generateFilterRequestParams({
|
|
70
|
+
type,
|
|
71
|
+
id,
|
|
72
|
+
apiKey: this.apiKey.trim()
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
if (!q) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const resp = await this.axios.get('/api/test_grep', q);
|
|
80
|
+
const { data } = resp;
|
|
81
|
+
|
|
82
|
+
if (Array.isArray(data?.tests) && data?.tests?.length > 0) {
|
|
83
|
+
foundedTestLog(APP_PREFIX, data.tests);
|
|
84
|
+
return data.tests;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
console.log(APP_PREFIX, `⛔ No tests found for your --filter --> ${type}=${id}`);
|
|
88
|
+
}
|
|
89
|
+
catch (err) {
|
|
90
|
+
console.error(
|
|
91
|
+
APP_PREFIX,
|
|
92
|
+
`🚩 Error getting Testomat.io test grepList: ${err}`,
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
52
97
|
/**
|
|
53
98
|
* @returns Promise<void>
|
|
54
99
|
*/
|
|
@@ -83,6 +128,7 @@ class TestomatioPipe {
|
|
|
83
128
|
api_key: this.apiKey.trim(),
|
|
84
129
|
group_title: this.groupTitle,
|
|
85
130
|
access_event: accessEvent,
|
|
131
|
+
jira_id: this.jiraId,
|
|
86
132
|
env: this.env,
|
|
87
133
|
title: this.title,
|
|
88
134
|
shared_run: this.sharedRun,
|
|
@@ -92,13 +138,13 @@ class TestomatioPipe {
|
|
|
92
138
|
|
|
93
139
|
if (this.runId) {
|
|
94
140
|
debug(`Run with id ${this.runId} already created, updating...`);
|
|
95
|
-
const resp = await this.axios.put(
|
|
141
|
+
const resp = await this.axios.put(`/api/reporter/${this.runId}`, runParams);
|
|
96
142
|
if (resp.data.artifacts) setS3Credentials(resp.data.artifacts);
|
|
97
143
|
return;
|
|
98
144
|
}
|
|
99
145
|
|
|
100
146
|
try {
|
|
101
|
-
const resp = await this.axios.post(
|
|
147
|
+
const resp = await this.axios.post(`/api/reporter`, runParams, {
|
|
102
148
|
maxContentLength: Infinity,
|
|
103
149
|
maxBodyLength: Infinity,
|
|
104
150
|
});
|
|
@@ -135,38 +181,37 @@ class TestomatioPipe {
|
|
|
135
181
|
data.create = this.createNewTests;
|
|
136
182
|
const json = JsonCycle.stringify(data);
|
|
137
183
|
|
|
138
|
-
return this.axios
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
if (err.response) {
|
|
149
|
-
|
|
150
|
-
const responseData = err.response.data || { message: '' };
|
|
151
|
-
console.log(
|
|
152
|
-
APP_PREFIX,
|
|
153
|
-
chalk.yellow(`Warning: ${responseData.message} (${err.response.status})`),
|
|
154
|
-
chalk.grey(data?.title || ''),
|
|
155
|
-
);
|
|
156
|
-
if (err.response.data.message.includes('could not be matched')) {
|
|
157
|
-
this.hasUnmatchedTests = true;
|
|
158
|
-
}
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
184
|
+
return this.axios.post(`/api/reporter/${this.runId}/testrun`, json, {
|
|
185
|
+
maxContentLength: Infinity,
|
|
186
|
+
maxBodyLength: Infinity,
|
|
187
|
+
headers: {
|
|
188
|
+
// Overwrite Axios's automatically set Content-Type
|
|
189
|
+
'Content-Type': 'application/json',
|
|
190
|
+
},
|
|
191
|
+
})
|
|
192
|
+
.catch(err => {
|
|
193
|
+
if (err.response) {
|
|
194
|
+
if (err.response.status >= 400) {
|
|
195
|
+
const responseData = err.response.data || { message: '' };
|
|
161
196
|
console.log(
|
|
162
197
|
APP_PREFIX,
|
|
163
|
-
chalk.yellow(`Warning: ${
|
|
164
|
-
|
|
198
|
+
chalk.yellow(`Warning: ${responseData.message} (${err.response.status})`),
|
|
199
|
+
chalk.grey(data?.title || ''),
|
|
165
200
|
);
|
|
166
|
-
|
|
167
|
-
|
|
201
|
+
if (err.response.data.message.includes('could not be matched')) {
|
|
202
|
+
this.hasUnmatchedTests = true;
|
|
203
|
+
}
|
|
204
|
+
return;
|
|
168
205
|
}
|
|
169
|
-
|
|
206
|
+
console.log(
|
|
207
|
+
APP_PREFIX,
|
|
208
|
+
chalk.yellow(`Warning: ${data?.title || ''} (${err.response?.status})`),
|
|
209
|
+
`Report couldn't be processed: ${err?.response?.data?.message}`,
|
|
210
|
+
);
|
|
211
|
+
} else {
|
|
212
|
+
console.log(APP_PREFIX, chalk.blue(data?.title || ''), "Report couldn't be processed", err);
|
|
213
|
+
}
|
|
214
|
+
});
|
|
170
215
|
}
|
|
171
216
|
|
|
172
217
|
/**
|
|
@@ -188,7 +233,7 @@ class TestomatioPipe {
|
|
|
188
233
|
|
|
189
234
|
try {
|
|
190
235
|
if (this.runId && !this.proceed) {
|
|
191
|
-
await this.axios.put(
|
|
236
|
+
await this.axios.put(`/api/reporter/${this.runId}`, {
|
|
192
237
|
api_key: this.apiKey,
|
|
193
238
|
status_event,
|
|
194
239
|
tests: params.tests,
|
|
@@ -242,17 +287,3 @@ class TestomatioPipe {
|
|
|
242
287
|
}
|
|
243
288
|
|
|
244
289
|
module.exports = TestomatioPipe;
|
|
245
|
-
|
|
246
|
-
function setS3Credentials(artifacts) {
|
|
247
|
-
if (!Object.keys(artifacts).length) return;
|
|
248
|
-
|
|
249
|
-
console.log(APP_PREFIX, 'S3 were credentials obtained from Testomat.io...');
|
|
250
|
-
|
|
251
|
-
if (artifacts.ACCESS_KEY_ID) process.env.S3_ACCESS_KEY_ID = artifacts.ACCESS_KEY_ID;
|
|
252
|
-
if (artifacts.SECRET_ACCESS_KEY) process.env.S3_SECRET_ACCESS_KEY = artifacts.SECRET_ACCESS_KEY;
|
|
253
|
-
if (artifacts.REGION) process.env.S3_REGION = artifacts.REGION;
|
|
254
|
-
if (artifacts.BUCKET) process.env.S3_BUCKET = artifacts.BUCKET;
|
|
255
|
-
if (artifacts.ENDPOINT) process.env.S3_ENDPOINT = artifacts.ENDPOINT;
|
|
256
|
-
if (artifacts.presign) process.env.TESTOMATIO_PRIVATE_ARTIFACTS = '1';
|
|
257
|
-
resetConfig();
|
|
258
|
-
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
const { resetConfig } = require('../fileUploader');
|
|
2
|
+
const { APP_PREFIX } = require('../constants');
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Set S3 credentials from the provided artifacts object.
|
|
6
|
+
* @param {Object} artifacts - The artifacts object containing S3 credentials.
|
|
7
|
+
*/
|
|
8
|
+
function setS3Credentials(artifacts) {
|
|
9
|
+
if (!Object.keys(artifacts).length) return;
|
|
10
|
+
|
|
11
|
+
console.log(APP_PREFIX, 'S3 were credentials obtained from Testomat.io...');
|
|
12
|
+
|
|
13
|
+
if (artifacts.ACCESS_KEY_ID) process.env.S3_ACCESS_KEY_ID = artifacts.ACCESS_KEY_ID;
|
|
14
|
+
if (artifacts.SECRET_ACCESS_KEY) process.env.S3_SECRET_ACCESS_KEY = artifacts.SECRET_ACCESS_KEY;
|
|
15
|
+
if (artifacts.REGION) process.env.S3_REGION = artifacts.REGION;
|
|
16
|
+
if (artifacts.BUCKET) process.env.S3_BUCKET = artifacts.BUCKET;
|
|
17
|
+
if (artifacts.ENDPOINT) process.env.S3_ENDPOINT = artifacts.ENDPOINT;
|
|
18
|
+
if (artifacts.presign) process.env.TESTOMATIO_PRIVATE_ARTIFACTS = '1';
|
|
19
|
+
resetConfig();
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Generates mode request parameters based on the input params.
|
|
23
|
+
* @param {Object} params - The input parameters for the request.
|
|
24
|
+
* @param {string} params.type - The type of the request (e.g., "tag").
|
|
25
|
+
* @param {string} params.id - The ID associated with the request.
|
|
26
|
+
* @param {string} params.apiKey - The API key for authentication.
|
|
27
|
+
* @returns {Object|null} - An object containing the generated request parameters, or null if the type is invalid.
|
|
28
|
+
*/
|
|
29
|
+
function generateFilterRequestParams(params) {
|
|
30
|
+
const { type, id, apiKey } = params;
|
|
31
|
+
|
|
32
|
+
if (!type) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (!id) {
|
|
37
|
+
console.error(APP_PREFIX, `Please make sure your settings "${type.toUpperCase()}"= "${id}" is correct!`);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return {
|
|
42
|
+
params: {
|
|
43
|
+
type,
|
|
44
|
+
id: encodeURIComponent(id),
|
|
45
|
+
api_key: apiKey
|
|
46
|
+
},
|
|
47
|
+
responseType: "json"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Parse filter parameters from a string in the format "type=id".
|
|
53
|
+
* @param {string} opts - The input string containing the filter parameters.
|
|
54
|
+
* @returns {Object} An object containing the parsed filter parameters.
|
|
55
|
+
* The object has properties "type" and "id".
|
|
56
|
+
*/
|
|
57
|
+
function parseFilterParams(opts) {
|
|
58
|
+
const [type, id] = opts.split("=");
|
|
59
|
+
const validType = updateFilterType(type);
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
type: validType,
|
|
63
|
+
id
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Update and validate the filter type.
|
|
69
|
+
* @param {string} type - The original filter type.
|
|
70
|
+
* @returns {string|undefined} The updated and validated filter type.
|
|
71
|
+
* Returns undefined if the type is not valid.
|
|
72
|
+
*/
|
|
73
|
+
function updateFilterType(type) {
|
|
74
|
+
const typeLowerCase = type.toLowerCase();
|
|
75
|
+
|
|
76
|
+
const filterTypes = [
|
|
77
|
+
"tag-name",
|
|
78
|
+
"plan-id",
|
|
79
|
+
"label",
|
|
80
|
+
"jira-ticket",
|
|
81
|
+
];
|
|
82
|
+
|
|
83
|
+
const filterApi = [
|
|
84
|
+
"tag",
|
|
85
|
+
"plan",
|
|
86
|
+
"label",
|
|
87
|
+
"jira",
|
|
88
|
+
// "ims-issue", //TODO: WIP
|
|
89
|
+
];
|
|
90
|
+
|
|
91
|
+
if (!filterTypes.includes(typeLowerCase)) {
|
|
92
|
+
console.log(APP_PREFIX, `❗❗❗ Invalid "filter=${type}" start settings! Available option list: ${filterTypes}`);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const index = filterTypes.indexOf(typeLowerCase);
|
|
97
|
+
|
|
98
|
+
return (index !== -1)
|
|
99
|
+
? filterApi[index]
|
|
100
|
+
: undefined
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Return an emoji based on the provided status.
|
|
105
|
+
* @param {string} status - The status value ('passed', 'failed', or 'skipped').
|
|
106
|
+
* @returns {string} - An emoji corresponding to the provided status.
|
|
107
|
+
*/
|
|
108
|
+
function statusEmoji(status) {
|
|
109
|
+
if (status === 'passed') return '🟢';
|
|
110
|
+
if (status === 'failed') return '🔴';
|
|
111
|
+
if (status === 'skipped') return '🟡';
|
|
112
|
+
return '';
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Generate a full name string based on the provided test object.
|
|
117
|
+
* @param {object} t - The test object.
|
|
118
|
+
* @returns {string} - A formatted full name string for the test object.
|
|
119
|
+
*/
|
|
120
|
+
function fullName(t) {
|
|
121
|
+
let line = '';
|
|
122
|
+
if (t.suite_title) line = `${t.suite_title}: `;
|
|
123
|
+
line += `**${t.title}**`;
|
|
124
|
+
if (t.example) line += ` \`[${Object.values(t.example)}]\``;
|
|
125
|
+
return line;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
module.exports = {
|
|
129
|
+
updateFilterType,
|
|
130
|
+
parseFilterParams,
|
|
131
|
+
generateFilterRequestParams,
|
|
132
|
+
setS3Credentials,
|
|
133
|
+
statusEmoji,
|
|
134
|
+
fullName
|
|
135
|
+
};
|
|
@@ -227,6 +227,15 @@ const fileSystem = {
|
|
|
227
227
|
},
|
|
228
228
|
};
|
|
229
229
|
|
|
230
|
+
|
|
231
|
+
const foundedTestLog = (app, tests) => {
|
|
232
|
+
const n = tests.length;
|
|
233
|
+
|
|
234
|
+
return (n === 1)
|
|
235
|
+
? console.log(app, `✅ We found one test!`)
|
|
236
|
+
: console.log(app, `✅ We found ${n} tests!`);
|
|
237
|
+
}
|
|
238
|
+
|
|
230
239
|
const humanize = text => {
|
|
231
240
|
text = decamelize(text);
|
|
232
241
|
return text
|
|
@@ -297,4 +306,5 @@ module.exports = {
|
|
|
297
306
|
parseSuite,
|
|
298
307
|
humanize,
|
|
299
308
|
removeColorCodes,
|
|
300
|
-
|
|
309
|
+
foundedTestLog
|
|
310
|
+
};
|
package/lib/xmlReader.js
CHANGED
|
@@ -8,12 +8,12 @@ const { fetchFilesFromStackTrace,
|
|
|
8
8
|
fetchIdFromOutput,
|
|
9
9
|
fetchSourceCode,
|
|
10
10
|
fetchSourceCodeFromStackTrace,
|
|
11
|
-
fetchIdFromCode
|
|
12
|
-
|
|
11
|
+
fetchIdFromCode,
|
|
12
|
+
humanize
|
|
13
|
+
} = require('./utils/utils');
|
|
13
14
|
const upload = require('./fileUploader');
|
|
14
15
|
const pipesFactory = require('./pipe');
|
|
15
16
|
const adapterFactory = require('./junit-adapter');
|
|
16
|
-
const { humanize } = require('./util')
|
|
17
17
|
|
|
18
18
|
const TESTOMATIO_URL = process.env.TESTOMATIO_URL || "https://app.testomat.io";
|
|
19
19
|
const TESTOMATIO = process.env.TESTOMATIO; // key?
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testomatio/reporter",
|
|
3
|
-
"version": "1.0.15-beta",
|
|
3
|
+
"version": "1.0.15-beta.2",
|
|
4
4
|
"description": "Testomatio Reporter Client",
|
|
5
5
|
"main": "./lib/reporter.js",
|
|
6
6
|
"typings": "typings/index.d.ts",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@redocly/cli": "^1.0.0-beta.125",
|
|
56
56
|
"@wdio/reporter": "^7.16.13",
|
|
57
57
|
"chai": "^4.3.6",
|
|
58
|
-
"codeceptjs": "
|
|
58
|
+
"codeceptjs": "latest",
|
|
59
59
|
"cucumber": "^6.0.7",
|
|
60
60
|
"eslint": "^8.7.0",
|
|
61
61
|
"eslint-config-airbnb-base": "^15.0.0",
|