@testomatio/reporter 2.0.1-beta.3 → 2.0.1-beta.5-timestamp

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 (148) hide show
  1. package/lib/adapter/codecept.js +335 -293
  2. package/lib/adapter/cucumber/current.js +203 -195
  3. package/lib/adapter/cucumber/legacy.js +155 -130
  4. package/lib/adapter/cucumber.js +16 -5
  5. package/lib/adapter/cypress-plugin/index.js +105 -91
  6. package/lib/adapter/jasmine.js +53 -54
  7. package/lib/adapter/jest.js +99 -97
  8. package/lib/adapter/mocha.js +141 -112
  9. package/lib/adapter/playwright.js +231 -199
  10. package/lib/adapter/vitest.js +149 -150
  11. package/lib/adapter/webdriver.js +121 -144
  12. package/lib/bin/cli.js +211 -229
  13. package/lib/bin/reportXml.js +52 -51
  14. package/lib/bin/startTest.js +95 -83
  15. package/lib/bin/uploadArtifacts.js +61 -56
  16. package/lib/client.js +465 -424
  17. package/lib/config.js +23 -18
  18. package/lib/constants.js +44 -50
  19. package/lib/data-storage.js +188 -216
  20. package/lib/junit-adapter/adapter.js +20 -17
  21. package/lib/junit-adapter/csharp.js +14 -28
  22. package/lib/junit-adapter/index.js +25 -27
  23. package/lib/junit-adapter/java.js +53 -41
  24. package/lib/junit-adapter/javascript.js +27 -30
  25. package/lib/junit-adapter/python.js +37 -38
  26. package/lib/junit-adapter/ruby.js +8 -11
  27. package/lib/output.js +52 -44
  28. package/lib/pipe/bitbucket.js +230 -223
  29. package/lib/pipe/csv.js +126 -113
  30. package/lib/pipe/debug.js +99 -118
  31. package/lib/pipe/github.js +213 -218
  32. package/lib/pipe/gitlab.js +206 -183
  33. package/lib/pipe/html.js +321 -258
  34. package/lib/pipe/index.js +66 -94
  35. package/lib/pipe/testomatio.js +474 -429
  36. package/lib/reporter-functions.js +26 -28
  37. package/lib/reporter.js +29 -34
  38. package/lib/services/artifacts.js +51 -55
  39. package/lib/services/index.js +12 -14
  40. package/lib/services/key-values.js +53 -56
  41. package/lib/services/logger.js +245 -226
  42. package/lib/template/testomatio.hbs +1366 -1026
  43. package/lib/uploader.js +364 -295
  44. package/lib/utils/pipe_utils.js +85 -89
  45. package/lib/utils/utils.js +307 -398
  46. package/lib/xmlReader.js +532 -525
  47. package/package.json +21 -64
  48. package/lib/adapter/codecept.d.ts +0 -2
  49. package/lib/adapter/cucumber/current.d.ts +0 -14
  50. package/lib/adapter/cucumber/legacy.d.ts +0 -0
  51. package/lib/adapter/cucumber.d.ts +0 -2
  52. package/lib/adapter/cypress-plugin/index.d.ts +0 -2
  53. package/lib/adapter/jasmine.d.ts +0 -11
  54. package/lib/adapter/jest.d.ts +0 -13
  55. package/lib/adapter/mocha.d.ts +0 -2
  56. package/lib/adapter/nightwatch.d.ts +0 -4
  57. package/lib/adapter/nightwatch.js +0 -80
  58. package/lib/adapter/playwright.d.ts +0 -14
  59. package/lib/adapter/vitest.d.ts +0 -35
  60. package/lib/adapter/webdriver.d.ts +0 -24
  61. package/lib/bin/cli.d.ts +0 -2
  62. package/lib/bin/reportXml.d.ts +0 -2
  63. package/lib/bin/startTest.d.ts +0 -2
  64. package/lib/bin/uploadArtifacts.d.ts +0 -2
  65. package/lib/client.d.ts +0 -76
  66. package/lib/config.d.ts +0 -1
  67. package/lib/constants.d.ts +0 -25
  68. package/lib/data-storage.d.ts +0 -34
  69. package/lib/junit-adapter/adapter.d.ts +0 -9
  70. package/lib/junit-adapter/csharp.d.ts +0 -5
  71. package/lib/junit-adapter/index.d.ts +0 -3
  72. package/lib/junit-adapter/java.d.ts +0 -5
  73. package/lib/junit-adapter/javascript.d.ts +0 -4
  74. package/lib/junit-adapter/python.d.ts +0 -5
  75. package/lib/junit-adapter/ruby.d.ts +0 -4
  76. package/lib/output.d.ts +0 -11
  77. package/lib/package.json +0 -3
  78. package/lib/pipe/bitbucket.d.ts +0 -25
  79. package/lib/pipe/csv.d.ts +0 -47
  80. package/lib/pipe/debug.d.ts +0 -29
  81. package/lib/pipe/github.d.ts +0 -30
  82. package/lib/pipe/gitlab.d.ts +0 -25
  83. package/lib/pipe/html.d.ts +0 -35
  84. package/lib/pipe/index.d.ts +0 -1
  85. package/lib/pipe/testomatio.d.ts +0 -71
  86. package/lib/replay.d.ts +0 -31
  87. package/lib/replay.js +0 -237
  88. package/lib/reporter-functions.d.ts +0 -34
  89. package/lib/reporter.d.ts +0 -232
  90. package/lib/services/artifacts.d.ts +0 -33
  91. package/lib/services/index.d.ts +0 -9
  92. package/lib/services/key-values.d.ts +0 -27
  93. package/lib/services/logger.d.ts +0 -64
  94. package/lib/uploader.d.ts +0 -60
  95. package/lib/utils/pipe_utils.d.ts +0 -41
  96. package/lib/utils/utils.d.ts +0 -54
  97. package/lib/xmlReader.d.ts +0 -92
  98. package/src/adapter/codecept.js +0 -373
  99. package/src/adapter/cucumber/current.js +0 -228
  100. package/src/adapter/cucumber/legacy.js +0 -158
  101. package/src/adapter/cucumber.js +0 -4
  102. package/src/adapter/cypress-plugin/index.js +0 -110
  103. package/src/adapter/jasmine.js +0 -60
  104. package/src/adapter/jest.js +0 -107
  105. package/src/adapter/mocha.cjs +0 -2
  106. package/src/adapter/mocha.js +0 -156
  107. package/src/adapter/nightwatch.js +0 -88
  108. package/src/adapter/playwright.js +0 -254
  109. package/src/adapter/vitest.js +0 -183
  110. package/src/adapter/webdriver.js +0 -142
  111. package/src/bin/cli.js +0 -348
  112. package/src/bin/reportXml.js +0 -77
  113. package/src/bin/startTest.js +0 -124
  114. package/src/bin/uploadArtifacts.js +0 -91
  115. package/src/client.js +0 -508
  116. package/src/config.js +0 -30
  117. package/src/constants.js +0 -53
  118. package/src/data-storage.js +0 -204
  119. package/src/junit-adapter/adapter.js +0 -23
  120. package/src/junit-adapter/csharp.js +0 -28
  121. package/src/junit-adapter/index.js +0 -28
  122. package/src/junit-adapter/java.js +0 -58
  123. package/src/junit-adapter/javascript.js +0 -31
  124. package/src/junit-adapter/python.js +0 -42
  125. package/src/junit-adapter/ruby.js +0 -10
  126. package/src/output.js +0 -57
  127. package/src/pipe/bitbucket.js +0 -252
  128. package/src/pipe/csv.js +0 -140
  129. package/src/pipe/debug.js +0 -119
  130. package/src/pipe/github.js +0 -232
  131. package/src/pipe/gitlab.js +0 -247
  132. package/src/pipe/html.js +0 -373
  133. package/src/pipe/index.js +0 -71
  134. package/src/pipe/testomatio.js +0 -504
  135. package/src/replay.js +0 -245
  136. package/src/reporter-functions.js +0 -55
  137. package/src/reporter.cjs_decprecated +0 -21
  138. package/src/reporter.js +0 -33
  139. package/src/services/artifacts.js +0 -59
  140. package/src/services/index.js +0 -13
  141. package/src/services/key-values.js +0 -59
  142. package/src/services/logger.js +0 -315
  143. package/src/template/emptyData.svg +0 -23
  144. package/src/template/testomatio.hbs +0 -1081
  145. package/src/uploader.js +0 -376
  146. package/src/utils/pipe_utils.js +0 -119
  147. package/src/utils/utils.js +0 -416
  148. package/src/xmlReader.js +0 -614
@@ -1,58 +1,53 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updateFilterType = updateFilterType;
4
- exports.parseFilterParams = parseFilterParams;
5
- exports.generateFilterRequestParams = generateFilterRequestParams;
6
- exports.setS3Credentials = setS3Credentials;
7
- exports.statusEmoji = statusEmoji;
8
- exports.fullName = fullName;
9
- const constants_js_1 = require("../constants.js");
1
+ const { APP_PREFIX } = require('../constants');
2
+
10
3
  /**
11
4
  * Set S3 credentials from the provided artifacts object.
12
5
  * @param {Object} artifacts - The artifacts object containing S3 credentials.
13
6
  */
14
7
  function setS3Credentials(artifacts) {
15
- if (!Object.keys(artifacts).length)
16
- return;
17
- console.log(constants_js_1.APP_PREFIX, 'S3 credentials obtained from Testomat.io...');
18
- if (artifacts.ACCESS_KEY_ID)
19
- process.env.S3_ACCESS_KEY_ID = artifacts.ACCESS_KEY_ID;
20
- if (artifacts.SECRET_ACCESS_KEY)
21
- process.env.S3_SECRET_ACCESS_KEY = artifacts.SECRET_ACCESS_KEY;
22
- if (artifacts.REGION)
23
- process.env.S3_REGION = artifacts.REGION;
24
- if (artifacts.BUCKET)
25
- process.env.S3_BUCKET = artifacts.BUCKET;
26
- if (artifacts.SESSION_TOKEN)
27
- process.env.S3_SESSION_TOKEN = artifacts.SESSION_TOKEN;
28
- if (artifacts.presign)
29
- process.env.TESTOMATIO_PRIVATE_ARTIFACTS = '1';
30
- // endpoint is not received from the server; and shuld be empty if IAM used (credentails obtained from the testomat)
31
- process.env.S3_ENDPOINT = artifacts.ENDPOINT || '';
8
+ if (!Object.keys(artifacts).length) return;
9
+
10
+ console.log(APP_PREFIX, 'S3 credentials obtained from Testomat.io...');
11
+
12
+ if (artifacts.ACCESS_KEY_ID) process.env.S3_ACCESS_KEY_ID = artifacts.ACCESS_KEY_ID;
13
+ if (artifacts.SECRET_ACCESS_KEY) process.env.S3_SECRET_ACCESS_KEY = artifacts.SECRET_ACCESS_KEY;
14
+ if (artifacts.REGION) process.env.S3_REGION = artifacts.REGION;
15
+ if (artifacts.BUCKET) process.env.S3_BUCKET = artifacts.BUCKET;
16
+ if (artifacts.SESSION_TOKEN) process.env.S3_SESSION_TOKEN = artifacts.SESSION_TOKEN;
17
+ if (artifacts.presign) process.env.TESTOMATIO_PRIVATE_ARTIFACTS = '1';
18
+ // endpoint is not received from the server; and shuld be empty if IAM used (credentails obtained from the testomat)
19
+ process.env.S3_ENDPOINT = artifacts.ENDPOINT || '';
32
20
  }
33
21
  /**
34
22
  * Generates mode request parameters based on the input params.
35
- * @param {{type: string, id?: string, apiKey: string}} params - The input parameters for the request.
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.
36
27
  * @returns {Object|null} - An object containing the generated request parameters, or null if the type is invalid.
37
28
  */
38
29
  function generateFilterRequestParams(params) {
39
- const { type, id, apiKey } = params;
40
- if (!type) {
41
- return;
42
- }
43
- if (!id) {
44
- console.error(constants_js_1.APP_PREFIX, `Please make sure your settings "${type.toUpperCase()}"= "${id}" is correct!`);
45
- return;
46
- }
47
- return {
48
- params: {
49
- type,
50
- id: encodeURIComponent(id),
51
- api_key: apiKey,
52
- },
53
- responseType: 'json',
54
- };
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
+ };
55
49
  }
50
+
56
51
  /**
57
52
  * Parse filter parameters from a string in the format "type=id".
58
53
  * @param {string} opts - The input string containing the filter parameters.
@@ -60,13 +55,15 @@ function generateFilterRequestParams(params) {
60
55
  * The object has properties "type" and "id".
61
56
  */
62
57
  function parseFilterParams(opts) {
63
- const [type, id] = opts.split('=');
64
- const validType = updateFilterType(type);
65
- return {
66
- type: validType,
67
- id,
68
- };
58
+ const [type, id] = opts.split('=');
59
+ const validType = updateFilterType(type);
60
+
61
+ return {
62
+ type: validType,
63
+ id,
64
+ };
69
65
  }
66
+
70
67
  /**
71
68
  * Update and validate the filter type.
72
69
  * @param {string} type - The original filter type.
@@ -74,59 +71,58 @@ function parseFilterParams(opts) {
74
71
  * Returns undefined if the type is not valid.
75
72
  */
76
73
  function updateFilterType(type) {
77
- const typeLowerCase = type.toLowerCase();
78
- const filterTypes = ['tag-name', 'plan-id', 'label', 'jira-ticket'];
79
- const filterApi = [
80
- 'tag',
81
- 'plan',
82
- 'label',
83
- 'jira',
84
- // "ims-issue", //TODO: WIP
85
- ];
86
- if (!filterTypes.includes(typeLowerCase)) {
87
- console.log(constants_js_1.APP_PREFIX, `❗❗❗ Invalid "filter=${type}" start settings! Available option list: ${filterTypes}`);
88
- return;
89
- }
90
- const index = filterTypes.indexOf(typeLowerCase);
91
- return index !== -1 ? filterApi[index] : undefined;
74
+ const typeLowerCase = type.toLowerCase();
75
+
76
+ const filterTypes = ['tag-name', 'plan-id', 'label', 'jira-ticket'];
77
+
78
+ const filterApi = [
79
+ 'tag',
80
+ 'plan',
81
+ 'label',
82
+ 'jira',
83
+ // "ims-issue", //TODO: WIP
84
+ ];
85
+
86
+ if (!filterTypes.includes(typeLowerCase)) {
87
+ console.log(APP_PREFIX, `❗❗❗ Invalid "filter=${type}" start settings! Available option list: ${filterTypes}`);
88
+ return;
89
+ }
90
+
91
+ const index = filterTypes.indexOf(typeLowerCase);
92
+
93
+ return index !== -1 ? filterApi[index] : undefined;
92
94
  }
95
+
93
96
  /**
94
97
  * Return an emoji based on the provided status.
95
98
  * @param {string} status - The status value ('passed', 'failed', or 'skipped').
96
99
  * @returns {string} - An emoji corresponding to the provided status.
97
100
  */
98
101
  function statusEmoji(status) {
99
- if (status === 'passed')
100
- return '🟢';
101
- if (status === 'failed')
102
- return '🔴';
103
- if (status === 'skipped')
104
- return '🟡';
105
- return '';
102
+ if (status === 'passed') return '🟢';
103
+ if (status === 'failed') return '🔴';
104
+ if (status === 'skipped') return '🟡';
105
+ return '';
106
106
  }
107
+
107
108
  /**
108
109
  * Generate a full name string based on the provided test object.
109
110
  * @param {object} t - The test object.
110
111
  * @returns {string} - A formatted full name string for the test object.
111
112
  */
112
113
  function fullName(t) {
113
- let line = '';
114
- if (t.suite_title)
115
- line = `${t.suite_title}: `;
116
- line += `**${t.title}**`;
117
- if (t.example)
118
- line += ` \`[${Object.values(t.example)}]\``;
119
- return line;
114
+ let line = '';
115
+ if (t.suite_title) line = `${t.suite_title}: `;
116
+ line += `**${t.title}**`;
117
+ if (t.example) line += ` \`[${Object.values(t.example)}]\``;
118
+ return line;
120
119
  }
121
120
 
122
- module.exports.updateFilterType = updateFilterType;
123
-
124
- module.exports.parseFilterParams = parseFilterParams;
125
-
126
- module.exports.generateFilterRequestParams = generateFilterRequestParams;
127
-
128
- module.exports.setS3Credentials = setS3Credentials;
129
-
130
- module.exports.statusEmoji = statusEmoji;
131
-
132
- module.exports.fullName = fullName;
121
+ module.exports = {
122
+ updateFilterType,
123
+ parseFilterParams,
124
+ generateFilterRequestParams,
125
+ setS3Credentials,
126
+ statusEmoji,
127
+ fullName,
128
+ };