playwright-ts-automationframework 1.1.72 → 1.1.74

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.
@@ -21,16 +21,20 @@ export declare class Assertion extends Actions {
21
21
  verifyIsNotEquals(object1: any, object2: any, controlDescription?: string): void;
22
22
  verifyIsEqualIgnorecase(object1: any, object2: any, controlDescription?: string, caseInsensitive?: boolean): void;
23
23
  /**
24
- * Verify first value contains substring as second.
25
- * If expected value is present in actual value then test case gets passed else failed..
24
+ * Verify that a string contains a substring, or that at least one entry in an array of strings contains it.
25
+ * If the expected substring is present, the test passes; otherwise it fails.
26
+ *
27
+ * @param actual Full text to search in, or an array of strings (any element may contain the substring).
28
+ * @param expected Substring that must be contained (trimmed for comparison).
29
+ * @param controlDescription Optional label included in the verification log.
26
30
  *
27
- * @param expected First object which has .
28
- * @param actual Second object.
29
31
  * Example:
30
32
  *
31
33
  * verifyIsContains("Invalid username Test", "Invalid username");
34
+ * verifyIsContains(["x", "Invalid username Test"], "Invalid username");
32
35
  */
33
36
  verifyIsContains(actual: string, expected: string, controlDescription?: string): void;
37
+ verifyIsContains(actual: string[], expected: string, controlDescription?: string): void;
34
38
  /**
35
39
  * Verify element's displayed/not displayed status as per expected value
36
40
  * If expected element's displayed status is as per expected then test case gets passed else failed..
@@ -70,20 +70,27 @@ class Assertion extends actions_core_1.Actions {
70
70
  throw error1;
71
71
  }
72
72
  }
73
- /**
74
- * Verify first value contains substring as second.
75
- * If expected value is present in actual value then test case gets passed else failed..
76
- *
77
- * @param expected First object which has .
78
- * @param actual Second object.
79
- * Example:
80
- *
81
- * verifyIsContains("Invalid username Test", "Invalid username");
82
- */
83
73
  verifyIsContains(actual, expected, controlDescription = "") {
74
+ if (Array.isArray(actual)) {
75
+ try {
76
+ const trimmedItems = actual.map((s) => String(s).trim());
77
+ const needle = expected.trim();
78
+ const found = trimmedItems.some((item) => item.includes(needle));
79
+ const verificationResult = found ? "✅ PASSED" : "❌ FAILED";
80
+ const itemsForLog = trimmedItems.map((i) => `'${i}'`).join(", ");
81
+ const logText = `VERIFICATION: '${verificationResult}'. ${controlDescription} Actual: [${itemsForLog}] — at least one element contains Expected: '${needle}'`;
82
+ (0, logs_core_1.logVerification)(logText);
83
+ test_1.expect.soft(found, logText).toBe(true);
84
+ }
85
+ catch (error1) {
86
+ (0, logs_core_1.logError)(`VERIFICATION: '❌ FAILED'. Actual array (length ${actual.length}) should have an element containing Expected: '${expected}' due to reason: '${error1}'`);
87
+ throw error1;
88
+ }
89
+ return;
90
+ }
84
91
  try {
85
92
  const verificationResult = actual.trim().includes(expected.trim()) ? "✅ PASSED" : "❌ FAILED";
86
- let logText = `VERIFICATION: '${verificationResult}'. ${controlDescription} Actual: '${actual}' contains Expected: '${expected.trim()}'`;
93
+ const logText = `VERIFICATION: '${verificationResult}'. ${controlDescription} Actual: '${actual}' contains Expected: '${expected.trim()}'`;
87
94
  (0, logs_core_1.logVerification)(logText);
88
95
  test_1.expect.soft(actual.trim(), logText).toContain(expected.trim());
89
96
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playwright-ts-automationframework",
3
- "version": "1.1.72",
3
+ "version": "1.1.74",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -19,11 +19,11 @@
19
19
  "ignore-case": "^0.1.0"
20
20
  },
21
21
  "dependencies": {
22
- "@playwright/test": "^1.59.1",
23
- "@types/node": "^25.6.0",
22
+ "@playwright/test": "^1.60.0",
23
+ "@types/node": "^25.7.0",
24
24
  "log4js": "^6.9.1",
25
- "nodemailer": "^8.0.5",
26
- "npm": "^11.13.0",
25
+ "nodemailer": "^8.0.7",
26
+ "npm": "^11.14.1",
27
27
  "path": "^0.12.7",
28
28
  "typescript": "^6.0.3"
29
29
  },