playwright-ts-automationframework 1.1.70 → 1.1.71

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.
@@ -24,7 +24,7 @@ class Actions extends basePage_core_1.BasePage {
24
24
  */
25
25
  async click(control, isforceful = false) {
26
26
  await control.controlLocator.first().click({ force: isforceful }).then(() => {
27
- (0, logs_core_1.logAction)("Clicked on '" + control.controlDescription + "'");
27
+ (0, logs_core_1.logAction)(`Clicked on '${control.controlDescription}'`);
28
28
  }, (error) => {
29
29
  (0, logs_core_1.logError)(`❌ Unable to click on '${control.controlDescription}' due to reason: '${error}'`);
30
30
  throw error;
@@ -43,9 +43,10 @@ class Actions extends basePage_core_1.BasePage {
43
43
  */
44
44
  async mouseHover(control) {
45
45
  await control.controlLocator.first().hover().then(() => {
46
- (0, logs_core_1.logAction)("Mouse hover to '" + control.controlDescription + "'");
46
+ (0, logs_core_1.logAction)(`Mouse hover on '${control.controlDescription}'`);
47
47
  }, (error) => {
48
48
  (0, logs_core_1.logError)(`❌ Unable to mouse hover on '${control.controlDescription}' due to reason: '${error}'`);
49
+ throw error;
49
50
  });
50
51
  }
51
52
  /**
@@ -140,7 +141,7 @@ class Actions extends basePage_core_1.BasePage {
140
141
  */
141
142
  async selectFromDropdownByValue(control, optionTobeSelcted) {
142
143
  await control.controlLocator.first().selectOption({ value: optionTobeSelcted }).then(() => {
143
- (0, logs_core_1.logAction)("Selected '" + optionTobeSelcted + "' from '" + control.controlDescription + "'");
144
+ (0, logs_core_1.logAction)(`Selected '${optionTobeSelcted}' from '${control.controlDescription}'`);
144
145
  }, (error) => {
145
146
  (0, logs_core_1.logError)(`❌ Unable to select '${optionTobeSelcted}' from '${control.controlDescription}' due to reason: '${error}'`);
146
147
  throw error;
@@ -200,8 +201,8 @@ class Actions extends basePage_core_1.BasePage {
200
201
  * selectFromDropdownByIndex(cityDrpdwn, 1);
201
202
  */
202
203
  async selectFromDropdownByIndex(control, index) {
203
- await control.controlLocator.first().selectOption({ index: index }).then(() => {
204
- (0, logs_core_1.logAction)("Selected '" + index + "' option from '" + control.controlDescription + "'");
204
+ await control.controlLocator.first().selectOption({ index }).then(() => {
205
+ (0, logs_core_1.logAction)(`Selected '${index}' option from '${control.controlDescription}'`);
205
206
  }, (error) => {
206
207
  (0, logs_core_1.logError)(`❌ Unable to select '${index}' option from '${control.controlDescription}' due to reason: '${error}'`);
207
208
  throw error;
@@ -224,11 +225,11 @@ class Actions extends basePage_core_1.BasePage {
224
225
  try {
225
226
  if (expectedCheckboxValue) {
226
227
  await control.controlLocator.first().check();
227
- (0, logs_core_1.logAction)("Set checkbox value of '" + control.controlDescription + "' as checked");
228
+ (0, logs_core_1.logAction)(`Set checkbox value of '${control.controlDescription}' as checked`);
228
229
  }
229
230
  else {
230
231
  await control.controlLocator.first().uncheck();
231
- (0, logs_core_1.logAction)("Set checkbox value of '" + control.controlDescription + "' as unchecked");
232
+ (0, logs_core_1.logAction)(`Set checkbox value of '${control.controlDescription}' as unchecked`);
232
233
  }
233
234
  }
234
235
  catch (error) {
@@ -252,9 +253,9 @@ class Actions extends basePage_core_1.BasePage {
252
253
  try {
253
254
  const isChecked = await control.controlLocator.first().isChecked();
254
255
  if (isChecked)
255
- (0, logs_core_1.logConsole)(`${control.controlDescription} is selected`);
256
+ (0, logs_core_1.logConsole)(`'${control.controlDescription}' is selected`);
256
257
  else
257
- (0, logs_core_1.logConsole)(`${control.controlDescription} is NOT selected`);
258
+ (0, logs_core_1.logConsole)(`'${control.controlDescription}' is NOT selected`);
258
259
  return isChecked;
259
260
  }
260
261
  catch (error) {
@@ -278,9 +279,9 @@ class Actions extends basePage_core_1.BasePage {
278
279
  try {
279
280
  const value = await control.controlLocator.first().isEnabled();
280
281
  if (value)
281
- (0, logs_core_1.logConsole)(`${control.controlDescription} is enabled`);
282
+ (0, logs_core_1.logConsole)(`'${control.controlDescription}' is enabled`);
282
283
  else
283
- (0, logs_core_1.logConsole)(`${control.controlDescription} is NOT enabled`);
284
+ (0, logs_core_1.logConsole)(`'${control.controlDescription}' is NOT enabled`);
284
285
  return value;
285
286
  }
286
287
  catch (error) {
@@ -304,9 +305,9 @@ class Actions extends basePage_core_1.BasePage {
304
305
  try {
305
306
  const isVisible = await control.controlLocator.first().isVisible();
306
307
  if (isVisible)
307
- (0, logs_core_1.logConsole)(`${control.controlDescription} is displayed`);
308
+ (0, logs_core_1.logConsole)(`'${control.controlDescription}' is displayed`);
308
309
  else
309
- (0, logs_core_1.logConsole)(`${control.controlDescription} is NOT displayed`);
310
+ (0, logs_core_1.logConsole)(`'${control.controlDescription}' is NOT displayed`);
310
311
  return isVisible;
311
312
  }
312
313
  catch (error) {
@@ -394,7 +395,7 @@ class Actions extends basePage_core_1.BasePage {
394
395
  async getSelectedItemFromDropdown(control) {
395
396
  try {
396
397
  const value = await control.controlLocator.first().inputValue();
397
- (0, logs_core_1.logConsole)(`Value read from '${control.controlDescription}' is: '${value}'`);
398
+ (0, logs_core_1.logConsole)(`Value read from dropdown '${control.controlDescription}' is: '${value}'`);
398
399
  return value;
399
400
  }
400
401
  catch (error) {
@@ -502,7 +503,7 @@ class Actions extends basePage_core_1.BasePage {
502
503
  this.page.on('dialog', async (dialog) => {
503
504
  try {
504
505
  const message = dialog.message();
505
- (0, logs_core_1.logAction)(`Alert is Displayed with text: ${message}`);
506
+ (0, logs_core_1.logAction)(`Alert is displayed with text: '${message}'`);
506
507
  return message;
507
508
  }
508
509
  catch (error) {
@@ -579,7 +580,7 @@ class Actions extends basePage_core_1.BasePage {
579
580
  async getTitle() {
580
581
  try {
581
582
  const value = await this.page.title();
582
- (0, logs_core_1.logAction)("Title of the webpage is: '" + value + "'");
583
+ (0, logs_core_1.logAction)(`Title of the webpage is: '${value}'`);
583
584
  return value;
584
585
  }
585
586
  catch (error) {
@@ -166,7 +166,7 @@ class Assertion extends actions_core_1.Actions {
166
166
  try {
167
167
  const value = await this.getAttributeValue(control, attributeName);
168
168
  const verificationResult = value?.trim() === expectedAttributeValue ? "✅ PASSED" : "❌ FAILED";
169
- const logText = `VERIFICATION: '${verificationResult}'. Attribute value of ${control.controlDescription} Expected: '${expectedAttributeValue}' Actual : '${value}'`;
169
+ const logText = `VERIFICATION: '${verificationResult}'. Attribute value of '${control.controlDescription}' Expected: '${expectedAttributeValue}' Actual : '${value}'`;
170
170
  (0, logs_core_1.logVerification)(logText);
171
171
  test_1.expect.soft(value, logText).toBe(expectedAttributeValue);
172
172
  }
@@ -194,7 +194,7 @@ class Assertion extends actions_core_1.Actions {
194
194
  const value = await this.getAttributeValue(control, attributeName);
195
195
  if (value != null) {
196
196
  const verificationResult = value.trim().includes(attributeValue) ? "✅ PASSED" : "❌ FAILED";
197
- const logText = `VERIFICATION: '${verificationResult}'. Attribute value of ${control.controlDescription} Expected: '${attributeValue}' contained in Actual: '${value}'`;
197
+ const logText = `VERIFICATION: '${verificationResult}'. Attribute value of '${control.controlDescription}' Expected: '${attributeValue}' contained in Actual: '${value}'`;
198
198
  (0, logs_core_1.logVerification)(logText);
199
199
  test_1.expect.soft(value, logText).toContain(attributeValue);
200
200
  }
@@ -299,7 +299,7 @@ class Assertion extends actions_core_1.Actions {
299
299
  try {
300
300
  const value = await this.getText(control);
301
301
  const verificationResult = value?.trim() === expectedText.trim() ? "✅ PASSED" : "❌ FAILED";
302
- const logText = `VERIFICATION: '${verificationResult}' Verify text of ${control.controlDescription}. Expected: '${expectedText}' Actual: '${value}'`;
302
+ const logText = `VERIFICATION: '${verificationResult}' Verify text of '${control.controlDescription}'. Expected: '${expectedText}' Actual: '${value}'`;
303
303
  (0, logs_core_1.logVerification)(logText);
304
304
  test_1.expect.soft(value?.trim(), logText).toBe(expectedText.trim());
305
305
  }
@@ -324,7 +324,7 @@ class Assertion extends actions_core_1.Actions {
324
324
  try {
325
325
  const value = await this.getText(control);
326
326
  const verificationResult = value?.trim().includes(expectedText.trim()) ? "✅ PASSED" : "❌ FAILED";
327
- const logText = `VERIFICATION: '${verificationResult}'. Verify text of ${control.controlDescription} .Expected: '${expectedText.trim()}' is present in Actual: '${value?.trim()}'`;
327
+ const logText = `VERIFICATION: '${verificationResult}'. Verify text of '${control.controlDescription}'. Expected: '${expectedText.trim()}' is present in Actual: '${value?.trim()}'`;
328
328
  (0, logs_core_1.logVerification)(logText);
329
329
  test_1.expect.soft(value?.trim(), logText).toContain(expectedText.trim());
330
330
  }
@@ -349,7 +349,7 @@ class Assertion extends actions_core_1.Actions {
349
349
  try {
350
350
  const value = await this.getText(control);
351
351
  const verificationResult = !value?.trim().includes(expectedText.trim()) ? "✅ PASSED" : "❌ FAILED";
352
- const logText = `VERIFICATION: '${verificationResult}'. Verify text of ${control.controlDescription} Expected: '${expectedText}' does not contain Actual: '${value}'`;
352
+ const logText = `VERIFICATION: '${verificationResult}'. Verify text of '${control.controlDescription}' Expected: '${expectedText}' does not contain Actual: '${value}'`;
353
353
  (0, logs_core_1.logVerification)(logText);
354
354
  test_1.expect.soft(false, logText).toBe(value?.trim().includes(expectedText.trim()));
355
355
  }
@@ -374,7 +374,7 @@ class Assertion extends actions_core_1.Actions {
374
374
  try {
375
375
  const value = await control.controlLocator.first().getAttribute("value");
376
376
  const verificationResult = value?.trim() === expectedText ? "✅ PASSED" : "❌ FAILED";
377
- const logText = `VERIFICATION: '${verificationResult}' Verify textbox value of ${control.controlDescription}. Expected: '${expectedText}' Actual: '${value}'`;
377
+ const logText = `VERIFICATION: '${verificationResult}' Verify textbox value of '${control.controlDescription}'. Expected: '${expectedText}' Actual: '${value}'`;
378
378
  (0, logs_core_1.logVerification)(logText);
379
379
  test_1.expect.soft(value?.trim(), logText).toEqual(expectedText);
380
380
  }
@@ -387,7 +387,7 @@ class Assertion extends actions_core_1.Actions {
387
387
  try {
388
388
  const value = await control.controlLocator.first().getAttribute("value");
389
389
  const verificationResult = value?.trim().includes(expectedText) ? "✅ PASSED" : "❌ FAILED";
390
- const logText = `VERIFICATION: '${verificationResult}' Verify textbox value of ${control.controlDescription}. Expected: '${expectedText}' Actual: '${value}'`;
390
+ const logText = `VERIFICATION: '${verificationResult}' Verify textbox value of '${control.controlDescription}'. Expected: '${expectedText}' Actual: '${value}'`;
391
391
  (0, logs_core_1.logVerification)(logText);
392
392
  test_1.expect.soft(value?.trim(), logText).toContain(expectedText);
393
393
  }
@@ -412,7 +412,7 @@ class Assertion extends actions_core_1.Actions {
412
412
  try {
413
413
  const value = await control.controlLocator.first().innerText();
414
414
  const verificationResult = value.trim() === expectedText ? "✅ PASSED" : "❌ FAILED";
415
- const logText = `VERIFICATION: '${verificationResult}' Verify value of ${control.controlDescription}. Expected: '${expectedText}' Actual: '${value}'`;
415
+ const logText = `VERIFICATION: '${verificationResult}' Verify value of '${control.controlDescription}'. Expected: '${expectedText}' Actual: '${value}'`;
416
416
  (0, logs_core_1.logVerification)(logText);
417
417
  test_1.expect.soft(value.trim(), logText).toEqual(expectedText);
418
418
  }
@@ -425,7 +425,7 @@ class Assertion extends actions_core_1.Actions {
425
425
  try {
426
426
  const value = await control.controlLocator.first().innerText();
427
427
  const verificationResult = value.trim().includes(expectedText) ? "✅ PASSED" : "❌ FAILED";
428
- const logText = `VERIFICATION: '${verificationResult}' Verify value of ${control.controlDescription}. Expected: '${expectedText}' Actual: '${value}'`;
428
+ const logText = `VERIFICATION: '${verificationResult}' Verify value of '${control.controlDescription}'. Expected: '${expectedText}' Actual: '${value}'`;
429
429
  (0, logs_core_1.logVerification)(logText);
430
430
  test_1.expect.soft(value.trim(), logText).toContain(expectedText);
431
431
  }
@@ -450,7 +450,7 @@ class Assertion extends actions_core_1.Actions {
450
450
  try {
451
451
  const value = await control.controlLocator.first().inputValue();
452
452
  const verificationResult = value.trim() === expectedText ? "✅ PASSED" : "❌ FAILED";
453
- const logText = `VERIFICATION: '${verificationResult}' Verify value of ${control.controlDescription}. Expected: '${expectedText}' Actual: '${value}'`;
453
+ const logText = `VERIFICATION: '${verificationResult}' Verify value of '${control.controlDescription}'. Expected: '${expectedText}' Actual: '${value}'`;
454
454
  (0, logs_core_1.logVerification)(logText);
455
455
  test_1.expect.soft(value.trim(), logText).toEqual(expectedText);
456
456
  }
@@ -463,7 +463,7 @@ class Assertion extends actions_core_1.Actions {
463
463
  try {
464
464
  const value = await control.controlLocator.first().inputValue();
465
465
  const verificationResult = value.trim().includes(expectedText) ? "✅ PASSED" : "❌ FAILED";
466
- const logText = `VERIFICATION: '${verificationResult}' Verify value of ${control.controlDescription}. Expected: '${expectedText}' Actual: '${value}'`;
466
+ const logText = `VERIFICATION: '${verificationResult}' Verify value of '${control.controlDescription}'. Expected: '${expectedText}' Actual: '${value}'`;
467
467
  (0, logs_core_1.logVerification)(logText);
468
468
  test_1.expect.soft(value.trim(), logText).toContain(expectedText);
469
469
  }
@@ -488,7 +488,7 @@ class Assertion extends actions_core_1.Actions {
488
488
  try {
489
489
  const isChecked = await this.isSelected(control);
490
490
  const verificationResult = value === isChecked ? "✅ PASSED" : "❌ FAILED";
491
- const logText = `VERIFICATION: '${verificationResult}' Verify checkbox value of ${control.controlDescription}. Expected: '${value}' Actual: '${isChecked}'`;
491
+ const logText = `VERIFICATION: '${verificationResult}' Verify checkbox value of '${control.controlDescription}'. Expected: '${value}' Actual: '${isChecked}'`;
492
492
  (0, logs_core_1.logVerification)(logText);
493
493
  test_1.expect.soft(isChecked, logText).toBe(value);
494
494
  }
@@ -514,7 +514,7 @@ class Assertion extends actions_core_1.Actions {
514
514
  const parent = control.controlLocator.first();
515
515
  const tagName = await parent.evaluate((e) => e.tagName);
516
516
  const verificationResult = tagName?.toLowerCase() == expectedTagName.toLowerCase() ? "✅ PASSED" : "❌ FAILED";
517
- const logText = `VERIFICATION: '${verificationResult}' Verify Tagname of ${control.controlDescription}. Expected: '${expectedTagName.toLowerCase()}' Actual: '${tagName?.toLowerCase()}'`;
517
+ const logText = `VERIFICATION: '${verificationResult}' Verify Tagname of '${control.controlDescription}'. Expected: '${expectedTagName.toLowerCase()}' Actual: '${tagName?.toLowerCase()}'`;
518
518
  (0, logs_core_1.logVerification)(logText);
519
519
  test_1.expect.soft(tagName?.toLowerCase(), logText).toBe(expectedTagName.toLowerCase());
520
520
  }
@@ -604,7 +604,7 @@ class Assertion extends actions_core_1.Actions {
604
604
  await list[i].waitFor({ state: "visible" });
605
605
  const value = await list[i].innerText();
606
606
  const verificationResult = value.trim().includes(listOfValueToVerify[i]) ? "✅ PASSED" : "❌ FAILED";
607
- const logText = `VERIFICATION: '${verificationResult}'. Expected: '${listOfValueToVerify[i]}' Actual: '${value}'`;
607
+ const logText = `VERIFICATION: '${verificationResult}'. '${control.controlDescription}' Expected: '${listOfValueToVerify[i]}' Actual: '${value}'`;
608
608
  (0, logs_core_1.logVerification)(logText);
609
609
  test_1.expect.soft(value.trim(), logText).toContain(listOfValueToVerify[i]);
610
610
  }
@@ -675,7 +675,7 @@ class Assertion extends actions_core_1.Actions {
675
675
  try {
676
676
  const value = await control.controlLocator.count();
677
677
  const verificationResult = value == expectedCount ? "✅ PASSED" : "❌ FAILED";
678
- const logText = `VERIFICATION: '${verificationResult}' Verify count of elements of ${control.controlDescription}. Expected: '${expectedCount}' Actual: '${value}'`;
678
+ const logText = `VERIFICATION: '${verificationResult}' Verify count of elements of '${control.controlDescription}'. Expected: '${expectedCount}' Actual: '${value}'`;
679
679
  (0, logs_core_1.logVerification)(logText);
680
680
  test_1.expect.soft(value, logText).toBe(expectedCount);
681
681
  }
@@ -688,7 +688,7 @@ class Assertion extends actions_core_1.Actions {
688
688
  try {
689
689
  const value = await control.controlLocator.count();
690
690
  const verificationResult = value >= expectedCount ? "✅ PASSED" : "❌ FAILED";
691
- const logText = `VERIFICATION: '${verificationResult}' Verify count of elements of ${control.controlDescription}. Expected: '${expectedCount}' Actual: '${value}'`;
691
+ const logText = `VERIFICATION: '${verificationResult}' Verify count of elements of '${control.controlDescription}'. Expected: '${expectedCount}' Actual: '${value}'`;
692
692
  (0, logs_core_1.logVerification)(logText);
693
693
  test_1.expect.soft(value, logText).toBeGreaterThanOrEqual(expectedCount);
694
694
  }
@@ -701,7 +701,7 @@ class Assertion extends actions_core_1.Actions {
701
701
  try {
702
702
  const value = await control.controlLocator.count();
703
703
  const verificationResult = value <= expectedCount ? "✅ PASSED" : "❌ FAILED";
704
- const logText = `VERIFICATION: '${verificationResult}' Verify count of elements of ${control.controlDescription}. Expected: '${expectedCount}' Actual: '${value}'`;
704
+ const logText = `VERIFICATION: '${verificationResult}' Verify count of elements of '${control.controlDescription}'. Expected: '${expectedCount}' Actual: '${value}'`;
705
705
  (0, logs_core_1.logVerification)(logText);
706
706
  test_1.expect.soft(value, logText).toBeLessThanOrEqual(expectedCount);
707
707
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playwright-ts-automationframework",
3
- "version": "1.1.70",
3
+ "version": "1.1.71",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",