playwright-ts-automationframework 1.1.75 → 1.1.76
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.
|
@@ -36,6 +36,21 @@ export declare class Assertion extends Actions {
|
|
|
36
36
|
verifyIsContains(actual: string, expected: string, controlDescription?: string): void;
|
|
37
37
|
verifyIsContains(actual: string[], expected: string, controlDescription?: string): void;
|
|
38
38
|
/**
|
|
39
|
+
* Verify that a string does not contain a substring, or that no entry in an array of strings contains it.
|
|
40
|
+
* If the expected substring is absent, the test passes; otherwise it fails.
|
|
41
|
+
*
|
|
42
|
+
* @param actual Full text to search in, or an array of strings (no element may contain the substring).
|
|
43
|
+
* @param expected Substring that must not be contained (trimmed for comparison).
|
|
44
|
+
* @param controlDescription Optional label included in the verification log.
|
|
45
|
+
*
|
|
46
|
+
* Example:
|
|
47
|
+
*
|
|
48
|
+
* verifyIsNotContains("Valid username", "Invalid username");
|
|
49
|
+
* verifyIsNotContains(["x", "Valid username"], "Invalid username");
|
|
50
|
+
*/
|
|
51
|
+
verifyIsNotContains(actual: string, expected: string, controlDescription?: string): void;
|
|
52
|
+
verifyIsNotContains(actual: string[], expected: string, controlDescription?: string): void;
|
|
53
|
+
/**
|
|
39
54
|
* Verify element's displayed/not displayed status as per expected value
|
|
40
55
|
* If expected element's displayed status is as per expected then test case gets passed else failed..
|
|
41
56
|
*
|
|
@@ -99,6 +99,35 @@ class Assertion extends actions_core_1.Actions {
|
|
|
99
99
|
throw error1;
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
+
verifyIsNotContains(actual, expected, controlDescription = "") {
|
|
103
|
+
if (Array.isArray(actual)) {
|
|
104
|
+
try {
|
|
105
|
+
const trimmedItems = actual.map((s) => String(s).trim());
|
|
106
|
+
const needle = expected.trim();
|
|
107
|
+
const found = trimmedItems.some((item) => item.includes(needle));
|
|
108
|
+
const verificationResult = !found ? "✅ PASSED" : "❌ FAILED";
|
|
109
|
+
const itemsForLog = trimmedItems.map((i) => `'${i}'`).join(", ");
|
|
110
|
+
const logText = `VERIFICATION: '${verificationResult}'. ${controlDescription} Actual: [${itemsForLog}] — no element contains Expected: '${needle}'`;
|
|
111
|
+
(0, logs_core_1.logVerification)(logText);
|
|
112
|
+
test_1.expect.soft(found, logText).toBe(false);
|
|
113
|
+
}
|
|
114
|
+
catch (error1) {
|
|
115
|
+
(0, logs_core_1.logError)(`VERIFICATION: '❌ FAILED'. Actual array (length ${actual.length}) should not have an element containing Expected: '${expected}' due to reason: '${error1}'`);
|
|
116
|
+
throw error1;
|
|
117
|
+
}
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
try {
|
|
121
|
+
const verificationResult = !actual.trim().includes(expected.trim()) ? "✅ PASSED" : "❌ FAILED";
|
|
122
|
+
const logText = `VERIFICATION: '${verificationResult}'. ${controlDescription} Actual: '${actual}' does not contain Expected: '${expected.trim()}'`;
|
|
123
|
+
(0, logs_core_1.logVerification)(logText);
|
|
124
|
+
test_1.expect.soft(actual.trim(), logText).not.toContain(expected.trim());
|
|
125
|
+
}
|
|
126
|
+
catch (error1) {
|
|
127
|
+
(0, logs_core_1.logError)(`VERIFICATION: '❌ FAILED'. Actual: '${actual}' should not contain Expected: '${expected}' due to reason: '${error1}'`);
|
|
128
|
+
throw error1;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
102
131
|
/**
|
|
103
132
|
* Verify element's displayed/not displayed status as per expected value
|
|
104
133
|
* If expected element's displayed status is as per expected then test case gets passed else failed..
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "playwright-ts-automationframework",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.76",
|
|
4
4
|
"description": "Playwright TypeScript automation framework with Actions, Assertions, and WebControl wrappers",
|
|
5
5
|
"homepage": "https://github.com/ketanp88/playwright-TS-AutomationFramework/blob/main/API-REFERENCE.md",
|
|
6
6
|
"main": "lib/index.js",
|