froth-webdriverio-framework 4.0.61 → 4.0.63

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.
@@ -45,13 +45,13 @@ let selectDropDownValue = null;
45
45
  let acceptAlert = null;
46
46
  let dismissAlert = null;
47
47
 
48
- let generateJWT=null;
48
+ let generateJWT = null;
49
49
 
50
50
  let switchToWindowByTitle = null;
51
51
  let switchToWindowByIndex = null;
52
52
 
53
53
 
54
- if (process.env.LOCATION ==null || process.env.LOCATION == 'local') {
54
+ if (process.env.LOCATION == null || process.env.LOCATION == 'local') {
55
55
  basepath = ".";
56
56
  } else {
57
57
  basepath = "froth-webdriverio-framework/froth_common_actions";
@@ -72,12 +72,12 @@ swipeDown = require(basepath + '/swipe').swipedown;
72
72
  swipeLeft = require(basepath + '/swipe').swipeleft;
73
73
  swipeRight = require(basepath + '/swipe').swiperight;
74
74
  swipeUp = require(basepath + '/swipe').swipeup;
75
- swipetoFit= require(basepath + '/swipe').swipetofit;
75
+ swipetoFit = require(basepath + '/swipe').swipetofit;
76
76
  swipeWithCoordinates = require(basepath + '/swipe').swipewithcoordinates;
77
77
 
78
78
  clickIfVisible = require(basepath + "/click").clickIfVisible;
79
79
  clickByIdWithExecute = require(basepath + "/click").clickByIdWithExecute;
80
- doubleClick= require(basepath + "/click").doubleclick;
80
+ doubleClick = require(basepath + "/click").doubleclick;
81
81
 
82
82
  assertText = require(basepath + '/assert').assertText;
83
83
  assertAttributeValue = require(basepath + '/assert').assertAttributeValue;
@@ -89,8 +89,8 @@ randomint = require(basepath + '/random').RNDINT;
89
89
  randomalphanum = require(basepath + '/random').RNDALPHANUM;
90
90
  randomdecimal = require(basepath + '/random').RNDDECIMAL;
91
91
  randomregex = require(basepath + '/random').RNDREGEX;
92
- random= require(basepath + '/random').RANDOM;
93
- randomdate= require(basepath + '/random').RNDDATE;
92
+ random = require(basepath + '/random').RANDOM;
93
+ randomdate = require(basepath + '/random').RNDDATE;
94
94
 
95
95
  storetext = require(basepath + '/storeToBuffer').STORETEXT;
96
96
  storevalue = require(basepath + '/storeToBuffer').STOREVALUE;
@@ -34,15 +34,32 @@ async function callapi(methodtype, api_url, queryParams, payloaddetails, body_ty
34
34
  console.log("No body sent (body_type not provided or empty payload).");
35
35
  }
36
36
 
37
-
37
+
38
38
  console.warn("Warning: GET request with a body is non-standard and may not work with all APIs.");
39
- response = await axios({
39
+ const config = {
40
40
  method: method,
41
41
  url: api_url,
42
- headers: headers,
43
- data: body === null ? undefined : body // Axios allows body with GET in some cases
44
- });
45
-
42
+ headers: headers
43
+ };
44
+ const isBodyEmpty =
45
+ body === null ||
46
+ body === undefined ||
47
+ body === '' ||
48
+ (typeof body === 'object' && Object.keys(body).length === 0);
49
+
50
+ if (!isBodyEmpty) {
51
+ config.data = body;
52
+ }
53
+
54
+ response = await axios(config);
55
+
56
+ // response = await axios({
57
+ // method: method,
58
+ // url: api_url,
59
+ // headers: headers,
60
+ // data: body === null ? undefined : body // Axios allows body with GET in some cases
61
+ // });
62
+
46
63
 
47
64
  console.log("Response Data:", response.data);
48
65
 
@@ -137,7 +154,7 @@ async function validateAttributeData(attribute_name, attribute, buffer, bufferna
137
154
  valueToVerify = Boolean(valueToVerify);
138
155
  } else if (datatype.toLowerCase() == "decimal") {
139
156
  valueToVerify = parseFloat(valueToVerify);
140
- }else if (datatype.toLowerCase() == "string") {
157
+ } else if (datatype.toLowerCase() == "string") {
141
158
  valueToVerify = valueToVerify.toString();
142
159
  }
143
160
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "froth-webdriverio-framework",
3
- "version": "4.0.61",
3
+ "version": "4.0.63",
4
4
  "readme": "WebdriverIO Integration",
5
5
  "description": "WebdriverIO and BrowserStack App Automate",
6
6
  "license": "MIT",