@testomatio/reporter 0.6.2 → 0.6.5

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 CHANGED
@@ -1,3 +1,16 @@
1
+ # 0.6.5
2
+
3
+ * Fixed test statuses for runs in JUnit reporter
4
+
5
+ # 0.6.4
6
+
7
+ * Added `TESTOMATIO_PROCEED=1` param to not close current run
8
+ * Fixed priority of commands from `npx @testomatio/reporter`
9
+
10
+ # 0.6.3
11
+
12
+ * Fixed `npx start-test-run` to launch commands
13
+
1
14
  # 0.6.2
2
15
 
3
16
  * Added `--env-file` option to load env variables from env file
package/README.md CHANGED
@@ -168,7 +168,7 @@ exports.config = {
168
168
  Run the following command from you project folder:
169
169
 
170
170
  ```bash
171
- TESTOMATIO={API_KEY} npx @testomatio/reporter@latest -c 'npx protractor conf.js'
171
+ TESTOMATIO={API_KEY} npx start-test-run -c 'npx protractor conf.js'
172
172
  ```
173
173
 
174
174
  ### WebdriverIO
@@ -205,7 +205,7 @@ For making screenshots on failed tests add the following hook to `wdio.conf.js`:
205
205
  Run the following command from you project folder:
206
206
 
207
207
  ```bash
208
- TESTOMATIO={API_KEY} npx @testomatio/reporter -c 'npx wdio wdio.conf.js'
208
+ TESTOMATIO={API_KEY} npx start-test-run -c 'npx wdio wdio.conf.js'
209
209
  ```
210
210
 
211
211
  ## JUnit Reports
@@ -349,8 +349,7 @@ Testomat.io will not create tests from the report if they have not been previous
349
349
  TESTOMATIO={API_KEY} TESTOMATIO_CREATE=1 <actual run command>
350
350
  ```
351
351
 
352
-
353
- ### Adding Report to Run by ID
352
+ ### Add Report to Run by ID
354
353
 
355
354
  This feature is widely used when a run is executed on CI.
356
355
  A run is created before the test is started and it is marked as `scheduled`. Then
@@ -360,6 +359,21 @@ a report is assigned to that run using `TESTOMATIO_RUN` environment variable and
360
359
  TESTOMATIO={API_KEY} TESTOMATIO_RUN={RUN_ID} <actual run command>
361
360
  ```
362
361
 
362
+ ### Do Not Finalize Run
363
+
364
+ If multiple reports are added to the same run, each of them should not finalize the run.
365
+ In this case use `TESTOMATIO_PROCEED=1` environment variable, so the Run will be shown as `Running`
366
+
367
+ ```
368
+ TESTOMATIO={API_KEY} TESTOMATIO_PROCEED=1 TESTOMATIO_RUN={RUN_ID} <actual run command>
369
+ ```
370
+
371
+ After all reports were attached and run can be execute the following command:
372
+
373
+ ```
374
+ TESTOMATIO={API_KEY} TESTOMATIO_RUN={RUN_ID} npx start-test-run --finish
375
+ ```
376
+
363
377
  ### Setting Report Title
364
378
 
365
379
  Give a title to your reports by passing it as environment variable to `TESTOMATIO_TITLE`.
@@ -482,7 +496,7 @@ TESTOMATIO_DISABLE_ARTIFACTS=1
482
496
  If you want to create a run and obtain its `{RUN_ID}` from [testomat.io](https://testomat.io) you can use `--launch` option:
483
497
 
484
498
  ```bash
485
- TESTOMATIO={API_KEY} npx @testomatio/reporter@latest --launch
499
+ TESTOMATIO={API_KEY} npx start-test-run --launch
486
500
  ```
487
501
 
488
502
  This command will return `{RUN_ID}` which you can pass to other testrunner processes.
@@ -494,5 +508,5 @@ This command will return `{RUN_ID}` which you can pass to other testrunner proce
494
508
  If you want to finish a run started by `--launch` use `--finish` option. `TESTOMATIO_RUN` environment variable is required:
495
509
 
496
510
  ```bash
497
- TESTOMATIO={API_KEY} TESTOMATIO_RUN={RUN_ID} npx @testomatio/reporter@latest --finish
511
+ TESTOMATIO={API_KEY} TESTOMATIO_RUN={RUN_ID} npx start-test-run --finish
498
512
  ```
@@ -7,6 +7,7 @@ const { APP_PREFIX } = require('../constants');
7
7
  const XmlReader = require("../xmlReader");
8
8
 
9
9
  const { version } = require('../../package.json');
10
+
10
11
  console.log(chalk.cyan.bold(` 🤩 Testomat.io XML Reporter v${version}`));
11
12
 
12
13
  program
@@ -20,7 +21,7 @@ program
20
21
  pattern += '.xml';
21
22
  }
22
23
  let { javaTests, lang } = opts;
23
- if (opts.envFile) require('dotenv').config(opts.envFile);
24
+ if (opts.envFile) require('dotenv').config(opts.envFile); // eslint-disable-line
24
25
  if (javaTests === true) javaTests = 'src/test/java';
25
26
  lang = lang?.toLowerCase();
26
27
  const runReader = new XmlReader({ javaTests, lang });
@@ -4,10 +4,9 @@ const program = require('commander');
4
4
  const chalk = require('chalk');
5
5
  const TestomatClient = require('../client');
6
6
  const { APP_PREFIX, FINISHED } = require('../constants');
7
-
8
7
  const { version } = require('../../package.json');
9
- console.log(chalk.cyan.bold(` 🤩 Testomat.io Reporter v${version}`));
10
8
 
9
+ console.log(chalk.cyan.bold(` 🤩 Testomat.io Reporter v${version}`));
11
10
 
12
11
  program
13
12
  .option('-c, --command <cmd>', 'Test runner command')
@@ -17,7 +16,7 @@ program
17
16
  .action(opts => {
18
17
 
19
18
  const { command, launch, finish } = opts;
20
- if (opts.envFile) require('dotenv').config(opts.envFile);
19
+ if (opts.envFile) require('dotenv').config(opts.envFile); // eslint-disable-line
21
20
 
22
21
  const apiKey = process.env['INPUT_TESTOMATIO-KEY'] || process.env.TESTOMATIO;
23
22
  const title = process.env.TESTOMATIO_TITLE;
@@ -52,7 +51,12 @@ program
52
51
 
53
52
  let exitCode = 0;
54
53
 
55
- if (command) return;
54
+ if (!command.split) {
55
+ process.exitCode = 255;
56
+ console.log(APP_PREFIX, `No command provided. Use -c option to launch a test runner.`);
57
+ return;
58
+ }
59
+
56
60
  const testCmds = command.split(' ');
57
61
  console.log(APP_PREFIX, `🚀 Running`, chalk.green(command));
58
62
 
package/lib/client.js CHANGED
@@ -24,7 +24,8 @@ class TestomatClient {
24
24
  constructor(params) {
25
25
  this.apiKey = params.apiKey || process.env.TESTOMATIO;
26
26
  this.title = params.title || process.env.TESTOMATIO_TITLE;
27
- this.createNewTests = !!process.env.TESTOMATIO_CREATE
27
+ this.createNewTests = !!process.env.TESTOMATIO_CREATE;
28
+ this.proceed = process.env.TESTOMATIO_PROCEED;
28
29
  this.env = TESTOMATIO_ENV;
29
30
  this.parallel = params.parallel;
30
31
  this.runId = process.env.runId;
@@ -197,7 +198,7 @@ class TestomatClient {
197
198
  updateRunStatus(status, isParallel) {
198
199
  this.queue = this.queue
199
200
  .then(async () => {
200
- if (this.runId) {
201
+ if (this.runId && !this.proceed) {
201
202
  let statusEvent;
202
203
  if (status === FINISHED) statusEvent = 'finish';
203
204
  if (status === PASSED) statusEvent = 'pass';
@@ -221,6 +222,11 @@ class TestomatClient {
221
222
  );
222
223
  }
223
224
  }
225
+ if (this.runUrl && this.proceed) {
226
+ const notFinishedMessage = chalk.yellow.bold('Run was not finished because of $TESTOMATIO_PROCEED');
227
+ console.log(APP_PREFIX, `📊 ${notFinishedMessage}. Report URL: ${chalk.magenta(this.runUrl)}`);
228
+ console.log(APP_PREFIX, `🛬 Run to finish it: TESTOMATIO_RUN=${this.runId} npx start-test-run --finish`);
229
+ }
224
230
  })
225
231
  .catch(err => {
226
232
  console.log(APP_PREFIX, 'Error updating status, skipping...', err);
package/lib/xmlReader.js CHANGED
@@ -248,6 +248,7 @@ class XmlReader {
248
248
  const dataString = JSON.stringify({
249
249
  ...this.stats,
250
250
  api_key: this.requestParams.apiKey,
251
+ status_event: 'finish',
251
252
  tests: this.tests,
252
253
  });
253
254
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testomatio/reporter",
3
- "version": "0.6.2",
3
+ "version": "0.6.5",
4
4
  "description": "Testomatio Reporter Client",
5
5
  "main": "./lib/reporter.js",
6
6
  "repository": "git@github.com:testomatio/reporter.git",
@@ -54,7 +54,7 @@
54
54
  "puppeteer": "^13.1.2"
55
55
  },
56
56
  "bin": {
57
- "start-test-run": "./lib/bin/startTest.js",
58
- "report-xml": "./lib/bin/reportXml.js"
57
+ "report-xml": "./lib/bin/reportXml.js",
58
+ "start-test-run": "./lib/bin/startTest.js"
59
59
  }
60
60
  }