vita-playwright 1.3.24 → 1.4.0

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.
package/dist/index.d.ts CHANGED
@@ -3,10 +3,9 @@ import { ApiHelper } from "./src/helpers/api-helpers";
3
3
  import { TokenGenerators } from "./src/utils/api_axios";
4
4
  import { AzureStorageMethods } from "./src/utils/azure_storage_methods";
5
5
  import { Comparisions } from "./src/utils/comparisions";
6
- import { DocumentUtility } from "./src/utils/document_utility.js";
6
+ import { DocumentUtility } from "./src/utils/document_utility";
7
7
  import { KeyVaultMethods } from "./src/utils/keyvault_methods";
8
8
  import { TestData } from "./src/utils/test_data";
9
9
  import { XmlToJson } from "./src/utils/xmlToJson";
10
10
  import { LightHouseUtility } from "./src/utils/lighhouse_utility";
11
- import { Dateutility } from "./src/utils/date_utilitites";
12
- export { UIHelper, ApiHelper, TokenGenerators, AzureStorageMethods, Comparisions, DocumentUtility, KeyVaultMethods, TestData, XmlToJson, LightHouseUtility, Dateutility };
11
+ export { UIHelper, ApiHelper, TokenGenerators, AzureStorageMethods, Comparisions, DocumentUtility, KeyVaultMethods, TestData, XmlToJson, LightHouseUtility };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Dateutility = exports.LightHouseUtility = exports.XmlToJson = exports.TestData = exports.KeyVaultMethods = exports.DocumentUtility = exports.Comparisions = exports.AzureStorageMethods = exports.TokenGenerators = exports.ApiHelper = exports.UIHelper = void 0;
3
+ exports.LightHouseUtility = exports.XmlToJson = exports.TestData = exports.KeyVaultMethods = exports.DocumentUtility = exports.Comparisions = exports.AzureStorageMethods = exports.TokenGenerators = exports.ApiHelper = exports.UIHelper = void 0;
4
4
  const ui_helpers_1 = require("./src/helpers/ui-helpers");
5
5
  Object.defineProperty(exports, "UIHelper", { enumerable: true, get: function () { return ui_helpers_1.UIHelper; } });
6
6
  const api_helpers_1 = require("./src/helpers/api-helpers");
@@ -11,8 +11,8 @@ const azure_storage_methods_1 = require("./src/utils/azure_storage_methods");
11
11
  Object.defineProperty(exports, "AzureStorageMethods", { enumerable: true, get: function () { return azure_storage_methods_1.AzureStorageMethods; } });
12
12
  const comparisions_1 = require("./src/utils/comparisions");
13
13
  Object.defineProperty(exports, "Comparisions", { enumerable: true, get: function () { return comparisions_1.Comparisions; } });
14
- const document_utility_js_1 = require("./src/utils/document_utility.js");
15
- Object.defineProperty(exports, "DocumentUtility", { enumerable: true, get: function () { return document_utility_js_1.DocumentUtility; } });
14
+ const document_utility_1 = require("./src/utils/document_utility");
15
+ Object.defineProperty(exports, "DocumentUtility", { enumerable: true, get: function () { return document_utility_1.DocumentUtility; } });
16
16
  const keyvault_methods_1 = require("./src/utils/keyvault_methods");
17
17
  Object.defineProperty(exports, "KeyVaultMethods", { enumerable: true, get: function () { return keyvault_methods_1.KeyVaultMethods; } });
18
18
  const test_data_1 = require("./src/utils/test_data");
@@ -21,6 +21,4 @@ const xmlToJson_1 = require("./src/utils/xmlToJson");
21
21
  Object.defineProperty(exports, "XmlToJson", { enumerable: true, get: function () { return xmlToJson_1.XmlToJson; } });
22
22
  const lighhouse_utility_1 = require("./src/utils/lighhouse_utility");
23
23
  Object.defineProperty(exports, "LightHouseUtility", { enumerable: true, get: function () { return lighhouse_utility_1.LightHouseUtility; } });
24
- const date_utilitites_1 = require("./src/utils/date_utilitites");
25
- Object.defineProperty(exports, "Dateutility", { enumerable: true, get: function () { return date_utilitites_1.Dateutility; } });
26
24
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AAAA,yDAAoD;AAYhD,yFAZK,qBAAQ,OAYL;AAXZ,2DAAsD;AAYlD,0FAZK,uBAAS,OAYL;AAXb,qDAAwD;AAYpD,gGAZK,2BAAe,OAYL;AAXnB,6EAAwE;AAYpE,oGAZK,2CAAmB,OAYL;AAXvB,2DAAwD;AAYpD,6FAZK,2BAAY,OAYL;AAXhB,yEAAkE;AAY9D,gGAZK,qCAAe,OAYL;AAXnB,mEAA+D;AAY3D,gGAZK,kCAAe,OAYL;AAXnB,qDAAiD;AAY7C,yFAZK,oBAAQ,OAYL;AAXZ,qDAAkD;AAY9C,0FAZK,qBAAS,OAYL;AAXb,qEAAkE;AAY9D,kGAZK,qCAAiB,OAYL;AAXrB,iEAA0D;AAYtD,4FAZK,6BAAW,OAYL"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AAAA,yDAAoD;AAYhD,yFAZK,qBAAQ,OAYL;AAXZ,2DAAsD;AAYlD,0FAZK,uBAAS,OAYL;AAXb,qDAAwD;AAYpD,gGAZK,2BAAe,OAYL;AAXnB,6EAAwE;AAYpE,oGAZK,2CAAmB,OAYL;AAXvB,2DAAwD;AAYpD,6FAZK,2BAAY,OAYL;AAXhB,mEAA+D;AAY3D,gGAZK,kCAAe,OAYL;AAXnB,mEAA+D;AAY3D,gGAZK,kCAAe,OAYL;AAXnB,qDAAiD;AAY7C,yFAZK,oBAAQ,OAYL;AAXZ,qDAAkD;AAY9C,0FAZK,qBAAS,OAYL;AAXb,qEAAkE;AAY9D,kGAZK,qCAAiB,OAYL"}
@@ -1,25 +1,5 @@
1
1
  export declare class ApiHelper {
2
- /**
3
- * @description: Post call with endpoint, headers and data.
4
- * @param {string} apiEndPoint - API end point.
5
- * @param {string} header - header contains authentication keys, application type etc..
6
- * @param {string} payload - payload data
7
- * @returns {Promise<reponse>} - returns Promise of reponse
8
- */
9
- static post(apiEndPoint: any, header: any, payload: any): Promise<any>;
10
- /**
11
- * @description: Get call with endpoint and headers.
12
- * @param {string} apiEndPoint - API end point.
13
- * @param {string} header - header contains authentication keys, application type etc..
14
- * @returns {Promise<reponse>} - returns Promise of reponse
15
- */
16
- static get(apiEndPoint: any, header: any): Promise<any>;
17
- /**
18
- * @description: Put call with endpoint, headers and data and it will insert the data.
19
- * @param {string} apiEndPoint - API end point.
20
- * @param {string} header - headers contains authentication keys, application type etc..
21
- * @param {string} payload - payload data
22
- * @returns {Promise<reponse>} - returns Promise of reponse
23
- */
24
- static put(apiEndPoint: any, header: any, payload: any): Promise<any>;
2
+ static post(url: any, header: any, payload: any): Promise<any>;
3
+ static get(url: any, header: any): Promise<any>;
4
+ static put(url: any, header: any, payload: any): Promise<any>;
25
5
  }
@@ -12,18 +12,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.ApiHelper = void 0;
13
13
  const api_axios_1 = require("../utils/api_axios");
14
14
  class ApiHelper {
15
- /**
16
- * @description: Post call with endpoint, headers and data.
17
- * @param {string} apiEndPoint - API end point.
18
- * @param {string} header - header contains authentication keys, application type etc..
19
- * @param {string} payload - payload data
20
- * @returns {Promise<reponse>} - returns Promise of reponse
21
- */
22
- static post(apiEndPoint, header, payload) {
15
+ static post(url, header, payload) {
23
16
  return __awaiter(this, void 0, void 0, function* () {
24
17
  var config = {
25
18
  method: 'post',
26
- url: apiEndPoint,
19
+ url: url,
27
20
  headers: header,
28
21
  data: payload
29
22
  };
@@ -31,35 +24,22 @@ class ApiHelper {
31
24
  return response;
32
25
  });
33
26
  }
34
- /**
35
- * @description: Get call with endpoint and headers.
36
- * @param {string} apiEndPoint - API end point.
37
- * @param {string} header - header contains authentication keys, application type etc..
38
- * @returns {Promise<reponse>} - returns Promise of reponse
39
- */
40
- static get(apiEndPoint, header) {
27
+ static get(url, header) {
41
28
  return __awaiter(this, void 0, void 0, function* () {
42
29
  var config = {
43
30
  method: 'GET',
44
- url: apiEndPoint,
31
+ url: url,
45
32
  headers: header
46
33
  };
47
34
  var response = yield api_axios_1.TokenGenerators.request(config);
48
35
  return response;
49
36
  });
50
37
  }
51
- /**
52
- * @description: Put call with endpoint, headers and data and it will insert the data.
53
- * @param {string} apiEndPoint - API end point.
54
- * @param {string} header - headers contains authentication keys, application type etc..
55
- * @param {string} payload - payload data
56
- * @returns {Promise<reponse>} - returns Promise of reponse
57
- */
58
- static put(apiEndPoint, header, payload) {
38
+ static put(url, header, payload) {
59
39
  return __awaiter(this, void 0, void 0, function* () {
60
40
  var config = {
61
41
  method: 'put',
62
- url: apiEndPoint,
42
+ url: url,
63
43
  headers: header,
64
44
  data: payload
65
45
  };
@@ -1 +1 @@
1
- {"version":3,"file":"api-helpers.js","sourceRoot":"","sources":["../../../src/helpers/api-helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAAqD;AAErD,MAAa,SAAS;IAElB;;;;;;OAMG;IACH,MAAM,CAAO,IAAI,CAAC,WAAgB,EAAE,MAAW,EAAE,OAAY;;YACzD,IAAI,MAAM,GAAG;gBACT,MAAM,EAAE,MAAM;gBACd,GAAG,EAAE,WAAW;gBAChB,OAAO,EAAE,MAAM;gBACf,IAAI,EAAE,OAAO;aAChB,CAAC;YAEF,IAAI,QAAQ,GAAG,MAAM,2BAAe,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YACrD,OAAO,QAAQ,CAAC;QACpB,CAAC;KAAA;IACD;;;;;OAKG;IACH,MAAM,CAAO,GAAG,CAAC,WAAgB,EAAE,MAAW;;YAC1C,IAAI,MAAM,GAAG;gBACT,MAAM,EAAE,KAAK;gBACb,GAAG,EAAE,WAAW;gBAChB,OAAO,EAAE,MAAM;aAClB,CAAC;YAEF,IAAI,QAAQ,GAAG,MAAM,2BAAe,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YACrD,OAAO,QAAQ,CAAC;QACpB,CAAC;KAAA;IACD;;;;;;OAMG;IACH,MAAM,CAAO,GAAG,CAAC,WAAgB,EAAE,MAAW,EAAE,OAAY;;YACxD,IAAI,MAAM,GAAG;gBACT,MAAM,EAAE,KAAK;gBACb,GAAG,EAAE,WAAW;gBAChB,OAAO,EAAE,MAAM;gBACf,IAAI,EAAE,OAAO;aAChB,CAAC;YAEF,IAAI,QAAQ,GAAG,MAAM,2BAAe,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YACrD,OAAO,QAAQ,CAAC;QACpB,CAAC;KAAA;CAEJ;AAvDD,8BAuDC"}
1
+ {"version":3,"file":"api-helpers.js","sourceRoot":"","sources":["../../../src/helpers/api-helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAAqD;AAErD,MAAa,SAAS;IAElB,MAAM,CAAO,IAAI,CAAC,GAAQ,EAAE,MAAW,EAAE,OAAY;;YACjD,IAAI,MAAM,GAAG;gBACT,MAAM,EAAE,MAAM;gBACd,GAAG,EAAE,GAAG;gBACR,OAAO,EAAE,MAAM;gBACf,IAAI,EAAE,OAAO;aAChB,CAAC;YAEF,IAAI,QAAQ,GAAG,MAAM,2BAAe,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YACrD,OAAO,QAAQ,CAAC;QACpB,CAAC;KAAA;IAED,MAAM,CAAO,GAAG,CAAC,GAAQ,EAAE,MAAW;;YAClC,IAAI,MAAM,GAAG;gBACT,MAAM,EAAE,KAAK;gBACb,GAAG,EAAE,GAAG;gBACR,OAAO,EAAE,MAAM;aAClB,CAAC;YAEF,IAAI,QAAQ,GAAG,MAAM,2BAAe,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YACrD,OAAO,QAAQ,CAAC;QACpB,CAAC;KAAA;IAED,MAAM,CAAO,GAAG,CAAC,GAAQ,EAAE,MAAW,EAAE,OAAY;;YAChD,IAAI,MAAM,GAAG;gBACT,MAAM,EAAE,KAAK;gBACb,GAAG,EAAE,GAAG;gBACR,OAAO,EAAE,MAAM;gBACf,IAAI,EAAE,OAAO;aAChB,CAAC;YAEF,IAAI,QAAQ,GAAG,MAAM,2BAAe,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YACrD,OAAO,QAAQ,CAAC;QACpB,CAAC;KAAA;CAEJ;AArCD,8BAqCC"}
@@ -1,89 +1,23 @@
1
+ import { BrowserContext, Page } from "playwright";
1
2
  export declare class UIHelper {
2
3
  page: any;
3
- constructor(page: any);
4
- /**
5
- * @description: sets the text in inputbox.
6
- * @param {string} locator - css selector/xpath of the inputbox.
7
- * @param {string} data - Text to be set to inputbox
8
- * @returns {Promise<void>} - returns Promise of void
9
- */
4
+ browser: BrowserContext;
5
+ constructor(page: Page);
6
+ launchNonIncognito(chromePath: string): Promise<void>;
7
+ closeNonIncognito(): Promise<void>;
8
+ combineAllCookies(cookieJson: any): string;
10
9
  filltheData(locator: any, data: any): Promise<void>;
11
- /**
12
- * @description: click the given locator element.
13
- * @param {string} locator - css selector/xpath of the element.
14
- * @returns {Promise<void>} - returns Promise of void
15
- */
16
10
  clickonWebElement(locator: any): Promise<void>;
17
- /**
18
- * @description: returns inner html of locator element.
19
- * @param {string} locator - css selector/xpath of the element.
20
- * @returns {string} - returns inner html string
21
- */
22
11
  getInnerHTML(locator: any): Promise<any>;
23
- /**
24
- * @description: returns inner text of locator element.
25
- * @param {string} locator - css selector/xpath of the element.
26
- * @returns {string} - returns inner text string
27
- */
28
12
  getInnerText(locator: any): Promise<any>;
29
- /**
30
- * @description: returns text of locator element.
31
- * @param {string} locator - css selector/xpath of the element.
32
- * @returns {string} - returns text string
33
- */
34
13
  getText(locator: any): Promise<any>;
35
- /**
36
- * @description: returns given attribute value of locator element.
37
- * @param {string} locator - css selector/xpath of the element.
38
- * @param {string} attribute - html attribute to get value
39
- * @returns {string} - returns text string
40
- */
41
14
  getAttribute(locator: any, attribute: any): Promise<any>;
42
15
  evaluateJS(jsDOM: any): Promise<any>;
43
- /**
44
- * @description: verifies given locator element is displayed or not.
45
- * @param {string} locator - css selector/xpath of the element.
46
- * @returns {boolean} - returns true/false
47
- */
48
16
  isElementPresent(locator: any): Promise<any>;
49
- /**
50
- * @description: verifies given locator element is enabled or not.
51
- * @param {string} locator - css selector/xpath of the element.
52
- * @returns {boolean} - returns true/false
53
- */
54
17
  isElementEnabled(locator: any): Promise<any>;
55
- /**
56
- * @description: waits until locator element visibles.
57
- * @param {elementReference} elementSelector - element reference.
58
- * @param {number} wait time
59
- * @returns {Promise<void>} - returns Promise of void
60
- */
61
18
  waitTillElementIsVisible(elementSelector: any, waitTime?: number): Promise<void>;
62
- /**
63
- * @description: returns value of inputbox.
64
- * @param {string} locator - css selector/xpath of the element.
65
- * @returns {string} - returns text string
66
- */
67
19
  getInputBoxValue(locator: any): Promise<any>;
68
- /**
69
- * @description: wait untill download process completes and save file with custom name.
70
- * @param {string} locator - css selector/xpath of the element.
71
- * @param {string} filePath - Complete path of the excel file, example: C:/resources/****.xlsx.
72
- * @returns {Promise<void>} - returns Promise of void
73
- */
74
20
  downloadAFile(downloadButton: String, filePath: string): Promise<void>;
75
- /**
76
- * @description: wait untill upload process completes and save file with custom name.
77
- * @param {string} locator - css selector/xpath of the element.
78
- * @param {string} filePath - Complete path of the excel file, example: C:/resources/****.xlsx.
79
- * @returns {Promise<void>} - returns Promise of void
80
- */
81
21
  uploadAFile(uploadButton: String, uploadFilePath: String): Promise<void>;
82
- /**
83
- * @description: will perform click action.
84
- * @param {string} roleType - example: "alert"|"alertdialog"|"application"|"article"|"banner"|"blockquote"|"button"|"caption"|"cell"|"checkbox"|"code"|"columnheader"|"combobox"|"complementary"|"contentinfo"|"definition"|"deletion"|"dialog"|"directory"|"document"|"emphasis"|"feed"|"figure"|"form"|"generic"|"grid"|"gridcell"|"group"|"heading"|"img"|"insertion"|"link"|"list"|"listbox"|"listitem"|"log"|"main"|"marquee"|"math"|"meter"|"menu"|"menubar"|"menuitem"|"menuitemcheckbox"|"menuitemradio"|"navigation"|"none"|"note"|"option"|"paragraph"|"presentation"|"progressbar"|"radio"|"radiogroup"|"region"|"row"|"rowgroup"|"rowheader"|"scrollbar"|"search"|"searchbox"|"separator"|"slider"|"spinbutton"|"status"|"strong"|"subscript"|"superscript"|"switch"|"tab"|"table"|"tablist"|"tabpanel"|"term"|"textbox"|"time"|"timer"|"toolbar"|"tooltip"|"tree"|"treegrid"|"treeitem".
85
- * @param {string} roleName - name of the element.
86
- * @returns {Promise<locator>} - returns Promise of void
87
- */
88
- getElementRefByRole(roleType: string, roleName: string): Promise<any>;
22
+ getElementRefByRole(roleType: string, roleName: string): Promise<void>;
89
23
  }
@@ -8,29 +8,45 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
12
  exports.UIHelper = void 0;
16
13
  //import robot from "robotjs";
17
- const fs_1 = __importDefault(require("fs"));
14
+ const playwright_1 = require("playwright");
18
15
  class UIHelper {
19
16
  constructor(page) {
20
17
  this.page = page;
21
- this.page.on("console", (msg) => {
22
- console.log("this is from browser console");
23
- console.log(msg);
24
- console.log(msg.toString());
25
- fs_1.default.writeFileSync(process.cwd() + '/resources/log.txt', msg.toString());
26
- });
27
- }
28
- /**
29
- * @description: sets the text in inputbox.
30
- * @param {string} locator - css selector/xpath of the inputbox.
31
- * @param {string} data - Text to be set to inputbox
32
- * @returns {Promise<void>} - returns Promise of void
33
- */
18
+ }
19
+ /* chromePath should be something like below
20
+ <UserDirectory>/AppData/Local/Google/Chrome/User Data
21
+ */
22
+ launchNonIncognito(chromePath) {
23
+ return __awaiter(this, void 0, void 0, function* () {
24
+ // Launch non-incognito session using provided chromePath
25
+ this.browser = yield playwright_1.chromium.launchPersistentContext(chromePath, { headless: false });
26
+ this.page = yield this.browser.newPage();
27
+ this.browser.clearCookies();
28
+ });
29
+ }
30
+ // Close All the windows opened for non-incognito session
31
+ closeNonIncognito() {
32
+ return __awaiter(this, void 0, void 0, function* () {
33
+ this.browser.clearCookies();
34
+ const allPages = this.browser.pages();
35
+ allPages.forEach(element => {
36
+ element.close();
37
+ });
38
+ });
39
+ }
40
+ //Combines given list of cookies and generates a single cookie for passing in API as header
41
+ combineAllCookies(cookieJson) {
42
+ let Finalcookie = '';
43
+ for (let val of cookieJson) {
44
+ Finalcookie += val.name + "=" + val.value + ";";
45
+ }
46
+ console.log("\n----------------> Final Cookie Generated ---------------->\n");
47
+ Finalcookie = Finalcookie.toString().slice(0, -1);
48
+ return Finalcookie.toString();
49
+ }
34
50
  filltheData(locator, data) {
35
51
  return __awaiter(this, void 0, void 0, function* () {
36
52
  if (data) {
@@ -40,11 +56,6 @@ class UIHelper {
40
56
  }
41
57
  });
42
58
  }
43
- /**
44
- * @description: click the given locator element.
45
- * @param {string} locator - css selector/xpath of the element.
46
- * @returns {Promise<void>} - returns Promise of void
47
- */
48
59
  clickonWebElement(locator) {
49
60
  return __awaiter(this, void 0, void 0, function* () {
50
61
  yield this.page.locator(locator).scrollIntoViewIfNeeded();
@@ -52,11 +63,6 @@ class UIHelper {
52
63
  yield this.page.locator(locator).click();
53
64
  });
54
65
  }
55
- /**
56
- * @description: returns inner html of locator element.
57
- * @param {string} locator - css selector/xpath of the element.
58
- * @returns {string} - returns inner html string
59
- */
60
66
  getInnerHTML(locator) {
61
67
  return __awaiter(this, void 0, void 0, function* () {
62
68
  yield this.waitTillElementIsVisible(locator);
@@ -64,11 +70,6 @@ class UIHelper {
64
70
  return yield this.page.innerHTML(locator);
65
71
  });
66
72
  }
67
- /**
68
- * @description: returns inner text of locator element.
69
- * @param {string} locator - css selector/xpath of the element.
70
- * @returns {string} - returns inner text string
71
- */
72
73
  getInnerText(locator) {
73
74
  return __awaiter(this, void 0, void 0, function* () {
74
75
  yield this.waitTillElementIsVisible(locator);
@@ -76,11 +77,6 @@ class UIHelper {
76
77
  return yield this.page.locator(locator).innerText().trim();
77
78
  });
78
79
  }
79
- /**
80
- * @description: returns text of locator element.
81
- * @param {string} locator - css selector/xpath of the element.
82
- * @returns {string} - returns text string
83
- */
84
80
  getText(locator) {
85
81
  return __awaiter(this, void 0, void 0, function* () {
86
82
  yield this.waitTillElementIsVisible(locator);
@@ -88,12 +84,6 @@ class UIHelper {
88
84
  return yield this.page.locator(locator).textContent();
89
85
  });
90
86
  }
91
- /**
92
- * @description: returns given attribute value of locator element.
93
- * @param {string} locator - css selector/xpath of the element.
94
- * @param {string} attribute - html attribute to get value
95
- * @returns {string} - returns text string
96
- */
97
87
  getAttribute(locator, attribute) {
98
88
  return __awaiter(this, void 0, void 0, function* () {
99
89
  yield this.waitTillElementIsVisible(locator);
@@ -106,11 +96,6 @@ class UIHelper {
106
96
  return yield this.page.evaluate(jsDOM);
107
97
  });
108
98
  }
109
- /**
110
- * @description: verifies given locator element is displayed or not.
111
- * @param {string} locator - css selector/xpath of the element.
112
- * @returns {boolean} - returns true/false
113
- */
114
99
  isElementPresent(locator) {
115
100
  return __awaiter(this, void 0, void 0, function* () {
116
101
  // console.log(typeof locator.toString());
@@ -126,33 +111,17 @@ class UIHelper {
126
111
  console.log(type.toString());
127
112
  });
128
113
  }
129
- /**
130
- * @description: verifies given locator element is enabled or not.
131
- * @param {string} locator - css selector/xpath of the element.
132
- * @returns {boolean} - returns true/false
133
- */
134
114
  isElementEnabled(locator) {
135
115
  return __awaiter(this, void 0, void 0, function* () {
136
116
  yield this.page.locator(locator).scrollIntoViewIfNeeded();
137
117
  return yield this.page.locator(locator).isEnabled();
138
118
  });
139
119
  }
140
- /**
141
- * @description: waits until locator element visibles.
142
- * @param {elementReference} elementSelector - element reference.
143
- * @param {number} wait time
144
- * @returns {Promise<void>} - returns Promise of void
145
- */
146
120
  waitTillElementIsVisible(elementSelector, waitTime = 60000) {
147
121
  return __awaiter(this, void 0, void 0, function* () {
148
122
  yield this.page.waitForSelector(elementSelector, { waitFor: 'visible', timeout: waitTime });
149
123
  });
150
124
  }
151
- /**
152
- * @description: returns value of inputbox.
153
- * @param {string} locator - css selector/xpath of the element.
154
- * @returns {string} - returns text string
155
- */
156
125
  getInputBoxValue(locator) {
157
126
  return __awaiter(this, void 0, void 0, function* () {
158
127
  yield this.waitTillElementIsVisible(locator);
@@ -165,12 +134,6 @@ class UIHelper {
165
134
  // robot.moveMouse(400, 20);
166
135
  // robot.keyTap("enter");
167
136
  // }
168
- /**
169
- * @description: wait untill download process completes and save file with custom name.
170
- * @param {string} locator - css selector/xpath of the element.
171
- * @param {string} filePath - Complete path of the excel file, example: C:/resources/****.xlsx.
172
- * @returns {Promise<void>} - returns Promise of void
173
- */
174
137
  downloadAFile(downloadButton, filePath) {
175
138
  return __awaiter(this, void 0, void 0, function* () {
176
139
  const downloadPromise = this.page.waitForEvent('download');
@@ -181,12 +144,6 @@ class UIHelper {
181
144
  yield download.saveAs(filePath);
182
145
  });
183
146
  }
184
- /**
185
- * @description: wait untill upload process completes and save file with custom name.
186
- * @param {string} locator - css selector/xpath of the element.
187
- * @param {string} filePath - Complete path of the excel file, example: C:/resources/****.xlsx.
188
- * @returns {Promise<void>} - returns Promise of void
189
- */
190
147
  uploadAFile(uploadButton, uploadFilePath) {
191
148
  return __awaiter(this, void 0, void 0, function* () {
192
149
  const fileChooserPromise = this.page.waitForEvent('filechooser');
@@ -195,15 +152,9 @@ class UIHelper {
195
152
  yield fileChooser.setFiles(uploadFilePath);
196
153
  });
197
154
  }
198
- /**
199
- * @description: will perform click action.
200
- * @param {string} roleType - example: "alert"|"alertdialog"|"application"|"article"|"banner"|"blockquote"|"button"|"caption"|"cell"|"checkbox"|"code"|"columnheader"|"combobox"|"complementary"|"contentinfo"|"definition"|"deletion"|"dialog"|"directory"|"document"|"emphasis"|"feed"|"figure"|"form"|"generic"|"grid"|"gridcell"|"group"|"heading"|"img"|"insertion"|"link"|"list"|"listbox"|"listitem"|"log"|"main"|"marquee"|"math"|"meter"|"menu"|"menubar"|"menuitem"|"menuitemcheckbox"|"menuitemradio"|"navigation"|"none"|"note"|"option"|"paragraph"|"presentation"|"progressbar"|"radio"|"radiogroup"|"region"|"row"|"rowgroup"|"rowheader"|"scrollbar"|"search"|"searchbox"|"separator"|"slider"|"spinbutton"|"status"|"strong"|"subscript"|"superscript"|"switch"|"tab"|"table"|"tablist"|"tabpanel"|"term"|"textbox"|"time"|"timer"|"toolbar"|"tooltip"|"tree"|"treegrid"|"treeitem".
201
- * @param {string} roleName - name of the element.
202
- * @returns {Promise<locator>} - returns Promise of void
203
- */
204
155
  getElementRefByRole(roleType, roleName) {
205
156
  return __awaiter(this, void 0, void 0, function* () {
206
- return this.page.getByRole(roleType, { name: roleName });
157
+ yield this.page.getByRole(roleType, { name: roleName }).click();
207
158
  });
208
159
  }
209
160
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ui-helpers.js","sourceRoot":"","sources":["../../../src/helpers/ui-helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,8BAA8B;AAC9B,4CAAoB;AAEpB,MAAa,QAAQ;IAGjB,YAAY,IAAS;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,GAAQ,EAAC,EAAE;YAChC,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;YAC5C,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACjB,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;YAC5B,YAAE,CAAC,aAAa,CAAC,OAAO,CAAC,GAAG,EAAE,GAAC,oBAAoB,EAAE,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;QACzE,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;;;;OAKG;IACG,WAAW,CAAC,OAAY,EAAE,IAAS;;YAErC,IAAI,IAAI,EAAE;gBACN,MAAM,IAAI,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC;gBAC7C,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,sBAAsB,EAAE,CAAC;gBAC1D,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aAE/C;QAEL,CAAC;KAAA;IACD;;;;OAIG;IACG,iBAAiB,CAAC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AC,CAAC;QACpC,CAAC;KAAA;IAEK,WAAW,CAAC,YAAoB,EAAE,cAAsB;;YAC1D,MAAM,kBAAkB,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;YACjE,MAAM,IAAI,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC;YAC3C,MAAM,WAAW,GAAG,MAAM,kBAAkB,CAAC;YAC7C,MAAM,WAAW,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;QAC/C,CAAC;KAAA;IAEK,mBAAmB,CAAC,QAAgB,EAAE,QAAgB;;YACxD,MAAM,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;QACpE,CAAC;KAAA;CAEJ;AAjJD,4BAiJC"}
@@ -1,47 +1,9 @@
1
1
  import moment, { DurationInputArg1, DurationInputArg2 } from 'moment';
2
2
  export declare class Dateutility {
3
- /**
4
- * @description: returns date in required format.
5
- * @param {string} date - date in the form of string, example: 01/01/2023.
6
- * @param {string} format - format od date, example: DD/MM/YYYY.
7
- * @returns {string} - returns date in given format.
8
- */
9
3
  static getDateInCustomFormat(date: any, format: string): string;
10
- /**
11
- * @description: adds no of days|months|years|hours|minutes|seconds from given date.
12
- * @param {string} date - date in the form of string, example: 01/01/2023.
13
- * @param {string} format - format od date, example: DD/MM/YYYY.
14
- * @param {string} durationType - example days, months, years, hours, minutes, seconds.
15
- * @param {string} duration - no of days|months|years|hours|minutes|seconds.
16
- * @returns {string} - returns date in given format.
17
- */
18
4
  static getFutureDateInCustomFormat(date: any, format: string, durationType: DurationInputArg2, duration: DurationInputArg1): string;
19
- /**
20
- * @description: subtracts no of days|months|years|hours|minutes|seconds from given date.
21
- * @param {string} date - date in the form of string, example: 01/01/2023.
22
- * @param {string} format - format od date, example: DD/MM/YYYY.
23
- * @param {string} durationType - example days, months, years, hours, minutes, seconds.
24
- * @param {string} duration - no of days|months|years|hours|minutes|seconds.
25
- * @returns {string} - returns date in given format.
26
- */
27
5
  static getPastDateInCustomFormat(date: any, format: string, durationType: DurationInputArg2, duration: DurationInputArg1): string;
28
- /**
29
- * @description: return min date from given dates.
30
- * @param {Array<object<date,format>>} datesArrayObject - array of dates in form of object example: [{date:10/01/2023, format: "DD/MM/YYYY"}, {date:20/01/2023, format: "DD/MM/YYYY"}].
31
- * @returns {string} - return min date amount given dates example: 10/01/2023.
32
- */
33
6
  static getMinDateFromMultipleDates(datesArrayObject: any): moment.Moment;
34
- /**
35
- * @description: return max date from given dates.
36
- * @param {Array<object<date,format>>} datesArrayObject - array of dates in form of object example: [{date:10/01/2023, format: "DD/MM/YYYY"}, {date:20/01/2023, format: "DD/MM/YYYY"}].
37
- * @returns {string} - return max date amount given dates example: 20/01/2023.
38
- */
39
7
  static getMaxDateFromMultipleDates(date1: any, date2: any): moment.Moment;
40
- /**
41
- * @description: returns no of days "lessthan|Greaterthan" from given date.
42
- * @param {string} fromDate - date in the form of string, example: 01/01/2023.
43
- * @param {string} format - format od date, example: DD/MM/YYYY.
44
- * @returns {string} - returns string which is no of days "lessthan|Greaterthan" from given date.
45
- */
46
8
  static calculateRelativeDate(fromDate: any, format: string): string;
47
9
  }
@@ -7,59 +7,21 @@ exports.Dateutility = void 0;
7
7
  const lodash_1 = require("lodash");
8
8
  const moment_1 = __importDefault(require("moment"));
9
9
  class Dateutility {
10
- /**
11
- * @description: returns date in required format.
12
- * @param {string} date - date in the form of string, example: 01/01/2023.
13
- * @param {string} format - format od date, example: DD/MM/YYYY.
14
- * @returns {string} - returns date in given format.
15
- */
16
10
  static getDateInCustomFormat(date, format) {
17
11
  return (0, moment_1.default)(date).format(format);
18
12
  }
19
- /**
20
- * @description: adds no of days|months|years|hours|minutes|seconds from given date.
21
- * @param {string} date - date in the form of string, example: 01/01/2023.
22
- * @param {string} format - format od date, example: DD/MM/YYYY.
23
- * @param {string} durationType - example days, months, years, hours, minutes, seconds.
24
- * @param {string} duration - no of days|months|years|hours|minutes|seconds.
25
- * @returns {string} - returns date in given format.
26
- */
27
13
  static getFutureDateInCustomFormat(date, format, durationType, duration) {
28
14
  return (0, moment_1.default)(date).add(duration, durationType).format(format);
29
15
  }
30
- /**
31
- * @description: subtracts no of days|months|years|hours|minutes|seconds from given date.
32
- * @param {string} date - date in the form of string, example: 01/01/2023.
33
- * @param {string} format - format od date, example: DD/MM/YYYY.
34
- * @param {string} durationType - example days, months, years, hours, minutes, seconds.
35
- * @param {string} duration - no of days|months|years|hours|minutes|seconds.
36
- * @returns {string} - returns date in given format.
37
- */
38
16
  static getPastDateInCustomFormat(date, format, durationType, duration) {
39
17
  return (0, moment_1.default)(date).subtract(duration, durationType).format(format);
40
18
  }
41
- /**
42
- * @description: return min date from given dates.
43
- * @param {Array<object<date,format>>} datesArrayObject - array of dates in form of object example: [{date:10/01/2023, format: "DD/MM/YYYY"}, {date:20/01/2023, format: "DD/MM/YYYY"}].
44
- * @returns {string} - return min date amount given dates example: 10/01/2023.
45
- */
46
19
  static getMinDateFromMultipleDates(datesArrayObject) {
47
20
  return moment_1.default.min((0, lodash_1.map)(datesArrayObject, (obj) => (0, moment_1.default)(obj.date, obj.format)));
48
21
  }
49
- /**
50
- * @description: return max date from given dates.
51
- * @param {Array<object<date,format>>} datesArrayObject - array of dates in form of object example: [{date:10/01/2023, format: "DD/MM/YYYY"}, {date:20/01/2023, format: "DD/MM/YYYY"}].
52
- * @returns {string} - return max date amount given dates example: 20/01/2023.
53
- */
54
22
  static getMaxDateFromMultipleDates(date1, date2) {
55
23
  return moment_1.default.max(date1, date2);
56
24
  }
57
- /**
58
- * @description: returns no of days "lessthan|Greaterthan" from given date.
59
- * @param {string} fromDate - date in the form of string, example: 01/01/2023.
60
- * @param {string} format - format od date, example: DD/MM/YYYY.
61
- * @returns {string} - returns string which is no of days "lessthan|Greaterthan" from given date.
62
- */
63
25
  static calculateRelativeDate(fromDate, format) {
64
26
  return (0, moment_1.default)(fromDate, format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AE,MAAc;QACtD,OAAO,IAAA,gBAAM,EAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,OAAO,EAAE,CAAC;IAC9C,CAAC;CACJ;AAzBD,kCAyBC"}
@@ -1,40 +1,9 @@
1
1
  import XLSX from 'xlsx';
2
2
  export declare class DocumentUtility {
3
- /**
4
- * @description: it will take excel file path as input and will return excel Workbook object.
5
- * @param {string} filePath - Complete path of the excel file, example: C:/resources/****.xlsx.
6
- * @returns {Promise<Workbook>} - returns Promise, if we resolves and will get Workbook object
7
- */
8
3
  static readData(filePath: string): Promise<XLSX.WorkBook>;
9
- /**
10
- * @description: it will take excel file path and sheetname as input and will return array of objects.
11
- * @param {string} filePath - Complete path of the excel file, example: C:/resources/****.xlsx.
12
- * @param {string} sheetname - name of the sheet name and it is optional. For CSV files no need pass this parameter.
13
- * @returns {Promise<Array<Object>>} - returns Promise, if we resolves and will get Array of Json objects.
14
- * [{startDate: '****',endDate: '****', employeeId: '****',CompanyToken: '******'}]
15
- */
16
4
  static readDataFromExcelorCSV(filePath: string, sheetname: string): Promise<unknown[]>;
17
- /**
18
- * @description: it will filter excel data and will return filtered array of objects.
19
- * @param {string} filePath - Complete path of the excel file, example: C:/resources/****.xlsx.
20
- * @param {string} sheetname - name of the sheet name and it is optional. For CSV files no need pass this parameter.
21
- * @param {Object} filterObject - {column Name:Row value} key:value pair. example: {startDate: '****'}
22
- * @returns {Promise<Array<Object>>} - returns Promise, if we resolves and will get filtered Array of Json objects.
23
- * [{startDate: '****',endDate: '****', employeeId: '****',CompanyToken: '******'}]
24
- */
25
5
  static filterData(filePath: string, sheetName: string, filterObject: object): Promise<unknown[]>;
26
- /**
27
- * @description: it will modify/update excel file based on input data.
28
- * @param {string} filePath - Complete path of the excel file, example: C:/resources/****.xlsx.
29
- * @param {string} sheetname - name of the sheet name and it is optional. For CSV files no need pass this parameter.
30
- * @param {Array<Object>} exportData - excel modify data. example: [{startDate: '****',endDate: '****', employeeId: '****',CompanyToken: '******'}]
31
- * @returns {Promise<void>} - returns void promise.
32
- */
33
6
  static updateExcelData(filePath: string, sheetName: string, exportData: Array<object>): Promise<void>;
34
- /**
35
- * @description: it will delete all files under given directory.
36
- * @param {string} dirPath - Complete path of the directory which contain file, example: C:/resources.
37
- * @returns {Promise<void>} - returns void promise.
38
- */
39
7
  static deleteAllFilesUnderDir(dirPath: string): Promise<void>;
8
+ static readPdfFile(filePath: string): Promise<unknown>;
40
9
  }