@testomatio/reporter 2.19.0-beta → 2.20.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.
Files changed (54) hide show
  1. package/lib/adapter/codecept.js +1 -0
  2. package/lib/adapter/cucumber/current.js +1 -0
  3. package/lib/adapter/cypress-plugin/index.js +1 -0
  4. package/lib/adapter/e2e.d.ts +49 -0
  5. package/lib/adapter/e2e.js +250 -0
  6. package/lib/adapter/jasmine.js +1 -0
  7. package/lib/adapter/jest.js +1 -0
  8. package/lib/adapter/mocha.d.ts +4 -1
  9. package/lib/adapter/mocha.js +123 -122
  10. package/lib/adapter/nightwatch.js +1 -0
  11. package/lib/adapter/playwright.js +1 -0
  12. package/lib/adapter/vitest.js +1 -0
  13. package/lib/adapter/webdriver.js +1 -0
  14. package/lib/allureReader.d.ts +4 -1
  15. package/lib/allureReader.js +2 -1
  16. package/lib/bin/cli.js +32 -13
  17. package/lib/client.d.ts +1 -0
  18. package/lib/client.js +12 -3
  19. package/lib/data-storage.js +4 -3
  20. package/lib/pipe/bitbucket.js +5 -1
  21. package/lib/pipe/github.js +5 -1
  22. package/lib/pipe/gitlab.js +5 -1
  23. package/lib/pipe/testomatio.js +17 -1
  24. package/lib/replay.js +1 -0
  25. package/lib/uploader.d.ts +1 -0
  26. package/lib/uploader.js +21 -1
  27. package/lib/utils/pipe_utils.d.ts +32 -3
  28. package/lib/utils/pipe_utils.js +82 -4
  29. package/lib/xmlReader.js +2 -0
  30. package/package.json +7 -2
  31. package/src/adapter/codecept.js +2 -0
  32. package/src/adapter/cucumber/current.js +2 -0
  33. package/src/adapter/cypress-plugin/index.js +2 -0
  34. package/src/adapter/e2e.js +245 -0
  35. package/src/adapter/jasmine.js +2 -0
  36. package/src/adapter/jest.js +2 -0
  37. package/src/adapter/mocha.js +146 -145
  38. package/src/adapter/nightwatch.js +2 -0
  39. package/src/adapter/playwright.js +2 -0
  40. package/src/adapter/vitest.js +2 -0
  41. package/src/adapter/webdriver.js +2 -0
  42. package/src/allureReader.js +2 -1
  43. package/src/bin/cli.js +30 -11
  44. package/src/client.js +11 -3
  45. package/src/data-storage.js +4 -3
  46. package/src/pipe/bitbucket.js +7 -1
  47. package/src/pipe/github.js +7 -1
  48. package/src/pipe/gitlab.js +7 -1
  49. package/src/pipe/testomatio.js +27 -1
  50. package/src/replay.js +1 -0
  51. package/src/uploader.js +30 -1
  52. package/src/utils/pipe_utils.js +85 -4
  53. package/src/xmlReader.js +3 -0
  54. package/types/types.d.ts +1 -0
package/src/bin/cli.js CHANGED
@@ -16,7 +16,7 @@ import { filesize as prettyBytes } from 'filesize';
16
16
  import dotenv from 'dotenv';
17
17
  import Replay from '../replay.js';
18
18
  import { log } from '../utils/log.js';
19
- import { formatFilterListIds, formatRunOutput, formatFetchRunsOutput } from '../utils/pipe_utils.js';
19
+ import { formatFilterListIds, formatRunOutput, formatFetchRunsOutput, parseRunsUrl } from '../utils/pipe_utils.js';
20
20
  import fs from 'fs';
21
21
  import path from 'path';
22
22
 
@@ -130,7 +130,9 @@ program
130
130
  program
131
131
  .command('fetch')
132
132
  .description('Fetch runs from Testomat.io API v2')
133
+ .argument('[url]', 'URL of a run or of a (filtered) runs page in Testomat.io')
133
134
  .option('--project <slug>', 'Project slug (or set TESTOMATIO_PROJECT)')
135
+ .option('--run <id>', 'Fetch a single run by its id')
134
136
  .option('--title <text>', 'Filter by run title')
135
137
  .option('--tql <query>', 'Filter using Testomat Query Language')
136
138
  .option('--rungroup <uid>', 'Filter by rungroup id')
@@ -144,27 +146,44 @@ program
144
146
  '--format <format>',
145
147
  'Machine-readable output: run ids, one per line (--format id) or run details (--format json)',
146
148
  )
147
- .action(async opts => {
149
+ .action(async (pageUrl, opts) => {
148
150
  const apiKey = process.env['INPUT_TESTOMATIO-KEY'] || config.TESTOMATIO;
149
151
  if (!apiKey) {
150
152
  log.error(pc.red('⚠️ TESTOMATIO API key required'));
151
153
  process.exit(1);
152
154
  }
153
155
 
154
- const project = opts.project || process.env.TESTOMATIO_PROJECT;
156
+ let page = {};
157
+ if (pageUrl) {
158
+ page = parseRunsUrl(pageUrl);
159
+ if (!page) {
160
+ log.error(pc.red(`⚠️ Not a Testomat.io run or runs page URL: ${pageUrl}`));
161
+ process.exit(1);
162
+ }
163
+ }
164
+
165
+ const project = opts.project || page.project || process.env.TESTOMATIO_PROJECT;
155
166
  if (!project) {
156
167
  log.error(pc.red('⚠️ --project (or TESTOMATIO_PROJECT) is required'));
157
168
  process.exit(1);
158
169
  }
159
170
 
160
- const baseUrl = process.env.TESTOMATIO_URL || 'https://app.testomat.io';
161
- const url = new URL(`/api/v2/${project}/runs`, baseUrl);
162
- if (opts.title) url.searchParams.set('search', opts.title);
163
- if (opts.tql) url.searchParams.set('tql', opts.tql);
164
- if (opts.rungroup) url.searchParams.set('groupId', opts.rungroup);
165
- const requestedLimit = opts.latest ? 1 : parseInt(opts.limit, 10) || FETCH_RUNS_DEFAULT_LIMIT;
166
- const limit = Math.min(Math.max(requestedLimit, 1), FETCH_RUNS_MAX_LIMIT);
167
- url.searchParams.set('per_page', String(limit));
171
+ const baseUrl = page.baseUrl || process.env.TESTOMATIO_URL || 'https://app.testomat.io';
172
+ const runId = opts.run || page.runId;
173
+ let url;
174
+
175
+ if (runId) {
176
+ url = new URL(`/api/v2/${project}/runs/${runId}`, baseUrl);
177
+ } else {
178
+ url = new URL(`/api/v2/${project}/runs`, baseUrl);
179
+ for (const [key, value] of page.params || []) url.searchParams.append(key, value);
180
+ if (opts.title) url.searchParams.set('search', opts.title);
181
+ if (opts.tql) url.searchParams.set('tql', opts.tql);
182
+ if (opts.rungroup) url.searchParams.set('groupId', opts.rungroup);
183
+ const requestedLimit = opts.latest ? 1 : parseInt(opts.limit, 10) || FETCH_RUNS_DEFAULT_LIMIT;
184
+ const limit = Math.min(Math.max(requestedLimit, 1), FETCH_RUNS_MAX_LIMIT);
185
+ url.searchParams.set('per_page', String(limit));
186
+ }
168
187
 
169
188
  const response = await fetch(url, { headers: { Authorization: `Bearer ${apiKey}` } });
170
189
  const body = await response.json();
package/src/client.js CHANGED
@@ -36,6 +36,8 @@ class Client {
36
36
  this.pipeStore = {};
37
37
  this.runId = '';
38
38
  this.queue = Promise.resolve();
39
+ // adapter name is set by the adapter module itself on load (global.TESTOMATIO_ADAPTER)
40
+ this.adapterName = params.adapter || global.TESTOMATIO_ADAPTER;
39
41
 
40
42
  // @ts-ignore this line will be removed in compiled code, because __dirname is defined in commonjs
41
43
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
@@ -244,7 +246,9 @@ class Client {
244
246
  overwrite,
245
247
  tags,
246
248
  } = testData;
247
- let { files = [], manuallyAttachedArtifacts, message = '', meta = {} } = testData;
249
+ let { files = [], manuallyAttachedArtifacts, message = '' } = testData;
250
+ /** @type {Record<string, any>} */
251
+ let meta = testData.meta || {};
248
252
 
249
253
  if (stepArtifactPaths.size) {
250
254
  const isStepArtifact = item => stepArtifactPaths.has(typeof item === 'object' ? item?.path : item);
@@ -261,6 +265,10 @@ class Client {
261
265
  return acc;
262
266
  }, {});
263
267
 
268
+ // meta must always include reporter version and adapter used
269
+ if (this.version) meta.reporterVersion = this.version;
270
+ if (this.adapterName) meta.adapter = this.adapterName;
271
+
264
272
  const testContext = suite_title ? `${suite_title} ${title}` : title;
265
273
 
266
274
  let errorFormatted = '';
@@ -389,8 +397,8 @@ class Client {
389
397
  this.queue = this.queue
390
398
  .then(() => Promise.all(this.pipes.map(p => p.finishRun(runParams))))
391
399
  .then(() => {
392
- if (!this.uploader.isEnabled) return;
393
-
400
+ // no early return when uploading is disabled:
401
+ // skipped artifacts (e.g. no S3 credentials obtained) must still be reported to the user
394
402
  const filesizeStrMaxLength = 7;
395
403
 
396
404
  if (this.uploader.successfulUploads.length) {
@@ -190,9 +190,10 @@ class DataStorage {
190
190
  }
191
191
 
192
192
  function stringToMD5Hash(str) {
193
- const md5 = crypto.createHash('md5');
194
- md5.update(str);
195
- const hash = md5.digest('hex');
193
+ // sha256 instead of md5 for FIPS-enabled hosts compatibility
194
+ const sha256 = crypto.createHash('sha256');
195
+ sha256.update(str);
196
+ const hash = sha256.digest('hex');
196
197
  return `${process.env.runId || 'run'}_${hash}`;
197
198
  }
198
199
 
@@ -7,6 +7,7 @@ import {
7
7
  markdownTable,
8
8
  runSummary,
9
9
  totalDuration,
10
+ smallRunSections,
10
11
  } from '../utils/pipe_utils.js';
11
12
  import { Gaxios } from 'gaxios';
12
13
  import pc from 'picocolors';
@@ -174,7 +175,8 @@ export class BitbucketPipe {
174
175
  let body = summary;
175
176
 
176
177
  if (this.description) {
177
- body += `\n\n> ${truncate(this.description, 1024).replace(/\r?\n/g, '\n> ')}`;
178
+ // Bitbucket strips HTML, so no <details> here
179
+ body += `\n\n**📝 Description**\n\n${truncate(this.description, 1024)}\n`;
178
180
  }
179
181
 
180
182
  if (failures.length) {
@@ -184,6 +186,10 @@ export class BitbucketPipe {
184
186
  }
185
187
  }
186
188
 
189
+ for (const { title, list } of smallRunSections(this.tests)) {
190
+ body += `\n\n**${title}**\n\n${list.join('\n')}`;
191
+ }
192
+
187
193
  if (this.tests.length > 0 && !isPendingRun) {
188
194
  body += `\n\n**🐢 Slowest Tests**\n\n`;
189
195
  body += this.tests
@@ -12,6 +12,7 @@ import {
12
12
  markdownTable,
13
13
  runSummary,
14
14
  totalDuration,
15
+ smallRunSections,
15
16
  } from '../utils/pipe_utils.js';
16
17
  import { log } from '../utils/log.js';
17
18
 
@@ -147,7 +148,8 @@ class GitHubPipe {
147
148
 
148
149
  let body = summary;
149
150
  if (this.description) {
150
- body += `\n\n> ${truncate(this.description, 1024).replace(/\r?\n/g, '\n> ')}`;
151
+ body += '\n\n<details>\n<summary><h3>📝 Description</h3></summary>\n\n';
152
+ body += `${truncate(this.description, 1024)}\n\n</details>`;
151
153
  }
152
154
  const coverageConfiguration = this.store?.coverageConfiguration;
153
155
  const isManualRun = this.store?.runKind === 'manual';
@@ -172,6 +174,10 @@ class GitHubPipe {
172
174
  body += '\n\n</details>';
173
175
  }
174
176
 
177
+ for (const { title, list } of smallRunSections(this.tests)) {
178
+ body += `\n<details>\n<summary><h3>${title}</h3></summary>\n\n${list.join('\n')}\n</details>`;
179
+ }
180
+
175
181
  if (this.tests.length > 0 && !isPendingRun) {
176
182
  body += '\n<details>\n<summary><h3>🐢 Slowest Tests</h3></summary>\n\n';
177
183
  body += this.tests
@@ -13,6 +13,7 @@ import {
13
13
  markdownTable,
14
14
  runSummary,
15
15
  totalDuration,
16
+ smallRunSections,
16
17
  } from '../utils/pipe_utils.js';
17
18
  import { log } from '../utils/log.js';
18
19
 
@@ -148,7 +149,8 @@ class GitLabPipe {
148
149
  let body = summary;
149
150
 
150
151
  if (this.description) {
151
- body += `\n\n> ${truncate(this.description, 1024).replace(/\r?\n/g, '\n> ')}`;
152
+ body += '\n\n<details>\n<summary><h3>📝 Description</h3></summary>\n\n';
153
+ body += `${truncate(this.description, 1024)}\n\n</details>`;
152
154
  }
153
155
 
154
156
  if (failures.length) {
@@ -159,6 +161,10 @@ class GitLabPipe {
159
161
  body += '\n\n</details>';
160
162
  }
161
163
 
164
+ for (const { title, list } of smallRunSections(this.tests)) {
165
+ body += `\n<details>\n<summary><h3>${title}</h3></summary>\n\n${list.join('\n')}\n</details>`;
166
+ }
167
+
162
168
  if (this.tests.length > 0 && !isPendingRun) {
163
169
  body += '\n<details>\n<summary><h3>🐢 Slowest Tests</h3></summary>\n\n';
164
170
  body += this.tests
@@ -352,6 +352,8 @@ class TestomatioPipe {
352
352
  if (resp.data.artifacts) {
353
353
  setS3Credentials(resp.data.artifacts);
354
354
  this.#startS3CredentialsRefresh(runParams);
355
+ } else {
356
+ this.#warnNoS3Credentials();
355
357
  }
356
358
  if (resp.data.url) {
357
359
  const respUrl = new URL(resp.data.url);
@@ -383,6 +385,8 @@ class TestomatioPipe {
383
385
  if (resp.data.artifacts) {
384
386
  setS3Credentials(resp.data.artifacts);
385
387
  this.#startS3CredentialsRefresh(runParams);
388
+ } else {
389
+ this.#warnNoS3Credentials();
386
390
  }
387
391
 
388
392
  this.store.runUrl = this.runUrl;
@@ -442,10 +446,32 @@ class TestomatioPipe {
442
446
  debug('S3 credentials refreshed');
443
447
  }
444
448
  } catch (err) {
445
- debug('Failed to refresh S3 credentials:', err.message || err);
449
+ log.warn(
450
+ '⚠️ Failed to refresh S3 credentials:',
451
+ err.message || err,
452
+ '\nArtifact uploads may fail once the current credentials expire.',
453
+ );
446
454
  }
447
455
  };
448
456
 
457
+ /**
458
+ * Warns the user when Testomat.io did not return S3 credentials for artifacts upload.
459
+ * Skipped when artifacts uploading was intentionally disabled or a custom S3 storage is configured via env.
460
+ */
461
+ #warnNoS3Credentials() {
462
+ if (process.env.TESTOMATIO_DISABLE_ARTIFACTS || process.env.S3_BUCKET) return;
463
+
464
+ const command = `TESTOMATIO=<your_api_key> TESTOMATIO_RUN=${
465
+ this.runId || '<run_id>'
466
+ } npx @testomatio/reporter upload-artifacts`;
467
+ log.warn(
468
+ `⚠️ ${pc.yellow('Testomat.io did not return S3 credentials for artifacts upload.')}`,
469
+ 'Artifacts will not be uploaded.',
470
+ 'Please check the artifact sharing settings of your project.',
471
+ `\nRun "${pc.magenta(command)}" later with valid S3 credentials to re-upload artifacts to this run.`,
472
+ );
473
+ }
474
+
449
475
  #stopS3CredentialsRefresh() {
450
476
  if (this.s3CredentialsRefreshTimer) {
451
477
  clearInterval(this.s3CredentialsRefreshTimer);
package/src/replay.js CHANGED
@@ -237,6 +237,7 @@ export class Replay {
237
237
 
238
238
  const client = new TestomatClient({
239
239
  apiKey: this.apiKey,
240
+ adapter: 'replay',
240
241
  batchMode: BATCH_MODE.AUTO,
241
242
  ...runParams,
242
243
  ...(runId && { runId }),
package/src/uploader.js CHANGED
@@ -23,6 +23,7 @@ export class S3Uploader {
23
23
  */
24
24
  this.skippedUploads = [];
25
25
  this.failedUploads = [];
26
+ this.warnedDisabledUpload = false;
26
27
  /**
27
28
  * @type {{path: string, size: number, link: string}[]}
28
29
  */
@@ -90,6 +91,30 @@ export class S3Uploader {
90
91
  this.storeEnabled = false;
91
92
  }
92
93
 
94
+ /**
95
+ * Warns once when artifact uploading is disabled not intentionally by the user,
96
+ * e.g. S3 credentials were not obtained from Testomat.io and no custom S3 storage is configured.
97
+ * Without this warning artifacts are skipped silently.
98
+ */
99
+ #warnDisabledUpload(runId) {
100
+ if (this.warnedDisabledUpload) return;
101
+
102
+ const { S3_BUCKET, TESTOMATIO_DISABLE_ARTIFACTS } = this.getConfig();
103
+ // uploading was intentionally disabled by the user or a custom S3 storage is used, nothing to warn about
104
+ if (TESTOMATIO_DISABLE_ARTIFACTS || S3_BUCKET) return;
105
+
106
+ this.warnedDisabledUpload = true;
107
+ const command = `TESTOMATIO=<your_api_key> TESTOMATIO_RUN=${
108
+ runId || '<run_id>'
109
+ } npx @testomatio/reporter upload-artifacts`;
110
+ log.warn(
111
+ `🗄️ ${pc.yellow('Artifacts uploading is disabled: S3 credentials were not obtained from Testomat.io')}`,
112
+ pc.yellow('(and no custom S3 storage is configured).'),
113
+ 'Artifacts will not be uploaded.',
114
+ `\nRun "${pc.magenta(command)}" later with valid S3 credentials to re-upload artifacts to this run.`,
115
+ );
116
+ }
117
+
93
118
  /**
94
119
  *
95
120
  * @param {*} Body
@@ -231,6 +256,7 @@ export class S3Uploader {
231
256
  }
232
257
 
233
258
  if (!this.isEnabled) {
259
+ this.#warnDisabledUpload(runId);
234
260
  this.storeUploadedFile(filePath, runId, rid, false);
235
261
  this.skippedUploads.push({ path: filePath, size: fileSize });
236
262
  return;
@@ -281,7 +307,10 @@ export class S3Uploader {
281
307
  probably, the reason is that run is NOT created in adapter (but via cli) */
282
308
 
283
309
  this.isEnabled = this.isEnabled ?? this.checkEnabled();
284
- if (!this.isEnabled) return;
310
+ if (!this.isEnabled) {
311
+ this.#warnDisabledUpload(pathInS3[0]);
312
+ return;
313
+ }
285
314
 
286
315
  let Key = pathInS3.filter(p => !!p).join('/');
287
316
  const ext = this.#getFileExtBase64(buffer.toString('base64'));
@@ -122,6 +122,14 @@ function statusEmoji(status) {
122
122
  return '';
123
123
  }
124
124
 
125
+ /**
126
+ * @param {string} str
127
+ * @returns {string} The string with its first letter in upper case, e.g. `passed` → `Passed`.
128
+ */
129
+ function capitalize(str) {
130
+ return str.charAt(0).toUpperCase() + str.slice(1);
131
+ }
132
+
125
133
  /**
126
134
  * Generate a full name string based on the provided test object.
127
135
  * @param {object} t - The test object.
@@ -260,6 +268,37 @@ function totalDuration(tests) {
260
268
  return humanizeDuration(Math.trunc(milliseconds), { maxDecimalPoints: 0 });
261
269
  }
262
270
 
271
+ /**
272
+ * Runs with fewer tests than this list every test in the report, not only the failed ones.
273
+ */
274
+ const SMALL_RUN_TESTS_LIMIT = 10;
275
+
276
+ /**
277
+ * Sections listing the passed, skipped and not yet run tests of a small run; failures have their own
278
+ * section. Not yet run tests (no status, or `pending`) are listed without any status label.
279
+ *
280
+ * @param {Array<{status?: string, title?: string, suite_title?: string, run_time?: number}>} tests
281
+ * @returns {Array<{title: string, list: string[]}>} Non-empty sections; none if the run is not small.
282
+ */
283
+ function smallRunSections(tests) {
284
+ if (tests.length >= SMALL_RUN_TESTS_LIMIT) return [];
285
+
286
+ const sections = ['passed', 'skipped'].map(status => {
287
+ const list = tests
288
+ .filter(t => t.status === status)
289
+ .map(t => {
290
+ const runTime = t.run_time ? ` (${humanizeDuration(t.run_time)})` : '';
291
+ return `* ${statusEmoji(status)} ${fullName(t)}${runTime}`;
292
+ });
293
+ return { title: `${statusEmoji(status)} ${capitalize(status)} (${list.length})`, list };
294
+ });
295
+
296
+ const notRun = tests.filter(t => !t.status || t.status === 'pending').map(t => `* ${fullName(t)}`);
297
+ sections.push({ title: `📋 Tests (${notRun.length})`, list: notRun });
298
+
299
+ return sections.filter(section => section.list.length);
300
+ }
301
+
263
302
  /**
264
303
  * Render a two-column markdown table. Rows with an empty value are skipped, so optional rows
265
304
  * need no surrounding `if`.
@@ -327,17 +366,18 @@ function formatRunOutput(store, format) {
327
366
 
328
367
  /**
329
368
  * Format the runs fetched via the `fetch` command for machine-readable output.
330
- * `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;
331
370
  * any other format prints a human-readable multi-line summary per run.
332
371
  *
333
- * @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].
334
373
  * @param {string} [format] - Value of the CLI `--format` option.
335
374
  * @returns {string}
336
375
  */
337
376
  function formatFetchRunsOutput(body, format) {
338
- const runs = body?.data || [];
377
+ const data = body?.data || [];
378
+ const runs = [data].flat();
339
379
 
340
- if (format === 'json') return JSON.stringify(runs, null, 2);
380
+ if (format === 'json') return JSON.stringify(data, null, 2);
341
381
 
342
382
  if (format === 'id') return runs.map(run => run.id).filter(Boolean).join('\n');
343
383
 
@@ -345,6 +385,7 @@ function formatFetchRunsOutput(body, format) {
345
385
  .map(run => {
346
386
  const lines = [`* ID: ${run.id}`];
347
387
  if (run.title) lines.push(` title: ${run.title}`);
388
+ if (run.rungroup_id) lines.push(` rungroup: ${run.rungroup_id}`);
348
389
  if (run.launched_at) lines.push(` started at: ${run.launched_at}`);
349
390
  if (run.finished_at) lines.push(` finished at: ${run.finished_at}`);
350
391
  if (run.passed_count != null) lines.push(` passed: ${run.passed_count} tests`);
@@ -358,6 +399,44 @@ function formatFetchRunsOutput(body, format) {
358
399
  .join('\n');
359
400
  }
360
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
+
361
440
  export {
362
441
  updateFilterType,
363
442
  parseFilterParams,
@@ -368,11 +447,13 @@ export {
368
447
  markdownTable,
369
448
  runSummary,
370
449
  totalDuration,
450
+ smallRunSections,
371
451
  plannedTestsLabel,
372
452
  parsePipeOptions,
373
453
  formatFilterListIds,
374
454
  formatRunOutput,
375
455
  formatFetchRunsOutput,
456
+ parseRunsUrl,
376
457
  getObjectSize,
377
458
  splitTestsIntoChunks,
378
459
  };
package/src/xmlReader.js CHANGED
@@ -499,6 +499,9 @@ class XmlReader {
499
499
  this.adapter.formatTest(t);
500
500
 
501
501
  t.title = humanize(t.title);
502
+
503
+ // meta must always include reporter version and adapter used
504
+ t.meta = { ...t.meta, reporterVersion: this.version, adapter: 'xml' };
502
505
  });
503
506
  }
504
507
 
package/types/types.d.ts CHANGED
@@ -374,6 +374,7 @@ declare global {
374
374
  testomatioDataStore?: any;
375
375
  TESTOMATIO_LOGGER_CONSOLE_INTERCEPTED?: boolean;
376
376
  testomatioTestTitle?: string;
377
+ TESTOMATIO_ADAPTER?: string;
377
378
  }
378
379
  }
379
380
  }