playwright-ts-automationframework 1.1.49 → 1.1.51

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.
@@ -96,6 +96,7 @@ export declare class Actions extends BasePage {
96
96
  * selectDropDownByText(cityDrpdwn, "Sydney");
97
97
  */
98
98
  selectDropDownByText(control: WebControl, optionTobeSelcted: string): Promise<void>;
99
+ selectDropDownByPartialText(control: WebControl, partialText: string): Promise<void>;
99
100
  /**
100
101
  * Select dropdown element by index.
101
102
  *
@@ -289,6 +289,33 @@ var Actions = /** @class */ (function (_super) {
289
289
  });
290
290
  });
291
291
  };
292
+ Actions.prototype.selectDropDownByPartialText = function (control, partialText) {
293
+ return __awaiter(this, void 0, void 0, function () {
294
+ var options, matchingOption;
295
+ return __generator(this, function (_a) {
296
+ switch (_a.label) {
297
+ case 0: return [4 /*yield*/, control.controlLocator.first().locator('option').allInnerTexts()];
298
+ case 1:
299
+ options = _a.sent();
300
+ matchingOption = options.find(function (option) { return option.includes(partialText); });
301
+ if (!matchingOption) {
302
+ (0, logs_core_1.logError)("No option found containing '".concat(partialText, "' in '").concat(control.controlDescription, "'"));
303
+ throw new Error("No matching option found for '".concat(partialText, "'"));
304
+ }
305
+ return [4 /*yield*/, control.controlLocator.first().selectOption({ label: matchingOption }).then(function () {
306
+ (0, logs_core_1.logAction)("Selected '".concat(matchingOption, "' from '").concat(control.controlDescription, "'"));
307
+ }, function (error) {
308
+ (0, logs_core_1.logError)("Unable to select '".concat(matchingOption, "' from '").concat(control.controlDescription, "'"));
309
+ (0, logs_core_1.logConsole)("Error: '".concat(error, "'"));
310
+ throw error;
311
+ })];
312
+ case 2:
313
+ _a.sent();
314
+ return [2 /*return*/];
315
+ }
316
+ });
317
+ });
318
+ };
292
319
  /**
293
320
  * Select dropdown element by index.
294
321
  *
@@ -255,7 +255,7 @@ var Assertion = /** @class */ (function (_super) {
255
255
  switch (_c.label) {
256
256
  case 0:
257
257
  if (!(value != null)) return [3 /*break*/, 2];
258
- verificationResult = value.includes(attributeValue) ? "PASSED" : "FAILED";
258
+ verificationResult = value.trim().includes(attributeValue) ? "PASSED" : "FAILED";
259
259
  logText = "VERIFICATION: ".concat(verificationResult, ". Atribute value of ").concat(control.controlLocator, " Expected: '").concat(attributeValue, "' contains Actual : '").concat(value, "'");
260
260
  (0, logs_core_1.logVerification)(logText);
261
261
  _a = test_1.expect;
@@ -457,7 +457,7 @@ var Assertion = /** @class */ (function (_super) {
457
457
  var verificationResult = (value === null || value === void 0 ? void 0 : value.trim()) === expectedText ? "PASSED" : "FAILED";
458
458
  var logText = "VERIFICATION: ".concat(verificationResult, " Verify textbox value of ").concat(control.controlDescription, ". Expected: '").concat(expectedText, "' Actual: '").concat(value, "'");
459
459
  (0, logs_core_1.logVerification)(logText);
460
- (0, test_1.expect)(value, logText).toEqual(expectedText);
460
+ (0, test_1.expect)(value === null || value === void 0 ? void 0 : value.trim(), logText).toEqual(expectedText);
461
461
  })];
462
462
  case 1:
463
463
  _a.sent();
@@ -474,7 +474,7 @@ var Assertion = /** @class */ (function (_super) {
474
474
  var verificationResult = (value === null || value === void 0 ? void 0 : value.trim().includes(expectedText)) ? "PASSED" : "FAILED";
475
475
  var logText = "VERIFICATION: ".concat(verificationResult, " Verify textbox value of ").concat(control.controlDescription, ". Expected: '").concat(expectedText, "' Actual: '").concat(value, "'");
476
476
  (0, logs_core_1.logVerification)(logText);
477
- (0, test_1.expect)(value, logText).toContain(expectedText);
477
+ (0, test_1.expect)(value === null || value === void 0 ? void 0 : value.trim(), logText).toContain(expectedText);
478
478
  })];
479
479
  case 1:
480
480
  _a.sent();
@@ -503,7 +503,7 @@ var Assertion = /** @class */ (function (_super) {
503
503
  var verificationResult = value.trim() === expectedText ? "PASSED" : "FAILED";
504
504
  var logText = "VERIFICATION: ".concat(verificationResult, " Verify value of ").concat(control.controlDescription, ". Expected: '").concat(expectedText, "' Actual: '").concat(value, "'");
505
505
  (0, logs_core_1.logVerification)(logText);
506
- (0, test_1.expect)(value, logText).toEqual(expectedText);
506
+ (0, test_1.expect)(value.trim(), logText).toEqual(expectedText);
507
507
  })];
508
508
  case 1:
509
509
  _a.sent();
@@ -520,7 +520,7 @@ var Assertion = /** @class */ (function (_super) {
520
520
  var verificationResult = value.trim().includes(expectedText) ? "PASSED" : "FAILED";
521
521
  var logText = "VERIFICATION: ".concat(verificationResult, " Verify value of ").concat(control.controlDescription, ". Expected: '").concat(expectedText, "' Actual: '").concat(value, "'");
522
522
  (0, logs_core_1.logVerification)(logText);
523
- (0, test_1.expect)(value, logText).toContain(expectedText);
523
+ (0, test_1.expect)(value.trim(), logText).toContain(expectedText);
524
524
  })];
525
525
  case 1:
526
526
  _a.sent();
@@ -549,7 +549,7 @@ var Assertion = /** @class */ (function (_super) {
549
549
  var verificationResult = value.trim() === expectedText ? "PASSED" : "FAILED";
550
550
  var logText = "VERIFICATION: ".concat(verificationResult, " Verify value of ").concat(control.controlDescription, ". Expected: '").concat(expectedText, "' Actual: '").concat(value, "'");
551
551
  (0, logs_core_1.logVerification)(logText);
552
- (0, test_1.expect)(value, logText).toEqual(expectedText);
552
+ (0, test_1.expect)(value.trim(), logText).toEqual(expectedText);
553
553
  })];
554
554
  case 1:
555
555
  _a.sent();
@@ -566,7 +566,7 @@ var Assertion = /** @class */ (function (_super) {
566
566
  var verificationResult = value.trim().includes(expectedText) ? "PASSED" : "FAILED";
567
567
  var logText = "VERIFICATION: ".concat(verificationResult, " Verify value of ").concat(control.controlDescription, ". Expected: '").concat(expectedText, "' Actual: '").concat(value, "'");
568
568
  (0, logs_core_1.logVerification)(logText);
569
- (0, test_1.expect)(value, logText).toContain(expectedText);
569
+ (0, test_1.expect)(value.trim(), logText).toContain(expectedText);
570
570
  })];
571
571
  case 1:
572
572
  _a.sent();
@@ -810,7 +810,7 @@ var Assertion = /** @class */ (function (_super) {
810
810
  var verificationResult = value.includes(subString) ? "PASSED" : "FAILED";
811
811
  var logText = "VERIFICATION: ".concat(verificationResult, " Verify URL contains. Expected: '").concat(subString, "' Actual: '").concat(value, "'");
812
812
  (0, logs_core_1.logVerification)(logText);
813
- (0, test_1.expect)(value, logText).toContain(subString);
813
+ (0, test_1.expect)(value.trim(), logText).toContain(subString);
814
814
  })];
815
815
  case 1:
816
816
  _a.sent();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playwright-ts-automationframework",
3
- "version": "1.1.49",
3
+ "version": "1.1.51",
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.51.0",
23
- "@types/node": "^22.13.9",
22
+ "@playwright/test": "^1.51.1",
23
+ "@types/node": "^22.13.13",
24
24
  "log4js": "^6.9.1",
25
25
  "nodemailer": "^6.10.0",
26
- "npm": "^10.9.1",
26
+ "npm": "^11.2.0",
27
27
  "path": "^0.12.7",
28
28
  "typescript": "^5.8.2"
29
29
  },