@testomatio/reporter 2.19.0 → 2.21.0
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/adapter/codecept.js +26 -2
- package/lib/adapter/cucumber/current.js +1 -0
- package/lib/adapter/cypress-plugin/index.js +1 -0
- package/lib/adapter/e2e.d.ts +49 -0
- package/lib/adapter/e2e.js +254 -0
- package/lib/adapter/jasmine.js +1 -0
- package/lib/adapter/jest.js +1 -0
- package/lib/adapter/mocha.d.ts +4 -1
- package/lib/adapter/mocha.js +123 -122
- package/lib/adapter/nightwatch.js +1 -0
- package/lib/adapter/playwright.js +33 -1
- package/lib/adapter/vitest.js +5 -1
- package/lib/adapter/webdriver.js +45 -2
- package/lib/allureReader.d.ts +4 -1
- package/lib/allureReader.js +2 -1
- package/lib/bin/cli.js +212 -19
- package/lib/client.d.ts +1 -0
- package/lib/client.js +12 -3
- package/lib/data-storage.js +4 -3
- package/lib/fetch/report.d.ts +31 -0
- package/lib/fetch/report.js +81 -0
- package/lib/fetch/testruns.d.ts +133 -0
- package/lib/fetch/testruns.js +286 -0
- package/lib/pipe/markdown.d.ts +1 -0
- package/lib/pipe/markdown.js +7 -0
- package/lib/pipe/testomatio.js +17 -1
- package/lib/replay.js +1 -0
- package/lib/reporter-functions.js +39 -0
- package/lib/uploader.d.ts +17 -0
- package/lib/uploader.js +75 -1
- package/lib/utils/detectRunner.d.ts +23 -0
- package/lib/utils/detectRunner.js +149 -0
- package/lib/utils/pipe_utils.d.ts +16 -3
- package/lib/utils/pipe_utils.js +45 -4
- package/lib/xmlReader.js +2 -0
- package/package.json +8 -3
- package/src/adapter/codecept.js +24 -2
- package/src/adapter/cucumber/current.js +2 -0
- package/src/adapter/cypress-plugin/index.js +2 -0
- package/src/adapter/e2e.js +248 -0
- package/src/adapter/jasmine.js +2 -0
- package/src/adapter/jest.js +2 -0
- package/src/adapter/mocha.js +146 -145
- package/src/adapter/nightwatch.js +2 -0
- package/src/adapter/playwright.js +33 -1
- package/src/adapter/vitest.js +6 -1
- package/src/adapter/webdriver.js +46 -2
- package/src/allureReader.js +2 -1
- package/src/bin/cli.js +246 -18
- package/src/client.js +11 -3
- package/src/data-storage.js +4 -3
- package/src/fetch/report.js +86 -0
- package/src/fetch/testruns.js +283 -0
- package/src/pipe/markdown.js +7 -0
- package/src/pipe/testomatio.js +27 -1
- package/src/replay.js +1 -0
- package/src/reporter-functions.js +41 -0
- package/src/uploader.js +81 -1
- package/src/utils/detectRunner.js +151 -0
- package/src/utils/pipe_utils.js +45 -4
- package/src/xmlReader.js +3 -0
- package/types/types.d.ts +1 -0
package/src/utils/pipe_utils.js
CHANGED
|
@@ -366,17 +366,18 @@ function formatRunOutput(store, format) {
|
|
|
366
366
|
|
|
367
367
|
/**
|
|
368
368
|
* Format the runs fetched via the `fetch` command for machine-readable output.
|
|
369
|
-
* `json` prints the full array of run objects; `id` prints one run id per line;
|
|
369
|
+
* `json` prints the full array of run objects (a single object for one run); `id` prints one run id per line;
|
|
370
370
|
* any other format prints a human-readable multi-line summary per run.
|
|
371
371
|
*
|
|
372
|
-
* @param {{data?: Array}} body - Parsed response body from GET /api/v2/:project/runs.
|
|
372
|
+
* @param {{data?: Array|Object}} body - Parsed response body from GET /api/v2/:project/runs[/:id].
|
|
373
373
|
* @param {string} [format] - Value of the CLI `--format` option.
|
|
374
374
|
* @returns {string}
|
|
375
375
|
*/
|
|
376
376
|
function formatFetchRunsOutput(body, format) {
|
|
377
|
-
const
|
|
377
|
+
const data = body?.data || [];
|
|
378
|
+
const runs = [data].flat();
|
|
378
379
|
|
|
379
|
-
if (format === 'json') return JSON.stringify(
|
|
380
|
+
if (format === 'json') return JSON.stringify(data, null, 2);
|
|
380
381
|
|
|
381
382
|
if (format === 'id') return runs.map(run => run.id).filter(Boolean).join('\n');
|
|
382
383
|
|
|
@@ -384,6 +385,7 @@ function formatFetchRunsOutput(body, format) {
|
|
|
384
385
|
.map(run => {
|
|
385
386
|
const lines = [`* ID: ${run.id}`];
|
|
386
387
|
if (run.title) lines.push(` title: ${run.title}`);
|
|
388
|
+
if (run.rungroup_id) lines.push(` rungroup: ${run.rungroup_id}`);
|
|
387
389
|
if (run.launched_at) lines.push(` started at: ${run.launched_at}`);
|
|
388
390
|
if (run.finished_at) lines.push(` finished at: ${run.finished_at}`);
|
|
389
391
|
if (run.passed_count != null) lines.push(` passed: ${run.passed_count} tests`);
|
|
@@ -397,6 +399,44 @@ function formatFetchRunsOutput(body, format) {
|
|
|
397
399
|
.join('\n');
|
|
398
400
|
}
|
|
399
401
|
|
|
402
|
+
// filterParam keys of the runs page which are API params on their own; the rest go under filter[...]
|
|
403
|
+
const RUNS_PAGE_PARAMS = ['search', 'tql', 'groupId'];
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* Parse a Testomat.io app URL of a run (/projects/:project/runs/:id)
|
|
407
|
+
* or of a runs page (/projects/:project/runs?filterParam=...) into API v2 request parts.
|
|
408
|
+
*
|
|
409
|
+
* @param {string} pageUrl
|
|
410
|
+
* @returns {{baseUrl: string, project: string, runId?: string, params: string[][]}|null}
|
|
411
|
+
*/
|
|
412
|
+
function parseRunsUrl(pageUrl) {
|
|
413
|
+
let url;
|
|
414
|
+
try {
|
|
415
|
+
url = new URL(pageUrl);
|
|
416
|
+
} catch (e) {
|
|
417
|
+
return null;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
const match = url.pathname.match(/\/projects\/([^/]+)\/runs(?:\/([^/]+))?\/?$/);
|
|
421
|
+
if (!match) return null;
|
|
422
|
+
|
|
423
|
+
const [, project, runId] = match;
|
|
424
|
+
const params = [];
|
|
425
|
+
|
|
426
|
+
for (const [key, value] of new URLSearchParams(url.searchParams.get('filterParam') || '')) {
|
|
427
|
+
// "groups" only switches the page to the grouped view
|
|
428
|
+
if (!value || key === 'groups') continue;
|
|
429
|
+
if (RUNS_PAGE_PARAMS.includes(key)) {
|
|
430
|
+
params.push([key, value]);
|
|
431
|
+
continue;
|
|
432
|
+
}
|
|
433
|
+
const [name, ...nested] = key.split('[');
|
|
434
|
+
params.push([`filter[${name}]${nested.map(part => `[${part}`).join('')}`, value]);
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
return { baseUrl: url.origin, project, runId, params };
|
|
438
|
+
}
|
|
439
|
+
|
|
400
440
|
export {
|
|
401
441
|
updateFilterType,
|
|
402
442
|
parseFilterParams,
|
|
@@ -413,6 +453,7 @@ export {
|
|
|
413
453
|
formatFilterListIds,
|
|
414
454
|
formatRunOutput,
|
|
415
455
|
formatFetchRunsOutput,
|
|
456
|
+
parseRunsUrl,
|
|
416
457
|
getObjectSize,
|
|
417
458
|
splitTestsIntoChunks,
|
|
418
459
|
};
|
package/src/xmlReader.js
CHANGED