@anddone/coretestautomation 1.0.1

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 (72) hide show
  1. package/.github/workflows/npm-release.yml +102 -0
  2. package/dist/api/base.api.d.ts +32 -0
  3. package/dist/api/base.api.d.ts.map +1 -0
  4. package/dist/api/base.api.js +7 -0
  5. package/dist/api/base.api.js.map +1 -0
  6. package/dist/api/headers.d.ts +6 -0
  7. package/dist/api/headers.d.ts.map +1 -0
  8. package/dist/api/headers.js +23 -0
  9. package/dist/api/headers.js.map +1 -0
  10. package/dist/index.d.ts +13 -0
  11. package/dist/index.d.ts.map +1 -0
  12. package/dist/index.js +29 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/pages/basepage.d.ts +6 -0
  15. package/dist/pages/basepage.d.ts.map +1 -0
  16. package/dist/pages/basepage.js +10 -0
  17. package/dist/pages/basepage.js.map +1 -0
  18. package/dist/testData/api.data.json +6 -0
  19. package/dist/utils/apiUtils.d.ts +123 -0
  20. package/dist/utils/apiUtils.d.ts.map +1 -0
  21. package/dist/utils/apiUtils.js +264 -0
  22. package/dist/utils/apiUtils.js.map +1 -0
  23. package/dist/utils/assertionUtils.d.ts +223 -0
  24. package/dist/utils/assertionUtils.d.ts.map +1 -0
  25. package/dist/utils/assertionUtils.js +400 -0
  26. package/dist/utils/assertionUtils.js.map +1 -0
  27. package/dist/utils/commonUtils.d.ts +590 -0
  28. package/dist/utils/commonUtils.d.ts.map +1 -0
  29. package/dist/utils/commonUtils.js +1292 -0
  30. package/dist/utils/commonUtils.js.map +1 -0
  31. package/dist/utils/fakerStaticData.d.ts +16 -0
  32. package/dist/utils/fakerStaticData.d.ts.map +1 -0
  33. package/dist/utils/fakerStaticData.js +88 -0
  34. package/dist/utils/fakerStaticData.js.map +1 -0
  35. package/dist/utils/fileCommonUtils.d.ts +22 -0
  36. package/dist/utils/fileCommonUtils.d.ts.map +1 -0
  37. package/dist/utils/fileCommonUtils.js +243 -0
  38. package/dist/utils/fileCommonUtils.js.map +1 -0
  39. package/dist/utils/generationUtils.d.ts +424 -0
  40. package/dist/utils/generationUtils.d.ts.map +1 -0
  41. package/dist/utils/generationUtils.js +869 -0
  42. package/dist/utils/generationUtils.js.map +1 -0
  43. package/dist/utils/pageUtils.d.ts +90 -0
  44. package/dist/utils/pageUtils.d.ts.map +1 -0
  45. package/dist/utils/pageUtils.js +214 -0
  46. package/dist/utils/pageUtils.js.map +1 -0
  47. package/dist/utils/tableUtils.d.ts +304 -0
  48. package/dist/utils/tableUtils.d.ts.map +1 -0
  49. package/dist/utils/tableUtils.js +555 -0
  50. package/dist/utils/tableUtils.js.map +1 -0
  51. package/dist/utils/validationUtils.d.ts +80 -0
  52. package/dist/utils/validationUtils.d.ts.map +1 -0
  53. package/dist/utils/validationUtils.js +172 -0
  54. package/dist/utils/validationUtils.js.map +1 -0
  55. package/package.json +23 -0
  56. package/playwright.config.ts +79 -0
  57. package/src/api/base.api.ts +39 -0
  58. package/src/api/headers.ts +17 -0
  59. package/src/index.ts +12 -0
  60. package/src/pages/basepage.ts +11 -0
  61. package/src/testData/api.data.json +6 -0
  62. package/src/types/pdf-parse.d.ts +6 -0
  63. package/src/utils/apiUtils.ts +307 -0
  64. package/src/utils/assertionUtils.ts +455 -0
  65. package/src/utils/commonUtils.ts +1544 -0
  66. package/src/utils/fakerStaticData.ts +91 -0
  67. package/src/utils/fileCommonUtils.ts +239 -0
  68. package/src/utils/generationUtils.ts +929 -0
  69. package/src/utils/pageUtils.ts +224 -0
  70. package/src/utils/tableUtils.ts +715 -0
  71. package/src/utils/validationUtils.ts +179 -0
  72. package/tsconfig.json +19 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiUtils.js","sourceRoot":"","sources":["../../src/utils/apiUtils.ts"],"names":[],"mappings":";;;;;;AACA,8EAAgD;AAWhD,MAAa,gBAAgB;IAC3B,MAAM;QACJ,OAAO,CAAC,CAAC;IACX,CAAC;IACD,EAAE;QACA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,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,CAChC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,KAAK,KAAK,CACxC,CAAC;YACJ,CAAC,CAAC,CAAC;YACH,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;gBACxC,OAAO,EAAE,CAAC;YACZ,CAAC;YACD,MAAM,MAAM,GAAG,KAAK,EAAE,CAAC,UAAU,CAAC,CAAC;YACnC,OAAO,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACvE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,yEAAyE;YACzE,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;;AAnRH,4BAoRC;AAnRgB,gBAAO,GAAG,KAAK,CAAC"}
@@ -0,0 +1,223 @@
1
+ import { CommonUtils } from './commonUtils';
2
+ export declare class AssertionUtils extends CommonUtils {
3
+ /**
4
+ * Verifies that the actual value matches the expected value using deep equality.
5
+ *
6
+ * This assertion supports comparison of all data types including primitives,
7
+ * objects, arrays, and nested structures. It performs a hard assertion using
8
+ * Playwright's `expect`, causing the test to fail immediately on mismatch.
9
+ *
10
+ * Values are normalized before comparison to ensure consistency across
11
+ * UI and API validations.
12
+ *
13
+ * @typeParam T - Type of the compared values
14
+ * @param actual - The actual value obtained during test execution
15
+ * @param expected - The expected value to compare against
16
+ * @param message - Optional custom failure message
17
+ *
18
+ * @throws AssertionError if values are not equal
19
+ */
20
+ static verifyEquals<T>(actual: T, expected: T, message?: string): void;
21
+ /**
22
+ * Verifies that the given condition is TRUE.
23
+ *
24
+ * @param condition - Boolean condition to evaluate
25
+ * @param message - Optional custom failure message
26
+ *
27
+ * @throws AssertionError if condition is false
28
+ */
29
+ static verifyTrue(condition: boolean, message?: string): void;
30
+ /**
31
+ * Verifies that the given condition is FALSE.
32
+ *
33
+ * @param condition - Boolean condition to evaluate
34
+ * @param message - Optional custom failure message
35
+ *
36
+ * @throws AssertionError if condition is true
37
+ */
38
+ static verifyFalse(condition: boolean, message?: string): void;
39
+ /**
40
+ * Verifies that the actual numeric value is within the allowed tolerance.
41
+ *
42
+ * Commonly used for validating monetary amounts or calculated values.
43
+ *
44
+ * @param actual - The actual numeric value
45
+ * @param expected - The expected numeric value
46
+ * @param tolerance - Allowed deviation from expected value
47
+ * @param message - Optional custom failure message
48
+ *
49
+ * @throws AssertionError if actual value exceeds tolerance
50
+ */
51
+ static verifyAmount(actual: number, expected: number, tolerance: number, message?: string): void;
52
+ /**
53
+ * Verifies that the provided value is defined (neither NULL nor UNDEFINED).
54
+ *
55
+ * This assertion ensures the value is usable and prevents null/undefined errors.
56
+ * It covers both `null` and `undefined` cases.
57
+ *
58
+ * @param value - Value to validate
59
+ * @param message - Optional custom failure message
60
+ *
61
+ * @throws AssertionError if value is null or undefined
62
+ */
63
+ static verifyNotNull(value: unknown, message?: string): void;
64
+ /**
65
+ * Verifies that the provided value is NULL or UNDEFINED.
66
+ *
67
+ * @param value - Value to validate
68
+ * @param message - Optional custom failure message
69
+ *
70
+ * @throws AssertionError if value is neither null nor undefined
71
+ */
72
+ static verifyNullOrUndefined(value: unknown, message?: string): void;
73
+ /**
74
+ * Verifies that the provided string or array is NOT EMPTY.
75
+ *
76
+ * @param value - String or array to validate
77
+ * @param message - Optional custom failure message
78
+ *
79
+ * @throws AssertionError if value is empty
80
+ */
81
+ static verifyNotEmpty(value: string | any[], message?: string): void;
82
+ /**
83
+ *This method soft verify equality for any type of data and
84
+ * supports comparison of all data types including primitives, objects,
85
+ * arrays, and nested structures. It uses Playwright's `expect.soft` assertion,
86
+ * allowing test execution to continue even if the assertion fails.
87
+ *
88
+ * @param actual Actual value
89
+ * @param expected Expected value
90
+ * @param message Optional custom message
91
+ */
92
+ static softVerifyEquals<T>(actual: T, expected: T, message?: string): void;
93
+ /**
94
+ * Softly verifies that the given condition is TRUE.
95
+ *
96
+ * @param condition - Boolean condition to evaluate
97
+ * @param message - Optional custom failure message
98
+ */
99
+ static softVerifyTrue(condition: boolean, message?: string): void;
100
+ /**
101
+ * Softly verifies that the given condition is FALSE.
102
+ *
103
+ * @param condition - Boolean condition to evaluate
104
+ * @param message - Optional custom failure message
105
+ */
106
+ static softVerifyFalse(condition: boolean, message?: string): void;
107
+ /**
108
+ * Softly verifies that the actual numeric value is within the allowed tolerance.
109
+ *
110
+ * Commonly used for validating monetary amounts or calculated values.
111
+ *
112
+ * @param actual - The actual numeric value
113
+ * @param expected - The expected numeric value
114
+ * @param tolerance - Allowed deviation from expected value
115
+ * @param message - Optional custom failure message
116
+ */
117
+ static softVerifyAmount(actual: number, expected: number, tolerance: number, message?: string): void;
118
+ /**
119
+ *
120
+ * This soft assertion ensures the value is usable and prevents null/undefined errors.
121
+ * Unlike a hard assertion, the test continues even if the value is null or undefined.
122
+ *
123
+ * @param value - Value to validate
124
+ * @param message - Optional custom failure message
125
+ */
126
+ static softVerifyNullOrUndefined(value: unknown, message?: string): void;
127
+ /**
128
+ * Softly verifies that the provided value is NULL.
129
+ *
130
+ * @param value - Value to validate
131
+ * @param message - Optional custom failure message
132
+ */
133
+ static softVerifyNull(value: unknown, message?: string): void;
134
+ /**
135
+ * Softly verifies that the provided value is NOT EMPTY.
136
+ *
137
+ * Supports:
138
+ * - string
139
+ * - array
140
+ * - object
141
+ * - Map / Set (via normalize)
142
+ *
143
+ * @param value - Value to validate
144
+ * @param message - Optional custom failure message
145
+ */
146
+ static softVerifyNotEmpty(value: unknown, message?: string): void;
147
+ /**
148
+ * Softly verifies that the actual string contains the expected substring.
149
+ *
150
+ * @param actual - Actual string
151
+ * @param expected - Substring expected to be present
152
+ * @param message - Optional custom failure message
153
+ */
154
+ static softVerifyContains(actual: string, expected: string, message?: string): void;
155
+ /**
156
+ * Softly verifies that the actual string NOT contains the expected substring.
157
+ *
158
+ * @param actual - Actual string
159
+ * @param expected - Substring expected to be present
160
+ * @param message - Optional custom failure message
161
+ */
162
+ static softVerifyNotContains(actual: string, expected: string, message?: string): void;
163
+ /**
164
+ * Softly verifies that two values are NOT equal.
165
+ *
166
+ * Supports all data types via normalization.
167
+ *
168
+ * @typeParam T - Type of compared values
169
+ * @param actual - Actual value
170
+ * @param expected - Value that actual must NOT equal
171
+ * @param message - Optional custom failure message
172
+ */
173
+ static softVerifyNotEquals<T>(actual: T, expected: T, message?: string): void;
174
+ /**
175
+ * Softly verifies that date list is sorted from newest to oldest.
176
+ *
177
+ * @param actual - Dates from UI
178
+ * @param format - Date format
179
+ * @param message - Optional failure message
180
+ */
181
+ static softVerifyDatesNewestToOldest(actual: string[], format: string, message?: string): void;
182
+ /**
183
+ * Softly verifies that date list is sorted from oldest to newest.
184
+ */
185
+ static softVerifyDatesOldestToNewest(actual: string[], format: string, message?: string): void;
186
+ /**
187
+ * Normalizes complex data types into comparable primitive or array formats.
188
+ *
189
+ * This method is used before assertions to ensure consistent comparisons
190
+ * across different data types. It transforms certain objects into
191
+ * standard representations that can be reliably compared using deep equality.
192
+ *
193
+ * Supported transformations:
194
+ * - `Map` → Array of `[key, value]` pairs
195
+ * - `Set` → Array of values
196
+ * - `Date` → Unix timestamp (milliseconds)
197
+ * - `RegExp` → String representation
198
+ *
199
+ * @param value - The value to normalize
200
+ * @returns A normalized version of the value suitable for comparison
201
+ */
202
+ private static normalize;
203
+ /**
204
+ * Converts a value into a readable string representation for logging or
205
+ * assertion messages.
206
+ *
207
+ * This method ensures that complex data types like `Map`, `Set`, and
208
+ * objects are serialized into a human-readable JSON format, while
209
+ * primitives are converted to strings. This helps in generating
210
+ * meaningful assertion messages and logs.
211
+ *
212
+ * Supported transformations:
213
+ * - `Map` → JSON array of `[key, value]` pairs
214
+ * - `Set` → JSON array of values
215
+ * - `Object` → JSON string
216
+ * - Other types → String conversion
217
+ *
218
+ * @param value - The value to stringify
219
+ * @returns A string representation of the value
220
+ */
221
+ private static stringify;
222
+ }
223
+ //# sourceMappingURL=assertionUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assertionUtils.d.ts","sourceRoot":"","sources":["../../src/utils/assertionUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,qBAAa,cAAe,SAAQ,WAAW;IAC3C;;;;;;;;;;;;;;;;QAgBI;IACJ,MAAM,CAAC,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM,GAC5D,IAAI;IAaP;;;;;;;OAOG;IACH,MAAM,CAAC,UAAU,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI;IAQ7D;;;;;;;OAOG;IACH,MAAM,CAAC,WAAW,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI;IAQ9D;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GACtF,IAAI;IASP;;;;;;;;;;MAUE;IACF,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI;IAU5D;;;;;;;OAOG;IACH,MAAM,CAAC,qBAAqB,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI;IASpE;;;;;;;OAOG;IACH,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,EAAE,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI;IAwBpE;;;;;;;;;OASG;IACH,MAAM,CAAC,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EA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,6BAA6B,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GACpF,IAAI;IAUP;;OAEG;IACH,MAAM,CAAC,6BAA6B,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GACpF,IAAI;IAUP;;;;;;;;;;;;;;;MAeE;IACF,OAAO,CAAC,MAAM,CAAC,SAAS;IAgBxB;;;;;;;;;;;;;;;;;OAiBG;IACH,OAAO,CAAC,MAAM,CAAC,SAAS;CAgB3B"}
@@ -0,0 +1,400 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AssertionUtils = void 0;
4
+ const test_1 = require("@playwright/test");
5
+ const commonUtils_1 = require("./commonUtils");
6
+ class AssertionUtils extends commonUtils_1.CommonUtils {
7
+ /**
8
+ * Verifies that the actual value matches the expected value using deep equality.
9
+ *
10
+ * This assertion supports comparison of all data types including primitives,
11
+ * objects, arrays, and nested structures. It performs a hard assertion using
12
+ * Playwright's `expect`, causing the test to fail immediately on mismatch.
13
+ *
14
+ * Values are normalized before comparison to ensure consistency across
15
+ * UI and API validations.
16
+ *
17
+ * @typeParam T - Type of the compared values
18
+ * @param actual - The actual value obtained during test execution
19
+ * @param expected - The expected value to compare against
20
+ * @param message - Optional custom failure message
21
+ *
22
+ * @throws AssertionError if values are not equal
23
+ */
24
+ static verifyEquals(actual, expected, message) {
25
+ const finalMessage = message
26
+ ? `${message} | Expected: [${this.stringify(expected)}] | Actual: [${this.stringify(actual)}]`
27
+ : `Expected: [${this.stringify(expected)}] | Actual: [${this.stringify(actual)}]`;
28
+ const normActual = this.normalize(actual);
29
+ const normExpected = this.normalize(expected);
30
+ // Deep equality assertion works for all data types
31
+ (0, test_1.expect)(normActual, finalMessage).toEqual(normExpected);
32
+ }
33
+ /**
34
+ * Verifies that the given condition is TRUE.
35
+ *
36
+ * @param condition - Boolean condition to evaluate
37
+ * @param message - Optional custom failure message
38
+ *
39
+ * @throws AssertionError if condition is false
40
+ */
41
+ static verifyTrue(condition, message) {
42
+ const finalMessage = message
43
+ ? `${message} | Actual value: [${condition}]`
44
+ : `Expected condition to be TRUE, Actual [${condition}]`;
45
+ (0, test_1.expect)(condition, finalMessage).toBeTruthy();
46
+ }
47
+ /**
48
+ * Verifies that the given condition is FALSE.
49
+ *
50
+ * @param condition - Boolean condition to evaluate
51
+ * @param message - Optional custom failure message
52
+ *
53
+ * @throws AssertionError if condition is true
54
+ */
55
+ static verifyFalse(condition, message) {
56
+ const finalMessage = message
57
+ ? `${message} | Actual value: [${condition}]`
58
+ : `Expected condition to be FALSE, Actual [${condition}]`;
59
+ (0, test_1.expect)(condition, finalMessage).toBeFalsy();
60
+ }
61
+ /**
62
+ * Verifies that the actual numeric value is within the allowed tolerance.
63
+ *
64
+ * Commonly used for validating monetary amounts or calculated values.
65
+ *
66
+ * @param actual - The actual numeric value
67
+ * @param expected - The expected numeric value
68
+ * @param tolerance - Allowed deviation from expected value
69
+ * @param message - Optional custom failure message
70
+ *
71
+ * @throws AssertionError if actual value exceeds tolerance
72
+ */
73
+ static verifyAmount(actual, expected, tolerance, message) {
74
+ const finalMessage = message
75
+ ? `${message} | Expected: ${expected} ±${tolerance}, Actual: ${actual}`
76
+ : `Expected ${expected} ±${tolerance}, Actual ${actual}`;
77
+ (0, test_1.expect)(Math.abs(actual - expected), finalMessage)
78
+ .toBeLessThanOrEqual(tolerance);
79
+ }
80
+ /**
81
+ * Verifies that the provided value is defined (neither NULL nor UNDEFINED).
82
+ *
83
+ * This assertion ensures the value is usable and prevents null/undefined errors.
84
+ * It covers both `null` and `undefined` cases.
85
+ *
86
+ * @param value - Value to validate
87
+ * @param message - Optional custom failure message
88
+ *
89
+ * @throws AssertionError if value is null or undefined
90
+ */
91
+ static verifyNotNull(value, message) {
92
+ const isDefinedAndNotNull = value !== null && value !== undefined;
93
+ const finalMessage = message
94
+ ? `${message} | Actual value: [${String(value)}]`
95
+ : `Expected value to be defined (NOT NULL or UNDEFINED), Actual [${String(value)}]`;
96
+ (0, test_1.expect)(isDefinedAndNotNull, finalMessage).toBeTruthy();
97
+ }
98
+ /**
99
+ * Verifies that the provided value is NULL or UNDEFINED.
100
+ *
101
+ * @param value - Value to validate
102
+ * @param message - Optional custom failure message
103
+ *
104
+ * @throws AssertionError if value is neither null nor undefined
105
+ */
106
+ static verifyNullOrUndefined(value, message) {
107
+ const isNullOrUndefined = value === null || value === undefined;
108
+ const finalMessage = message
109
+ ? `${message} | Actual value: [${String(value)}]`
110
+ : `Expected value to be NULL or UNDEFINED, Actual [${String(value)}]`;
111
+ (0, test_1.expect)(isNullOrUndefined, finalMessage).toBeTruthy();
112
+ }
113
+ /**
114
+ * Verifies that the provided string or array is NOT EMPTY.
115
+ *
116
+ * @param value - String or array to validate
117
+ * @param message - Optional custom failure message
118
+ *
119
+ * @throws AssertionError if value is empty
120
+ */
121
+ static verifyNotEmpty(value, message) {
122
+ const normalized = this.normalize(value);
123
+ let isNotEmpty = false;
124
+ let actualInfo = '';
125
+ if (typeof normalized === 'string' || Array.isArray(normalized)) {
126
+ isNotEmpty = normalized.length > 0;
127
+ actualInfo = `length=${normalized.length}`;
128
+ }
129
+ else if (typeof normalized === 'object' && normalized !== null) {
130
+ const keys = Object.keys(normalized);
131
+ isNotEmpty = keys.length > 0;
132
+ actualInfo = `keys=${keys.length}`;
133
+ }
134
+ else {
135
+ actualInfo = String(normalized);
136
+ }
137
+ const finalMessage = message
138
+ ? `${message} | Actual: ${actualInfo}`
139
+ : `Expected value to be NOT EMPTY, Actual: ${actualInfo}`;
140
+ (0, test_1.expect)(value, finalMessage).not.toHaveLength(0);
141
+ }
142
+ /**
143
+ *This method soft verify equality for any type of data and
144
+ * supports comparison of all data types including primitives, objects,
145
+ * arrays, and nested structures. It uses Playwright's `expect.soft` assertion,
146
+ * allowing test execution to continue even if the assertion fails.
147
+ *
148
+ * @param actual Actual value
149
+ * @param expected Expected value
150
+ * @param message Optional custom message
151
+ */
152
+ static softVerifyEquals(actual, expected, message) {
153
+ const finalMessage = message
154
+ ? `${message} | Expected: [${this.stringify(expected)}] | Actual: [${this.stringify(actual)}]`
155
+ : `Expected: [${this.stringify(expected)}] | Actual: [${this.stringify(actual)}]`;
156
+ const normActual = this.normalize(actual);
157
+ const normExpected = this.normalize(expected);
158
+ // toEqual works for all types
159
+ test_1.expect.soft(normActual, finalMessage).toEqual(normExpected);
160
+ }
161
+ /**
162
+ * Softly verifies that the given condition is TRUE.
163
+ *
164
+ * @param condition - Boolean condition to evaluate
165
+ * @param message - Optional custom failure message
166
+ */
167
+ static softVerifyTrue(condition, message) {
168
+ const finalMessage = message
169
+ ? `${message} | Actual value: [${condition}]`
170
+ : `Expected condition to be TRUE, Actual [${condition}]`;
171
+ test_1.expect.soft(condition, finalMessage).toBeTruthy();
172
+ }
173
+ /**
174
+ * Softly verifies that the given condition is FALSE.
175
+ *
176
+ * @param condition - Boolean condition to evaluate
177
+ * @param message - Optional custom failure message
178
+ */
179
+ static softVerifyFalse(condition, message) {
180
+ const finalMessage = message
181
+ ? `${message} | Actual value: [${condition}]`
182
+ : `Expected condition to be FALSE, Actual [${condition}]`;
183
+ test_1.expect.soft(condition, finalMessage).toBeFalsy();
184
+ }
185
+ /**
186
+ * Softly verifies that the actual numeric value is within the allowed tolerance.
187
+ *
188
+ * Commonly used for validating monetary amounts or calculated values.
189
+ *
190
+ * @param actual - The actual numeric value
191
+ * @param expected - The expected numeric value
192
+ * @param tolerance - Allowed deviation from expected value
193
+ * @param message - Optional custom failure message
194
+ */
195
+ static softVerifyAmount(actual, expected, tolerance, message) {
196
+ const finalMessage = message
197
+ ? `${message} | Expected: ${expected} ±${tolerance}, Actual: ${actual}`
198
+ : `Expected ${expected} ±${tolerance}, Actual ${actual}`;
199
+ test_1.expect.soft(Math.abs(actual - expected), finalMessage).toBeLessThanOrEqual(tolerance);
200
+ }
201
+ /**
202
+ *
203
+ * This soft assertion ensures the value is usable and prevents null/undefined errors.
204
+ * Unlike a hard assertion, the test continues even if the value is null or undefined.
205
+ *
206
+ * @param value - Value to validate
207
+ * @param message - Optional custom failure message
208
+ */
209
+ static softVerifyNullOrUndefined(value, message) {
210
+ const isNullOrUndefined = value === null || value === undefined;
211
+ const finalMessage = message
212
+ ? `${message} | Actual value: [${String(value)}]`
213
+ : `Expected value to be NULL or UNDEFINED, but found [${String(value)}]`;
214
+ test_1.expect.soft(isNullOrUndefined, finalMessage).toBeTruthy();
215
+ }
216
+ /**
217
+ * Softly verifies that the provided value is NULL.
218
+ *
219
+ * @param value - Value to validate
220
+ * @param message - Optional custom failure message
221
+ */
222
+ static softVerifyNull(value, message) {
223
+ const finalMessage = message
224
+ ? `${message} | Actual value: [${value}]`
225
+ : `Expected value to be NULL, Actual [${value}]`;
226
+ test_1.expect.soft(value, finalMessage).toBeNull();
227
+ }
228
+ /**
229
+ * Softly verifies that the provided value is NOT EMPTY.
230
+ *
231
+ * Supports:
232
+ * - string
233
+ * - array
234
+ * - object
235
+ * - Map / Set (via normalize)
236
+ *
237
+ * @param value - Value to validate
238
+ * @param message - Optional custom failure message
239
+ */
240
+ static softVerifyNotEmpty(value, message) {
241
+ const normalized = this.normalize(value);
242
+ let isNotEmpty = false;
243
+ let actualInfo = '';
244
+ if (typeof normalized === 'string' || Array.isArray(normalized)) {
245
+ isNotEmpty = normalized.length > 0;
246
+ actualInfo = `length=${normalized.length}`;
247
+ }
248
+ else if (typeof normalized === 'object' && normalized !== null) {
249
+ const keys = Object.keys(normalized);
250
+ isNotEmpty = keys.length > 0;
251
+ actualInfo = `keys=${keys.length}`;
252
+ }
253
+ else {
254
+ actualInfo = String(normalized);
255
+ }
256
+ const finalMessage = message
257
+ ? `${message} | Actual: ${actualInfo}`
258
+ : `Expected value to be NOT EMPTY, Actual: ${actualInfo}`;
259
+ test_1.expect.soft(isNotEmpty, finalMessage).toBeTruthy();
260
+ }
261
+ /**
262
+ * Softly verifies that the actual string contains the expected substring.
263
+ *
264
+ * @param actual - Actual string
265
+ * @param expected - Substring expected to be present
266
+ * @param message - Optional custom failure message
267
+ */
268
+ static softVerifyContains(actual, expected, message) {
269
+ const isContains = actual.includes(expected);
270
+ const finalMessage = message
271
+ ? `${message} | Expected to contain [${expected}], Actual [${actual}]`
272
+ : `Expected string to contain [${expected}], Actual [${actual}]`;
273
+ test_1.expect.soft(isContains, finalMessage).toBeTruthy();
274
+ }
275
+ /**
276
+ * Softly verifies that the actual string NOT contains the expected substring.
277
+ *
278
+ * @param actual - Actual string
279
+ * @param expected - Substring expected to be present
280
+ * @param message - Optional custom failure message
281
+ */
282
+ static softVerifyNotContains(actual, expected, message) {
283
+ const isNotContains = !actual.includes(expected);
284
+ const finalMessage = message
285
+ ? `${message} | Expected NOT to contain [${expected}], Actual [${actual}]`
286
+ : `Expected string NOT to contain [${expected}], but found [${actual}]`;
287
+ test_1.expect.soft(isNotContains, finalMessage).toBeTruthy();
288
+ }
289
+ /**
290
+ * Softly verifies that two values are NOT equal.
291
+ *
292
+ * Supports all data types via normalization.
293
+ *
294
+ * @typeParam T - Type of compared values
295
+ * @param actual - Actual value
296
+ * @param expected - Value that actual must NOT equal
297
+ * @param message - Optional custom failure message
298
+ */
299
+ static softVerifyNotEquals(actual, expected, message) {
300
+ const normActual = this.normalize(actual);
301
+ const normExpected = this.normalize(expected);
302
+ const isNotEqual = JSON.stringify(normActual) !== JSON.stringify(normExpected);
303
+ const finalMessage = message
304
+ ? `${message} | Not Expected: [${this.stringify(expected)}], Actual: [${this.stringify(actual)}]`
305
+ : `Expected values to be DIFFERENT, Actual both were [${this.stringify(actual)}]`;
306
+ test_1.expect.soft(isNotEqual, finalMessage).toBeTruthy();
307
+ }
308
+ /**
309
+ * Softly verifies that date list is sorted from newest to oldest.
310
+ *
311
+ * @param actual - Dates from UI
312
+ * @param format - Date format
313
+ * @param message - Optional failure message
314
+ */
315
+ static softVerifyDatesNewestToOldest(actual, format, message) {
316
+ const expected = this.sortDateNewestToOldest(actual, format);
317
+ const finalMessage = message
318
+ ? `${message} | Actual order: [${actual.join(' | ')}]`
319
+ : `Expected dates sorted from NEWEST to OLDEST but found [${actual.join(' | ')}]`;
320
+ test_1.expect.soft(actual, finalMessage).toEqual(expected);
321
+ }
322
+ /**
323
+ * Softly verifies that date list is sorted from oldest to newest.
324
+ */
325
+ static softVerifyDatesOldestToNewest(actual, format, message) {
326
+ const expected = this.sortDateOldestToNewest(actual, format);
327
+ const finalMessage = message
328
+ ? `${message} | Actual order: [${actual.join(' | ')}]`
329
+ : `Expected dates sorted from OLDEST to NEWEST but found [${actual.join(' | ')}]`;
330
+ test_1.expect.soft(actual, finalMessage).toEqual(expected);
331
+ }
332
+ /**
333
+ * Normalizes complex data types into comparable primitive or array formats.
334
+ *
335
+ * This method is used before assertions to ensure consistent comparisons
336
+ * across different data types. It transforms certain objects into
337
+ * standard representations that can be reliably compared using deep equality.
338
+ *
339
+ * Supported transformations:
340
+ * - `Map` → Array of `[key, value]` pairs
341
+ * - `Set` → Array of values
342
+ * - `Date` → Unix timestamp (milliseconds)
343
+ * - `RegExp` → String representation
344
+ *
345
+ * @param value - The value to normalize
346
+ * @returns A normalized version of the value suitable for comparison
347
+ */
348
+ static normalize(value) {
349
+ if (value instanceof Map) {
350
+ return Array.from(value.entries());
351
+ }
352
+ if (value instanceof Set) {
353
+ return Array.from(value.values());
354
+ }
355
+ if (value instanceof Date) {
356
+ return value.getTime();
357
+ }
358
+ if (value instanceof RegExp) {
359
+ return value.toString();
360
+ }
361
+ return value;
362
+ }
363
+ /**
364
+ * Converts a value into a readable string representation for logging or
365
+ * assertion messages.
366
+ *
367
+ * This method ensures that complex data types like `Map`, `Set`, and
368
+ * objects are serialized into a human-readable JSON format, while
369
+ * primitives are converted to strings. This helps in generating
370
+ * meaningful assertion messages and logs.
371
+ *
372
+ * Supported transformations:
373
+ * - `Map` → JSON array of `[key, value]` pairs
374
+ * - `Set` → JSON array of values
375
+ * - `Object` → JSON string
376
+ * - Other types → String conversion
377
+ *
378
+ * @param value - The value to stringify
379
+ * @returns A string representation of the value
380
+ */
381
+ static stringify(value) {
382
+ try {
383
+ if (value instanceof Map) {
384
+ return JSON.stringify(Array.from(value.entries()));
385
+ }
386
+ if (value instanceof Set) {
387
+ return JSON.stringify(Array.from(value.values()));
388
+ }
389
+ if (typeof value === 'object' && value !== null) {
390
+ return JSON.stringify(value);
391
+ }
392
+ return String(value);
393
+ }
394
+ catch {
395
+ return String(value);
396
+ }
397
+ }
398
+ }
399
+ exports.AssertionUtils = AssertionUtils;
400
+ //# sourceMappingURL=assertionUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assertionUtils.js","sourceRoot":"","sources":["../../src/utils/assertionUtils.ts"],"names":[],"mappings":";;;AAAA,2CAA0C;AAC1C,+CAA4C;AAE5C,MAAa,cAAe,SAAQ,yBAAW;IAC3C;;;;;;;;;;;;;;;;QAgBI;IACJ,MAAM,CAAC,YAAY,CAAI,MAAS,EAAE,QAAW,EAAE,OAAgB;QAE3D,MAAM,YAAY,GAAG,OAAO;YACxB,CAAC,CAAC,GAAG,OAAO,iBAAiB,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,gBAAgB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG;YAC9F,CAAC,CAAC,cAAc,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,gBAAgB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC;QAEtF,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAC1C,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QAE9C,mDAAmD;QACnD,IAAA,aAAM,EAAC,UAAU,EAAE,YAAY,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IAC3D,CAAC;IAGD;;;;;;;OAOG;IACH,MAAM,CAAC,UAAU,CAAC,SAAkB,EAAE,OAAgB;Q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