@testomatio/reporter 2.1.0-beta-nightwatch → 2.1.0-beta.1-codeceptjs

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 (80) hide show
  1. package/README.md +1 -0
  2. package/lib/adapter/codecept.js +288 -202
  3. package/lib/adapter/cypress-plugin/index.js +0 -2
  4. package/lib/adapter/mocha.js +0 -1
  5. package/lib/adapter/nightwatch.js +5 -5
  6. package/lib/adapter/playwright.js +11 -3
  7. package/lib/adapter/webdriver.d.ts +1 -1
  8. package/lib/adapter/webdriver.js +18 -8
  9. package/lib/bin/cli.js +73 -8
  10. package/lib/bin/reportXml.js +4 -2
  11. package/lib/bin/startTest.js +3 -2
  12. package/lib/bin/uploadArtifacts.js +5 -4
  13. package/lib/client.js +30 -10
  14. package/lib/data-storage.d.ts +5 -5
  15. package/lib/data-storage.js +23 -13
  16. package/lib/junit-adapter/csharp.d.ts +1 -0
  17. package/lib/junit-adapter/csharp.js +11 -1
  18. package/lib/pipe/bitbucket.d.ts +2 -0
  19. package/lib/pipe/bitbucket.js +38 -26
  20. package/lib/pipe/debug.js +27 -6
  21. package/lib/pipe/github.d.ts +2 -2
  22. package/lib/pipe/github.js +35 -3
  23. package/lib/pipe/gitlab.d.ts +2 -0
  24. package/lib/pipe/gitlab.js +27 -9
  25. package/lib/pipe/html.js +0 -3
  26. package/lib/pipe/index.js +17 -7
  27. package/lib/pipe/testomatio.d.ts +3 -2
  28. package/lib/pipe/testomatio.js +85 -75
  29. package/lib/replay.d.ts +31 -0
  30. package/lib/replay.js +255 -0
  31. package/lib/reporter-functions.d.ts +7 -0
  32. package/lib/reporter-functions.js +36 -0
  33. package/lib/reporter.d.ts +15 -12
  34. package/lib/reporter.js +4 -1
  35. package/lib/services/artifacts.d.ts +1 -1
  36. package/lib/services/index.d.ts +2 -0
  37. package/lib/services/index.js +2 -0
  38. package/lib/services/key-values.d.ts +1 -1
  39. package/lib/services/labels.d.ts +22 -0
  40. package/lib/services/labels.js +62 -0
  41. package/lib/services/logger.d.ts +1 -1
  42. package/lib/services/logger.js +1 -2
  43. package/lib/template/testomatio.hbs +443 -68
  44. package/lib/uploader.js +10 -6
  45. package/lib/utils/constants.d.ts +12 -0
  46. package/lib/utils/constants.js +15 -0
  47. package/lib/utils/utils.d.ts +10 -1
  48. package/lib/utils/utils.js +70 -22
  49. package/lib/xmlReader.js +54 -19
  50. package/package.json +16 -11
  51. package/src/adapter/codecept.js +320 -214
  52. package/src/adapter/cypress-plugin/index.js +0 -2
  53. package/src/adapter/mocha.js +0 -1
  54. package/src/adapter/nightwatch.js +1 -1
  55. package/src/adapter/playwright.js +10 -7
  56. package/src/adapter/webdriver.js +2 -2
  57. package/src/bin/cli.js +70 -2
  58. package/src/bin/reportXml.js +4 -1
  59. package/src/bin/startTest.js +2 -1
  60. package/src/bin/uploadArtifacts.js +2 -1
  61. package/src/client.js +18 -3
  62. package/src/data-storage.js +6 -6
  63. package/src/junit-adapter/csharp.js +13 -1
  64. package/src/pipe/bitbucket.js +22 -24
  65. package/src/pipe/debug.js +26 -5
  66. package/src/pipe/github.js +1 -2
  67. package/src/pipe/gitlab.js +27 -9
  68. package/src/pipe/html.js +1 -4
  69. package/src/pipe/testomatio.js +106 -105
  70. package/src/replay.js +262 -0
  71. package/src/reporter-functions.js +41 -0
  72. package/src/reporter.js +3 -0
  73. package/src/services/index.js +2 -0
  74. package/src/services/labels.js +59 -0
  75. package/src/services/logger.js +1 -2
  76. package/src/template/testomatio.hbs +443 -68
  77. package/src/uploader.js +11 -6
  78. package/src/utils/constants.js +12 -0
  79. package/src/utils/utils.js +46 -13
  80. package/src/xmlReader.js +70 -18
package/lib/reporter.d.ts CHANGED
@@ -8,7 +8,7 @@ export type log = typeof import("./reporter-functions.js");
8
8
  export const log: (...args: any[]) => void;
9
9
  export type logger = typeof import("./services/index.js");
10
10
  export const logger: {
11
- "__#12@#originalUserLogger": {
11
+ "__#13@#originalUserLogger": {
12
12
  assert(condition?: boolean, ...data: any[]): void;
13
13
  assert(value: any, message?: string, ...optionalParams: any[]): void;
14
14
  clear(): void;
@@ -53,13 +53,13 @@ export const logger: {
53
53
  profile(label?: string): void;
54
54
  profileEnd(label?: string): void;
55
55
  };
56
- "__#12@#userLoggerWithOverridenMethods": any;
56
+ "__#13@#userLoggerWithOverridenMethods": any;
57
57
  logLevel: string;
58
58
  step(strings: any, ...values: any[]): void;
59
59
  getLogs(context: string): string[];
60
- "__#12@#stringifyLogs"(...args: any[]): string;
60
+ "__#13@#stringifyLogs"(...args: any[]): string;
61
61
  _templateLiteralLog(strings: any, ...args: any[]): void;
62
- "__#12@#logWrapper"(argsArray: any, level: any): void;
62
+ "__#13@#logWrapper"(argsArray: any, level: any): void;
63
63
  assert(...args: any[]): void;
64
64
  debug(...args: any[]): void;
65
65
  error(...args: any[]): void;
@@ -81,9 +81,11 @@ export const meta: (keyValue: {
81
81
  } | string, value?: string | null) => void;
82
82
  export type step = typeof import("./reporter-functions.js");
83
83
  export const step: (message: string) => void;
84
+ export type label = typeof import("./reporter-functions.js");
85
+ export const label: (key: string, value?: string) => void;
84
86
  declare namespace _default {
85
87
  let testomatioLogger: {
86
- "__#12@#originalUserLogger": {
88
+ "__#13@#originalUserLogger": {
87
89
  assert(condition?: boolean, ...data: any[]): void;
88
90
  assert(value: any, message?: string, ...optionalParams: any[]): void;
89
91
  clear(): void;
@@ -128,13 +130,13 @@ declare namespace _default {
128
130
  profile(label?: string): void;
129
131
  profileEnd(label?: string): void;
130
132
  };
131
- "__#12@#userLoggerWithOverridenMethods": any;
133
+ "__#13@#userLoggerWithOverridenMethods": any;
132
134
  logLevel: string;
133
135
  step(strings: any, ...values: any[]): void;
134
136
  getLogs(context: string): string[];
135
- "__#12@#stringifyLogs"(...args: any[]): string;
137
+ "__#13@#stringifyLogs"(...args: any[]): string;
136
138
  _templateLiteralLog(strings: any, ...args: any[]): void;
137
- "__#12@#logWrapper"(argsArray: any, level: any): void;
139
+ "__#13@#logWrapper"(argsArray: any, level: any): void;
138
140
  assert(...args: any[]): void;
139
141
  debug(...args: any[]): void;
140
142
  error(...args: any[]): void;
@@ -157,7 +159,7 @@ declare namespace _default {
157
159
  }, context?: any) => void;
158
160
  let log: (...args: any[]) => void;
159
161
  let logger: {
160
- "__#12@#originalUserLogger": {
162
+ "__#13@#originalUserLogger": {
161
163
  assert(condition?: boolean, ...data: any[]): void;
162
164
  assert(value: any, message?: string, ...optionalParams: any[]): void;
163
165
  clear(): void;
@@ -202,13 +204,13 @@ declare namespace _default {
202
204
  profile(label?: string): void;
203
205
  profileEnd(label?: string): void;
204
206
  };
205
- "__#12@#userLoggerWithOverridenMethods": any;
207
+ "__#13@#userLoggerWithOverridenMethods": any;
206
208
  logLevel: string;
207
209
  step(strings: any, ...values: any[]): void;
208
210
  getLogs(context: string): string[];
209
- "__#12@#stringifyLogs"(...args: any[]): string;
211
+ "__#13@#stringifyLogs"(...args: any[]): string;
210
212
  _templateLiteralLog(strings: any, ...args: any[]): void;
211
- "__#12@#logWrapper"(argsArray: any, level: any): void;
213
+ "__#13@#logWrapper"(argsArray: any, level: any): void;
212
214
  assert(...args: any[]): void;
213
215
  debug(...args: any[]): void;
214
216
  error(...args: any[]): void;
@@ -228,5 +230,6 @@ declare namespace _default {
228
230
  [key: string]: string;
229
231
  } | string, value?: string | null) => void;
230
232
  let step: (message: string) => void;
233
+ let label: (key: string, value?: string) => void;
231
234
  }
232
235
  export default _default;
package/lib/reporter.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.step = exports.meta = exports.logger = exports.log = exports.artifact = void 0;
6
+ exports.label = exports.step = exports.meta = exports.logger = exports.log = exports.artifact = void 0;
7
7
  // import TestomatClient from './client.js';
8
8
  // import * as TRConstants from './constants.js';
9
9
  const index_js_1 = require("./services/index.js");
@@ -13,12 +13,14 @@ exports.log = reporter_functions_js_1.default.log;
13
13
  exports.logger = index_js_1.services.logger;
14
14
  exports.meta = reporter_functions_js_1.default.keyValue;
15
15
  exports.step = reporter_functions_js_1.default.step;
16
+ exports.label = reporter_functions_js_1.default.label;
16
17
  /**
17
18
  * @typedef {import('./reporter-functions.js')} artifact
18
19
  * @typedef {import('./reporter-functions.js')} log
19
20
  * @typedef {import('./services/index.js')} logger
20
21
  * @typedef {import('./reporter-functions.js')} meta
21
22
  * @typedef {import('./reporter-functions.js')} step
23
+ * @typedef {import('./reporter-functions.js')} label
22
24
  */
23
25
  module.exports = {
24
26
  /**
@@ -30,6 +32,7 @@ module.exports = {
30
32
  logger: index_js_1.services.logger,
31
33
  meta: reporter_functions_js_1.default.keyValue,
32
34
  step: reporter_functions_js_1.default.step,
35
+ label: reporter_functions_js_1.default.label,
33
36
  // TestomatClient,
34
37
  // TRConstants,
35
38
  };
@@ -3,7 +3,7 @@ export const artifactStorage: ArtifactStorage;
3
3
  * Artifact storage is supposed to store file paths
4
4
  */
5
5
  declare class ArtifactStorage {
6
- static "__#13@#instance": any;
6
+ static "__#14@#instance": any;
7
7
  /**
8
8
  * Singleton
9
9
  * @returns {ArtifactStorage}
@@ -2,8 +2,10 @@ export namespace services {
2
2
  export { logger };
3
3
  export { artifactStorage as artifacts };
4
4
  export { keyValueStorage as keyValues };
5
+ export { labelStorage as labels };
5
6
  export function setContext(context: any): void;
6
7
  }
7
8
  import { logger } from './logger.js';
8
9
  import { artifactStorage } from './artifacts.js';
9
10
  import { keyValueStorage } from './key-values.js';
11
+ import { labelStorage } from './labels.js';
@@ -4,11 +4,13 @@ exports.services = void 0;
4
4
  const logger_js_1 = require("./logger.js");
5
5
  const artifacts_js_1 = require("./artifacts.js");
6
6
  const key_values_js_1 = require("./key-values.js");
7
+ const labels_js_1 = require("./labels.js");
7
8
  const data_storage_js_1 = require("../data-storage.js");
8
9
  exports.services = {
9
10
  logger: logger_js_1.logger,
10
11
  artifacts: artifacts_js_1.artifactStorage,
11
12
  keyValues: key_values_js_1.keyValueStorage,
13
+ labels: labels_js_1.labelStorage,
12
14
  setContext: context => {
13
15
  data_storage_js_1.dataStorage.setContext(context);
14
16
  },
@@ -1,6 +1,6 @@
1
1
  export const keyValueStorage: KeyValueStorage;
2
2
  declare class KeyValueStorage {
3
- static "__#14@#instance": any;
3
+ static "__#15@#instance": any;
4
4
  /**
5
5
  *
6
6
  * @returns {KeyValueStorage}
@@ -0,0 +1,22 @@
1
+ export const labelStorage: LabelStorage;
2
+ declare class LabelStorage {
3
+ static "__#16@#instance": any;
4
+ /**
5
+ *
6
+ * @returns {LabelStorage}
7
+ */
8
+ static getInstance(): LabelStorage;
9
+ /**
10
+ * Stores labels array and passes it to reporter
11
+ * @param {string[]} labels - array of label strings
12
+ * @param {*} context - full test title
13
+ */
14
+ put(labels: string[], context?: any): void;
15
+ /**
16
+ * Returns labels array for the test
17
+ * @param {*} context testId or test context from test runner
18
+ * @returns {string[]} labels array, e.g. ['smoke', 'severity:high', 'feature:user_account']
19
+ */
20
+ get(context?: any): string[];
21
+ }
22
+ export {};
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.labelStorage = void 0;
7
+ const debug_1 = __importDefault(require("debug"));
8
+ const data_storage_js_1 = require("../data-storage.js");
9
+ const debug = (0, debug_1.default)('@testomatio/reporter:services-labels');
10
+ class LabelStorage {
11
+ static #instance;
12
+ /**
13
+ *
14
+ * @returns {LabelStorage}
15
+ */
16
+ static getInstance() {
17
+ if (!this.#instance) {
18
+ this.#instance = new LabelStorage();
19
+ }
20
+ return this.#instance;
21
+ }
22
+ /**
23
+ * Stores labels array and passes it to reporter
24
+ * @param {string[]} labels - array of label strings
25
+ * @param {*} context - full test title
26
+ */
27
+ put(labels, context = null) {
28
+ if (!labels || !Array.isArray(labels))
29
+ return;
30
+ data_storage_js_1.dataStorage.putData('labels', labels, context);
31
+ }
32
+ /**
33
+ * Returns labels array for the test
34
+ * @param {*} context testId or test context from test runner
35
+ * @returns {string[]} labels array, e.g. ['smoke', 'severity:high', 'feature:user_account']
36
+ */
37
+ get(context = null) {
38
+ const labelsList = data_storage_js_1.dataStorage.getData('labels', context);
39
+ if (!labelsList || !labelsList?.length)
40
+ return [];
41
+ const allLabels = [];
42
+ for (const labels of labelsList) {
43
+ if (Array.isArray(labels)) {
44
+ allLabels.push(...labels);
45
+ }
46
+ else if (typeof labels === 'string') {
47
+ try {
48
+ const parsedLabels = JSON.parse(labels);
49
+ if (Array.isArray(parsedLabels)) {
50
+ allLabels.push(...parsedLabels);
51
+ }
52
+ }
53
+ catch (e) {
54
+ debug(`Error parsing labels for test ${context}`, labels);
55
+ }
56
+ }
57
+ }
58
+ // Remove duplicates
59
+ return [...new Set(allLabels)];
60
+ }
61
+ }
62
+ exports.labelStorage = LabelStorage.getInstance();
@@ -5,7 +5,7 @@ export const logger: Logger;
5
5
  * Supports different syntaxes to satisfy any user preferences.
6
6
  */
7
7
  declare class Logger {
8
- static "__#12@#instance": any;
8
+ static "__#13@#instance": any;
9
9
  /**
10
10
  *
11
11
  * @returns {Logger}
@@ -90,7 +90,6 @@ class Logger {
90
90
  }
91
91
  else {
92
92
  try {
93
- // eslint-disable-next-line no-unused-expressions
94
93
  this.prettyObjects ? logs.push(JSON.stringify(arg, null, 2)) : logs.push(JSON.stringify(arg));
95
94
  }
96
95
  catch (e) {
@@ -119,7 +118,7 @@ class Logger {
119
118
  current +
120
119
  // strings are splitted by args when use tagged template, thus we add arg after each string
121
120
  // it looks like: `string1 arg1 string2 arg2 string3`
122
- (args[index] !== undefined // eslint-disable-line no-nested-ternary
121
+ (args[index] !== undefined
123
122
  ? typeof args[index] === 'string'
124
123
  ? args[index] // add arg as it is
125
124
  : this.#stringifyLogs(args[index]) // stringify arg