froth-webdriverio-framework 2.0.46 → 2.0.47

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.
@@ -63,6 +63,8 @@ storevalue = require(basepath + '/storeToBuffer').STOREVALUE;
63
63
  storeattributevalue = require(basepath + '/storeToBuffer').STOREATTRIBUTEVALUE;
64
64
 
65
65
  api = require(basepath + '/apicall').callapi;
66
+ validate = require(basepath + '/apicall').validate;
67
+
66
68
  selectDropDownValue = require(basepath + '/dropDown').selectDropDownValue;
67
69
 
68
70
 
@@ -90,5 +92,6 @@ module.exports = {
90
92
  storeattributevalue,
91
93
  scrollIntoView,
92
94
  api,
95
+ validate,
93
96
  selectDropDownValue
94
97
  };
@@ -36,17 +36,48 @@ async function callapi(method, api_url, queryParams, payloaddetails, authenticat
36
36
 
37
37
 
38
38
  // Function to form headers
39
- async function formheaders(authentication, headers = {}) {
40
- // Add authentication headers based on the type
41
- if (authentication && authentication.auth_type) {
42
- if (authentication.auth_type === 'Bearer') {
43
- headers.Authorization = `Bearer ${authentication.token}`;
44
- } else if (authentication.auth_type === 'Basic') {
45
- headers.Authorization = `Basic ${btoa(`${authentication.username}:${authentication.password}`)}`;
39
+ async function formheaders(authentication, headers) {
40
+ try {
41
+ // Add authentication headers based on the type
42
+ if (authentication && authentication.auth_type) {
43
+ if (authentication.auth_type?.toLowerCase() === 'bearer') {
44
+ console.log('Bearer token:', authentication.token);
45
+ headers.Authorization = `Bearer ` + authentication.token;
46
+ } else if (authentication.auth_type?.toLowerCase() === 'basic') {
47
+ headers.Authorization = `Basic ` + btoa(authentication.username + `:` + authentication.password);
48
+ }
46
49
  }
50
+ console.log('Headers:', headers);
51
+ } catch (e) {
52
+
53
+ console.error('Error in formheaders:', e);
47
54
  }
48
55
  return headers;
49
56
 
50
57
  }
58
+ async function validate(attribute, actionname, buffer, value, datatype) {
59
+ try {
60
+ if (actionname.toLowerCase() == "verify") {
61
+
62
+ if (datatype.toLowerCase() == "integer") {
63
+ if (buffer)
64
+ expect(attribute).toBe(Number(BUFFER.getItem(value)));
65
+ else
66
+ expect(attribute).toBe(Number(value));
67
+ } else if (datatype.toLowerCase() == "string") {
68
+ if (buffer)
69
+ expect(attribute).toBe(BUFFER.getItem(value));
70
+ else
71
+ expect(attribute).toBe(value);
72
+ }
73
+ } else if (actionname.toLowerCase() == "setbuffer") {
74
+ BUFFER.setItem(value, attribute);
75
+ } else if (actionname.toLowerCase() == "getbuffer") {
76
+ return BUFFER.getItem(value);
77
+ }
78
+ } catch (e) {
79
+ console.error(' Error in validate:', e);
80
+ }
81
+ }
51
82
 
52
- module.exports = { callapi };
83
+ module.exports = { callapi, validate };
@@ -3,7 +3,7 @@ const commonmobileconfig = require('./common.mobile.conf');
3
3
  process.env.BROWSERSTACK = false;
4
4
 
5
5
  const apiconfig = deepmerge.all([commonmobileconfig, {
6
-
6
+
7
7
  // ====================
8
8
  // Capabilities
9
9
  // ====================
@@ -12,8 +12,8 @@ const apiconfig = deepmerge.all([commonmobileconfig, {
12
12
  browserName: 'chrome',
13
13
  acceptInsecureCerts: true,
14
14
  'goog:chromeOptions': {
15
- args: ['--headless', '--no-sandbox', '--disable-dev-shm-usage'],
16
- },
15
+ args: ['--headless', '--no-sandbox', '--disable-dev-shm-usage'],
16
+ },
17
17
  }],
18
18
  runner: 'local',
19
19
 
@@ -21,7 +21,7 @@ const apiconfig = deepmerge.all([commonmobileconfig, {
21
21
  // browser.maximizeWindow()
22
22
  //process.env.BS_SESSION_TYPE = "app-automate";
23
23
  },
24
-
24
+
25
25
 
26
26
  }]);
27
27
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "froth-webdriverio-framework",
3
- "version": "2.0.46",
3
+ "version": "2.0.47",
4
4
  "readme": "WebdriverIO Integration",
5
5
  "description": "WebdriverIO and BrowserStack App Automate",
6
6
  "license": "MIT",