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

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 (149) hide show
  1. package/README.md +1 -0
  2. package/lib/adapter/codecept.d.ts +2 -0
  3. package/lib/adapter/codecept.js +293 -335
  4. package/lib/adapter/cucumber/current.d.ts +14 -0
  5. package/lib/adapter/cucumber/current.js +195 -203
  6. package/lib/adapter/cucumber/legacy.d.ts +0 -0
  7. package/lib/adapter/cucumber/legacy.js +130 -155
  8. package/lib/adapter/cucumber.d.ts +2 -0
  9. package/lib/adapter/cucumber.js +5 -16
  10. package/lib/adapter/cypress-plugin/index.d.ts +2 -0
  11. package/lib/adapter/cypress-plugin/index.js +91 -105
  12. package/lib/adapter/jasmine.d.ts +11 -0
  13. package/lib/adapter/jasmine.js +54 -53
  14. package/lib/adapter/jest.d.ts +13 -0
  15. package/lib/adapter/jest.js +97 -99
  16. package/lib/adapter/mocha.d.ts +2 -0
  17. package/lib/adapter/mocha.js +112 -141
  18. package/lib/adapter/nightwatch.d.ts +4 -0
  19. package/lib/adapter/nightwatch.js +80 -0
  20. package/lib/adapter/playwright.d.ts +14 -0
  21. package/lib/adapter/playwright.js +199 -231
  22. package/lib/adapter/vitest.d.ts +35 -0
  23. package/lib/adapter/vitest.js +150 -149
  24. package/lib/adapter/webdriver.d.ts +24 -0
  25. package/lib/adapter/webdriver.js +144 -121
  26. package/lib/bin/cli.d.ts +2 -0
  27. package/lib/bin/cli.js +229 -211
  28. package/lib/bin/reportXml.d.ts +2 -0
  29. package/lib/bin/reportXml.js +51 -52
  30. package/lib/bin/startTest.d.ts +2 -0
  31. package/lib/bin/startTest.js +83 -95
  32. package/lib/bin/uploadArtifacts.d.ts +2 -0
  33. package/lib/bin/uploadArtifacts.js +56 -61
  34. package/lib/client.d.ts +76 -0
  35. package/lib/client.js +429 -465
  36. package/lib/config.d.ts +1 -0
  37. package/lib/config.js +18 -23
  38. package/lib/constants.d.ts +25 -0
  39. package/lib/constants.js +50 -44
  40. package/lib/data-storage.d.ts +34 -0
  41. package/lib/data-storage.js +216 -188
  42. package/lib/junit-adapter/adapter.d.ts +9 -0
  43. package/lib/junit-adapter/adapter.js +17 -20
  44. package/lib/junit-adapter/csharp.d.ts +5 -0
  45. package/lib/junit-adapter/csharp.js +28 -14
  46. package/lib/junit-adapter/index.d.ts +3 -0
  47. package/lib/junit-adapter/index.js +27 -25
  48. package/lib/junit-adapter/java.d.ts +5 -0
  49. package/lib/junit-adapter/java.js +41 -53
  50. package/lib/junit-adapter/javascript.d.ts +4 -0
  51. package/lib/junit-adapter/javascript.js +30 -27
  52. package/lib/junit-adapter/python.d.ts +5 -0
  53. package/lib/junit-adapter/python.js +38 -37
  54. package/lib/junit-adapter/ruby.d.ts +4 -0
  55. package/lib/junit-adapter/ruby.js +11 -8
  56. package/lib/output.d.ts +11 -0
  57. package/lib/output.js +44 -52
  58. package/lib/package.json +3 -0
  59. package/lib/pipe/bitbucket.d.ts +25 -0
  60. package/lib/pipe/bitbucket.js +223 -230
  61. package/lib/pipe/csv.d.ts +47 -0
  62. package/lib/pipe/csv.js +113 -126
  63. package/lib/pipe/debug.d.ts +29 -0
  64. package/lib/pipe/debug.js +125 -99
  65. package/lib/pipe/github.d.ts +30 -0
  66. package/lib/pipe/github.js +218 -213
  67. package/lib/pipe/gitlab.d.ts +25 -0
  68. package/lib/pipe/gitlab.js +183 -206
  69. package/lib/pipe/html.d.ts +35 -0
  70. package/lib/pipe/html.js +258 -321
  71. package/lib/pipe/index.d.ts +1 -0
  72. package/lib/pipe/index.js +94 -66
  73. package/lib/pipe/testomatio.d.ts +71 -0
  74. package/lib/pipe/testomatio.js +429 -474
  75. package/lib/replay.d.ts +31 -0
  76. package/lib/replay.js +255 -0
  77. package/lib/reporter-functions.d.ts +34 -0
  78. package/lib/reporter-functions.js +28 -26
  79. package/lib/reporter.d.ts +232 -0
  80. package/lib/reporter.js +34 -29
  81. package/lib/services/artifacts.d.ts +33 -0
  82. package/lib/services/artifacts.js +55 -51
  83. package/lib/services/index.d.ts +9 -0
  84. package/lib/services/index.js +14 -12
  85. package/lib/services/key-values.d.ts +27 -0
  86. package/lib/services/key-values.js +56 -53
  87. package/lib/services/logger.d.ts +64 -0
  88. package/lib/services/logger.js +226 -245
  89. package/lib/template/testomatio.hbs +1026 -1366
  90. package/lib/uploader.d.ts +60 -0
  91. package/lib/uploader.js +295 -364
  92. package/lib/utils/pipe_utils.d.ts +41 -0
  93. package/lib/utils/pipe_utils.js +89 -85
  94. package/lib/utils/utils.d.ts +54 -0
  95. package/lib/utils/utils.js +398 -307
  96. package/lib/xmlReader.d.ts +92 -0
  97. package/lib/xmlReader.js +525 -532
  98. package/package.json +64 -21
  99. package/src/adapter/codecept.js +373 -0
  100. package/src/adapter/cucumber/current.js +228 -0
  101. package/src/adapter/cucumber/legacy.js +158 -0
  102. package/src/adapter/cucumber.js +4 -0
  103. package/src/adapter/cypress-plugin/index.js +110 -0
  104. package/src/adapter/jasmine.js +60 -0
  105. package/src/adapter/jest.js +107 -0
  106. package/src/adapter/mocha.cjs +2 -0
  107. package/src/adapter/mocha.js +156 -0
  108. package/src/adapter/nightwatch.js +88 -0
  109. package/src/adapter/playwright.js +254 -0
  110. package/src/adapter/vitest.js +183 -0
  111. package/src/adapter/webdriver.js +142 -0
  112. package/src/bin/cli.js +348 -0
  113. package/src/bin/reportXml.js +77 -0
  114. package/src/bin/startTest.js +124 -0
  115. package/src/bin/uploadArtifacts.js +91 -0
  116. package/src/client.js +515 -0
  117. package/src/config.js +30 -0
  118. package/src/constants.js +53 -0
  119. package/src/data-storage.js +204 -0
  120. package/src/junit-adapter/adapter.js +23 -0
  121. package/src/junit-adapter/csharp.js +28 -0
  122. package/src/junit-adapter/index.js +28 -0
  123. package/src/junit-adapter/java.js +58 -0
  124. package/src/junit-adapter/javascript.js +31 -0
  125. package/src/junit-adapter/python.js +42 -0
  126. package/src/junit-adapter/ruby.js +10 -0
  127. package/src/output.js +57 -0
  128. package/src/pipe/bitbucket.js +252 -0
  129. package/src/pipe/csv.js +140 -0
  130. package/src/pipe/debug.js +125 -0
  131. package/src/pipe/github.js +232 -0
  132. package/src/pipe/gitlab.js +247 -0
  133. package/src/pipe/html.js +373 -0
  134. package/src/pipe/index.js +71 -0
  135. package/src/pipe/testomatio.js +504 -0
  136. package/src/replay.js +262 -0
  137. package/src/reporter-functions.js +55 -0
  138. package/src/reporter.cjs_decprecated +21 -0
  139. package/src/reporter.js +33 -0
  140. package/src/services/artifacts.js +59 -0
  141. package/src/services/index.js +13 -0
  142. package/src/services/key-values.js +59 -0
  143. package/src/services/logger.js +315 -0
  144. package/src/template/emptyData.svg +23 -0
  145. package/src/template/testomatio.hbs +1081 -0
  146. package/src/uploader.js +376 -0
  147. package/src/utils/pipe_utils.js +119 -0
  148. package/src/utils/utils.js +416 -0
  149. package/src/xmlReader.js +614 -0
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Update and validate the filter type.
3
+ * @param {string} type - The original filter type.
4
+ * @returns {string|undefined} The updated and validated filter type.
5
+ * Returns undefined if the type is not valid.
6
+ */
7
+ export function updateFilterType(type: string): string | undefined;
8
+ /**
9
+ * Parse filter parameters from a string in the format "type=id".
10
+ * @param {string} opts - The input string containing the filter parameters.
11
+ * @returns {Object} An object containing the parsed filter parameters.
12
+ * The object has properties "type" and "id".
13
+ */
14
+ export function parseFilterParams(opts: string): any;
15
+ /**
16
+ * Generates mode request parameters based on the input params.
17
+ * @param {{type: string, id?: string, apiKey: string}} params - The input parameters for the request.
18
+ * @returns {Object|null} - An object containing the generated request parameters, or null if the type is invalid.
19
+ */
20
+ export function generateFilterRequestParams(params: {
21
+ type: string;
22
+ id?: string;
23
+ apiKey: string;
24
+ }): any | null;
25
+ /**
26
+ * Set S3 credentials from the provided artifacts object.
27
+ * @param {Object} artifacts - The artifacts object containing S3 credentials.
28
+ */
29
+ export function setS3Credentials(artifacts: any): void;
30
+ /**
31
+ * Return an emoji based on the provided status.
32
+ * @param {string} status - The status value ('passed', 'failed', or 'skipped').
33
+ * @returns {string} - An emoji corresponding to the provided status.
34
+ */
35
+ export function statusEmoji(status: string): string;
36
+ /**
37
+ * Generate a full name string based on the provided test object.
38
+ * @param {object} t - The test object.
39
+ * @returns {string} - A formatted full name string for the test object.
40
+ */
41
+ export function fullName(t: object): string;
@@ -1,53 +1,58 @@
1
- const { APP_PREFIX } = require('../constants');
2
-
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");
3
10
  /**
4
11
  * Set S3 credentials from the provided artifacts object.
5
12
  * @param {Object} artifacts - The artifacts object containing S3 credentials.
6
13
  */
7
14
  function setS3Credentials(artifacts) {
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 || '';
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 || '';
20
32
  }
21
33
  /**
22
34
  * Generates mode request parameters based on the input params.
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.
35
+ * @param {{type: string, id?: string, apiKey: string}} params - The input parameters for the request.
27
36
  * @returns {Object|null} - An object containing the generated request parameters, or null if the type is invalid.
28
37
  */
29
38
  function generateFilterRequestParams(params) {
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
- };
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
+ };
49
55
  }
50
-
51
56
  /**
52
57
  * Parse filter parameters from a string in the format "type=id".
53
58
  * @param {string} opts - The input string containing the filter parameters.
@@ -55,15 +60,13 @@ function generateFilterRequestParams(params) {
55
60
  * The object has properties "type" and "id".
56
61
  */
57
62
  function parseFilterParams(opts) {
58
- const [type, id] = opts.split('=');
59
- const validType = updateFilterType(type);
60
-
61
- return {
62
- type: validType,
63
- id,
64
- };
63
+ const [type, id] = opts.split('=');
64
+ const validType = updateFilterType(type);
65
+ return {
66
+ type: validType,
67
+ id,
68
+ };
65
69
  }
66
-
67
70
  /**
68
71
  * Update and validate the filter type.
69
72
  * @param {string} type - The original filter type.
@@ -71,58 +74,59 @@ function parseFilterParams(opts) {
71
74
  * Returns undefined if the type is not valid.
72
75
  */
73
76
  function updateFilterType(type) {
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;
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;
94
92
  }
95
-
96
93
  /**
97
94
  * Return an emoji based on the provided status.
98
95
  * @param {string} status - The status value ('passed', 'failed', or 'skipped').
99
96
  * @returns {string} - An emoji corresponding to the provided status.
100
97
  */
101
98
  function statusEmoji(status) {
102
- if (status === 'passed') return '🟢';
103
- if (status === 'failed') return '🔴';
104
- if (status === 'skipped') return '🟡';
105
- return '';
99
+ if (status === 'passed')
100
+ return '🟢';
101
+ if (status === 'failed')
102
+ return '🔴';
103
+ if (status === 'skipped')
104
+ return '🟡';
105
+ return '';
106
106
  }
107
-
108
107
  /**
109
108
  * Generate a full name string based on the provided test object.
110
109
  * @param {object} t - The test object.
111
110
  * @returns {string} - A formatted full name string for the test object.
112
111
  */
113
112
  function fullName(t) {
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;
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;
119
120
  }
120
121
 
121
- module.exports = {
122
- updateFilterType,
123
- parseFilterParams,
124
- generateFilterRequestParams,
125
- setS3Credentials,
126
- statusEmoji,
127
- fullName,
128
- };
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;
@@ -0,0 +1,54 @@
1
+ export function getPackageVersion(): any;
2
+ export const TEST_ID_REGEX: RegExp;
3
+ export const SUITE_ID_REGEX: RegExp;
4
+ export function ansiRegExp(): RegExp;
5
+ export function isSameTest(test: any, t: any): boolean;
6
+ export function fetchSourceCode(contents: any, opts?: {}): string;
7
+ export function fetchSourceCodeFromStackTrace(stack?: string): string;
8
+ export function fetchIdFromCode(code: any, opts?: {}): any;
9
+ export function fetchIdFromOutput(output: any): any;
10
+ export function fetchFilesFromStackTrace(stack?: string, checkExists?: boolean): string[];
11
+ export namespace fileSystem {
12
+ function createDir(dirPath: any): void;
13
+ function clearDir(dirPath: any): void;
14
+ }
15
+ export function foundedTestLog(app: any, tests: any): void;
16
+ export function formatStep(step: any, shift?: number): any;
17
+ export function getCurrentDateTime(): string;
18
+ /**
19
+ * @param {String} testTitle - Test title
20
+ *
21
+ * @returns {String|null} testId
22
+ */
23
+ export function getTestomatIdFromTestTitle(testTitle: string): string | null;
24
+ export function humanize(text: any): any;
25
+ export function isValidUrl(s: any): boolean;
26
+ /**
27
+ * @param {String} suiteTitle - suite title
28
+ *
29
+ * @returns {String|null} suiteId
30
+ */
31
+ export function parseSuite(suiteTitle: string): string | null;
32
+ export function readLatestRunId(): string;
33
+ /**
34
+ * Used to remove color codes
35
+ * @param {*} input
36
+ * @returns
37
+ */
38
+ export function removeColorCodes(input: any): any;
39
+ /**
40
+ * @param {Object} test - Test adapter object
41
+ *
42
+ * @returns {String|null} testInfo as one string
43
+ */
44
+ export function specificTestInfo(test: any): string | null;
45
+ export function storeRunId(runId: any): void;
46
+ export namespace testRunnerHelper {
47
+ function getNameOfCurrentlyRunningTest(): any;
48
+ }
49
+ /**
50
+ * Validates TESTOMATIO_SUITE environment variable format
51
+ * @param {String} suiteId - suite ID to validate
52
+ * @returns {String|null} validated suite ID or null if invalid
53
+ */
54
+ export function validateSuiteId(suiteId: string): string | null;