froth-webdriverio-framework 3.0.111 → 3.0.113

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.
Files changed (31) hide show
  1. package/{api → froth_api_calls}/browsersatckSessionInfo.js +8 -4
  2. package/{api → froth_api_calls}/getexecutionDetails.js +41 -26
  3. package/{api → froth_api_calls}/getsuiteDetails.js +14 -13
  4. package/{api → froth_api_calls}/loginapi.js +2 -4
  5. package/{api → froth_api_calls}/readTestdata.js +6 -4
  6. package/{commonMethods → froth_common_actions}/Utils.js +21 -9
  7. package/{commonMethods → froth_common_actions}/alert.js +3 -3
  8. package/{commonMethods → froth_common_actions}/apicall.js +17 -5
  9. package/{commonMethods → froth_common_actions}/click.js +24 -1
  10. package/{commonMethods → froth_common_actions}/jwt.js +1 -1
  11. package/{commonMethods → froth_common_actions}/scroll.js +23 -1
  12. package/froth_common_actions/swipe.js +219 -0
  13. package/{config → froth_configs}/commonconfig.js +66 -37
  14. package/{config → froth_configs}/setallDatailinBuffer.js +19 -16
  15. package/froth_configs/wdio.common.conf.js +74 -0
  16. package/package.json +5 -6
  17. package/.github/workflows/main.yml +0 -23
  18. package/commonMethods/swipe.js +0 -59
  19. package/config/android.conf.js +0 -49
  20. package/config/api.conf.bs.js +0 -76
  21. package/config/api.conf.js +0 -77
  22. package/config/common.mobile.conf.js +0 -45
  23. package/config/injectimage.js +0 -4
  24. package/config/ios.conf.js +0 -47
  25. package/config/web.conf.bs.js +0 -76
  26. package/config/web.conf.js +0 -70
  27. /package/{api → froth_api_calls}/aesEncryption.js +0 -0
  28. /package/{commonMethods → froth_common_actions}/assert.js +0 -0
  29. /package/{commonMethods → froth_common_actions}/dropDown.js +0 -0
  30. /package/{commonMethods → froth_common_actions}/random.js +0 -0
  31. /package/{commonMethods → froth_common_actions}/storeToBuffer.js +0 -0
@@ -5,12 +5,13 @@ async function getBSBuildDetails(sessiontype, bs_username, bs_pwd) {
5
5
  console.log("sessiontype:" + sessiontype)
6
6
  const username = bs_username;
7
7
  const accessKey = bs_pwd;
8
+ console.log("accessKey:" + accessKey)
8
9
  const basicAuth = btoa(`${username}:${accessKey}`);
9
10
 
10
11
  let hashed_id = null;
11
12
 
12
13
  // const sessionid= BUFFER.getItem("SESSION_ID");
13
-
14
+ console.log("Browsersatck build name :" + process.env.BROWSERSTACK_BUILD_NAME)
14
15
  const url = `https://api.browserstack.com/${sessiontype}/builds.json?name=${process.env.BROWSERSTACK_BUILD_NAME}`;
15
16
 
16
17
  console.log("url:" + url)
@@ -35,6 +36,7 @@ async function getBSBuildDetails(sessiontype, bs_username, bs_pwd) {
35
36
  } else {
36
37
  const errorText = await response.text();
37
38
  console.error(`Data fetch failed response in getBSBuildDetails:${response.status}`);
39
+ // console.error(`Data fetch failed response in getBSBuildDetails:${errorText}`);
38
40
  // throw new Error(`HTTP error! status: ${response.status}`);
39
41
  }
40
42
 
@@ -52,7 +54,9 @@ async function getBSSessionDetails(sessiontype, bs_username, bs_pwd) {
52
54
  try {
53
55
  // const sessionId = sessionIdd;
54
56
  const username = bs_username;
55
- const accessKey = Buffer.from(bs_pwd, 'base64').toString('utf-8');
57
+ // const accessKey = Buffer.from(bs_pwd, 'base64').toString('utf-8');
58
+ const accessKey = bs_pwd;
59
+
56
60
  const basicAuth = btoa(`${username}:${accessKey}`);
57
61
 
58
62
  const hash_id = await getBSBuildDetails(sessiontype, bs_username, accessKey)
@@ -77,7 +81,7 @@ async function getBSSessionDetails(sessiontype, bs_username, bs_pwd) {
77
81
  const duration = data[0].automation_session.duration;
78
82
  BUFFER.setItem("REPORT_URL", publicUrl)
79
83
  BUFFER.setItem("FROTH_TOTAL_DURATION", duration)
80
-
84
+ console.log("public url:" + publicUrl)
81
85
  //return jsondata;
82
86
  } else if (response.status === 401) { //
83
87
  console.log("Unauthorized, token expired")
@@ -102,7 +106,7 @@ async function amend2Browserstack(annotationMessage, level) {
102
106
  try {
103
107
 
104
108
  console.log("Annotation message inside amend2Browserstack:" + annotationMessage)
105
- if (process.env.BROWSERSTACK)
109
+ if (process.env.PLATFORM === 'browserstack')
106
110
  await driver.execute('browserstack_executor: {"action": "annotate", "arguments": {"data":"' + annotationMessage + '","level": "' + level + '"}}');
107
111
 
108
112
  } catch (error) {
@@ -1,5 +1,5 @@
1
1
 
2
- const getLoginToken = require("../api/loginapi.js")
2
+ //const getLoginToken = require("./loginapi.js")
3
3
  // Function to get data from the API using the Bearer token
4
4
 
5
5
  async function getExecuitonDetails(frothUrl, token, id) {
@@ -21,20 +21,24 @@ async function getExecuitonDetails(frothUrl, token, id) {
21
21
  if (response.ok) {
22
22
  const data = await response.json();
23
23
  // console.log(data)
24
- jsondata.automation_suite_id = data.automation_suite_id;
25
- jsondata.test_cycle_id = data.test_cycle_id;
26
- if (data.testcycle_type === "Android" || data.testcycle_type === "Ios") {
27
- jsondata.device_name = data.device_name
28
- jsondata.version = data.version
29
- }
30
- // console.log("json data :" + JSON.stringify(jsondata));
24
+ jsondata.automation_suite_id = data.automation_suite_details.id;
25
+ jsondata.test_cycle_id = data.test_cycle_details.id;
26
+ jsondata.app_url = data.app_details ? data.app_details.app_url : null;
27
+ jsondata.browser_stack_local = data.capability_details ? data.capability_details.browser_stack_local : null;
28
+ jsondata.mediaurls = data.media_details ? data.media_details.map(media => media.media_url) : null;
29
+
30
+ //console.log("media urls :" + jsondata.mediaurls );
31
+
32
+
33
+ console.log("in get execution details json data :" + JSON.stringify(jsondata));
31
34
 
32
35
  return jsondata;
33
36
  } else if (response.status === 401) { // Unauthorized, token expired
34
37
  // Call login function to obtain a new token
35
- const newToken = await getLoginToken(BUFFER.getItem("SERVICE_USER"), BUFFER.getItem("SERVICE_PASSWORD")); // You need to implement the login function
38
+ // const newToken = await getLoginToken(BUFFER.getItem("SERVICE_USER"), BUFFER.getItem("SERVICE_PASSWORD")); // You need to implement the login function
36
39
  // Retry the request with the new token
37
- return getExecuitonDetails(frothUrl, newToken, id);
40
+ // return getExecuitonDetails(frothUrl, newToken, id);
41
+ console.log("Unauthorized, token expired"+response.status)
38
42
  } else {
39
43
  const errorText = await response.text();
40
44
  console.error(`Data fetch failed response in getExecuitonDetails: ${response.status}`);
@@ -53,7 +57,7 @@ async function getExecuitonDetails(frothUrl, token, id) {
53
57
 
54
58
  }
55
59
 
56
- async function getExecuitonScriptDetails(frothUrl, token, execution_id, script_id,script_platform) {
60
+ async function getExecuitonScriptDetails(frothUrl, token, execution_id, script_id, script_platform) {
57
61
  let id;
58
62
  const url = `${frothUrl}/api/execution-script-mapping/?execution_id=${execution_id}&automation_script_id=${script_id}&platform=${script_platform}`;
59
63
 
@@ -77,10 +81,12 @@ async function getExecuitonScriptDetails(frothUrl, token, execution_id, script_i
77
81
 
78
82
  return id;
79
83
  } else if (response.status === 401) { // Unauthorized, token expired
84
+ console.log("Unauthorized, token expired"+response.status)
85
+
80
86
  // Call login function to obtain a new token
81
- const newToken = await getLoginToken(BUFFER.getItem("SERVICE_USER"), BUFFER.getItem("SERVICE_PASSWORD")); // You need to implement the login function
87
+ // const newToken = await getLoginToken(BUFFER.getItem("SERVICE_USER"), BUFFER.getItem("SERVICE_PASSWORD")); // You need to implement the login function
82
88
  // Retry the request with the new token
83
- return getExecuitonScriptDetails(frothUrl, newToken, execution_id, script_id);
89
+ // return getExecuitonScriptDetails(frothUrl, newToken, execution_id, script_id);
84
90
  } else {
85
91
  const errorText = await response.text();
86
92
  console.error(`Data fetch failed response in getExecuitonScriptDetails: ${response.status}`);
@@ -97,7 +103,7 @@ async function getExecuitonScriptDetails(frothUrl, token, execution_id, script_i
97
103
  }
98
104
 
99
105
  async function updateExecuitonDetails(frothUrl, token, id, resultdetails) {
100
- if (id != 0) {
106
+ // if (id != 0) {
101
107
 
102
108
 
103
109
  const url = `${frothUrl}/api/test-execution-update/${id}/`;
@@ -113,7 +119,11 @@ async function updateExecuitonDetails(frothUrl, token, id, resultdetails) {
113
119
  }
114
120
  formData.append('id', BUFFER.getItem("FROTH_EXECUTION_ID"))
115
121
  formData.append('report_url', BUFFER.getItem("REPORT_URL"))
122
+ formData.append('updated_through_bot', true)
123
+
116
124
  console.log("Report URL:" + BUFFER.getItem("REPORT_URL"))
125
+
126
+
117
127
 
118
128
  const response = await fetch(url, {
119
129
  method: 'PUT',
@@ -130,9 +140,11 @@ async function updateExecuitonDetails(frothUrl, token, id, resultdetails) {
130
140
 
131
141
  } else if (response.status === 401) { // Unauthorized, token expired
132
142
  // Call login function to obtain a new token
133
- const newToken = await getLoginToken(BUFFER.getItem("SERVICE_USER"), BUFFER.getItem("SERVICE_PASSWORD")); // You need to implement the login function
134
- // Retry the request with the new token
135
- return updateExecuitonDetails(frothUrl, newToken, id, resultdetails);
143
+ // const newToken = await getLoginToken(BUFFER.getItem("SERVICE_USER"), BUFFER.getItem("SERVICE_PASSWORD")); // You need to implement the login function
144
+ // // Retry the request with the new token
145
+ // return updateExecuitonDetails(frothUrl, newToken, id, resultdetails);
146
+ console.log("Unauthorized, token expired"+response.status)
147
+
136
148
  } else {
137
149
  const errorText = await response.text();
138
150
  console.error(`error in updating the status into DB ${response.status}`);
@@ -145,18 +157,18 @@ async function updateExecuitonDetails(frothUrl, token, id, resultdetails) {
145
157
  console.error('Error fetching data:', error);
146
158
 
147
159
  }
148
- } else {
149
- console.error('Error fetching data: Invalid ID');
150
- }
160
+ // } else {
161
+ // console.error('Error fetching data: Invalid ID');
162
+ // }
151
163
 
152
164
  }
153
165
 
154
- async function updateScriptExecutionStatus(frothUrl, token, scriptid,script_platform, status) {
166
+ async function updateScriptExecutionStatus(frothUrl, token, scriptid, script_platform, status) {
155
167
 
156
168
  if (scriptid != 0) {
157
169
  try {
158
- console.log("script platform is "+script_platform)
159
- const id = await getExecuitonScriptDetails(frothUrl, token, BUFFER.getItem("FROTH_EXECUTION_ID"), scriptid,script_platform)
170
+ console.log("script platform is " + script_platform)
171
+ const id = await getExecuitonScriptDetails(frothUrl, token, BUFFER.getItem("FROTH_EXECUTION_ID"), scriptid, script_platform)
160
172
  console.log("ID is :" + id)
161
173
  const url = `${frothUrl}/api/script-status-percentage/${id}/`;
162
174
  const formData = new FormData();
@@ -164,6 +176,7 @@ async function updateScriptExecutionStatus(frothUrl, token, scriptid,script_plat
164
176
  console.log("URL" + url)
165
177
  // formData.append('execution_id', BUFFER.getItem("EXECUTION_ID"))
166
178
  formData.append('script_status', status)
179
+ formData.append('updated_through_bot', true)
167
180
 
168
181
  const response = await fetch(url, {
169
182
  method: 'PUT',
@@ -180,9 +193,11 @@ async function updateScriptExecutionStatus(frothUrl, token, scriptid,script_plat
180
193
 
181
194
  } else if (response.status === 401) { // Unauthorized, token expired
182
195
  // Call login function to obtain a new token
183
- const newToken = await getLoginToken(BUFFER.getItem("SERVICE_USER"), BUFFER.getItem("SERVICE_PASSWORD")); // You need to implement the login function
184
- // Retry the request with the new token
185
- return updateScriptExecutionStatus(frothUrl, newToken, scriptid,script_platform, status);
196
+ // const newToken = await getLoginToken(BUFFER.getItem("SERVICE_USER"), BUFFER.getItem("SERVICE_PASSWORD")); // You need to implement the login function
197
+ // // Retry the request with the new token
198
+ // return updateScriptExecutionStatus(frothUrl, newToken, scriptid, script_platform, status);
199
+ console.log("Unauthorized, token expired"+response.status)
200
+
186
201
  } else {
187
202
  const errorText = await response.text();
188
203
  console.error(`error in updating the status into DB ${response.status}`);
@@ -1,5 +1,5 @@
1
1
 
2
- const getLoginToken=require('./loginapi')
2
+ //const getLoginToken = require('./loginapi')
3
3
  // Function to get data from the API using the Bearer token
4
4
  async function getSuiteDetails(frothUrl, token, id) {
5
5
  let jsondata = {};
@@ -18,37 +18,38 @@ async function getSuiteDetails(frothUrl, token, id) {
18
18
  });
19
19
  if (response.ok) {
20
20
  const data = await response.json();
21
- // console.log(data)
21
+ // console.log(data)
22
22
  jsondata.automation_suite_id = data.id == null ? 0 : data.id;
23
23
  jsondata.automation_suite_name = data.automation_suite_name == null ? "" : data.automation_suite_name;
24
24
  jsondata.test_data_id = data.test_data_id == null ? 0 : data.test_data_id;
25
- jsondata.browser_stack_urls = data.browser_stack_urls == null ? "" : data.browser_stack_urls;
26
- jsondata.script_details=data.script_details == null ? [] : data.script_details;
27
- // console.log("automation_script_id:" + JSON.stringify(jsondata.automation_script_id))
25
+ // jsondata.browser_stack_urls = data.browser_stack_urls == null ? "" : data.browser_stack_urls;
26
+ jsondata.script_details = data.script_details == null ? [] : data.script_details;
27
+ // console.log("automation_script_id:" + JSON.stringify(jsondata.automation_script_id))
28
28
  const automationScripts = jsondata.script_details.reduce((obj, item) => {
29
29
  obj[item.script_Id] = item.script_Id;
30
30
  BUFFER.setItem(item.scriptName, item.scriptId);
31
- BUFFER.setItem(item.scriptName+"_PLATFORM", item.platform);
31
+ BUFFER.setItem(item.scriptName + "_PLATFORM", item.platform);
32
32
 
33
- return obj;
33
+ return obj;
34
34
  }, {});
35
35
  jsondata.test_sequence = data.test_sequence;
36
- // console.log("automation_script_ details:" + JSON.stringify(BUFFER))
36
+ // console.log("automation_script_ details:" + JSON.stringify(BUFFER))
37
37
 
38
- // console.log("json data :" + JSON.stringify(jsondata));
38
+ console.log("json data :" + JSON.stringify(jsondata));
39
39
 
40
40
  return jsondata;
41
41
 
42
42
  } else if (response.status === 401) { // Unauthorized, token expired
43
43
  // Call login function to obtain a new token
44
- const newToken = await getLoginToken(BUFFER.getItem("SERVICE_USER"), BUFFER.getItem("SERVICE_PASSWORD")); // You need to implement the login function
45
- // Retry the request with the new token
46
- return getSuiteDetails(frothUrl, newToken, id);
44
+ // const newToken = await getLoginToken(BUFFER.getItem("SERVICE_USER"), BUFFER.getItem("SERVICE_PASSWORD")); // You need to implement the login function
45
+ // // Retry the request with the new token
46
+ // return getSuiteDetails(frothUrl, newToken, id);
47
+ console.log("Unauthorized, token expired" + response.status)
47
48
  }
48
49
  else {
49
50
  const errorText = await response.text();
50
51
  console.error(`Data fetch failed response in getSuiteDetails: ${response.status}`);
51
- // throw new Error(`HTTP error! status: ${response.status}`);
52
+ // throw new Error(`HTTP error! status: ${response.status}`);
52
53
  }
53
54
 
54
55
 
@@ -8,10 +8,8 @@ async function getLoginToken(frothUrl, email, password) {
8
8
  console.log("URL: " + url);
9
9
  const formData = new FormData();
10
10
  formData.append('email_or_username', email);
11
- //formData.append('password', await enc(password,"froth-testops@rd"));
12
- formData.append('password', password);
13
- formData.append('is_ad_user', false);
14
- formData.append('remember_me', false);
11
+ formData.append('password', await enc(password,"froth-testops@rd"));
12
+ formData.append('is_ad_user', false)
15
13
 
16
14
  const response = await fetch(url, {
17
15
  method: 'POST',
@@ -1,5 +1,5 @@
1
1
 
2
- const getLoginToken = require('../api/loginapi.js');
2
+ const getLoginToken = require('./loginapi.js');
3
3
 
4
4
 
5
5
  // Function to get data from the API using the Bearer token
@@ -35,9 +35,11 @@ async function getDataById(frothUrl, token, id) {
35
35
  }
36
36
  else if (response.status === 401) { // Unauthorized, token expired
37
37
  // Call login function to obtain a new token
38
- const newToken = await getLoginToken(BUFFER.getItem("SERVICE_USER"), BUFFER.getItem("SERVICE_PASSWORD")); // You need to implement the login function
39
- // Retry the request with the new token
40
- return getDataById(frothUrl, newToken, id);
38
+ // const newToken = await getLoginToken(BUFFER.getItem("SERVICE_USER"), BUFFER.getItem("SERVICE_PASSWORD")); // You need to implement the login function
39
+ // // Retry the request with the new token
40
+ // return getDataById(frothUrl, newToken, id);
41
+ console.log("Unauthorized, token expired" + response.status)
42
+
41
43
  }
42
44
  else {
43
45
  const errorText = await response.text();
@@ -7,14 +7,17 @@ let scrollToLeft = null;
7
7
  let scrollToRight = null;
8
8
  let scrollDownToView = null;
9
9
  let scrollRightToView = null;
10
+ let scrollUpUntilVisible = null;
10
11
 
11
12
  let swipeRight = null;
12
13
  let swipeLeft = null;
13
14
  let swipeUp = null;
14
15
  let swipeDown = null;
15
-
16
+ let swipetoFit = null;
17
+ let swipeWithCoordinates = null;
16
18
 
17
19
  let clickIfVisible = null;
20
+ let doubleClick = null;
18
21
 
19
22
  let assertText = null;
20
23
  let randomtext = null;
@@ -35,15 +38,15 @@ let api = null;
35
38
 
36
39
  let selectDropDownValue = null;
37
40
 
38
- let acceptalert = null;
39
- let dismissalert = null;
41
+ let acceptAlert = null;
42
+ let dismissAlert = null;
40
43
 
41
44
  let generateJWT=null;
42
45
 
43
- if (process.env.LOCATION == 'local') {
46
+ if (process.env.LOCATION ==null || process.env.LOCATION == 'local') {
44
47
  basepath = ".";
45
48
  } else {
46
- basepath = "froth-webdriverio-framework/commonMethods";
49
+ basepath = "froth-webdriverio-framework/froth_common_actions";
47
50
  }
48
51
 
49
52
  scrollToEnd = require(basepath + "/scroll").scrollToEnd;
@@ -53,14 +56,19 @@ scrollToRight = require(basepath + '/scroll').scrollToRight;
53
56
  scrollDownToView = require(basepath + '/scroll').scrollDownToView;
54
57
  scrollRightToView = require(basepath + '/scroll').scrollRightToView;
55
58
  scrollIntoView = require(basepath + '/scroll').scrollIntoView;
59
+ scrollUpUntilVisible = require(basepath + '/scroll').scrollupUntilVisible;
60
+
56
61
 
57
62
  swipeDown = require(basepath + '/swipe').swipedown;
58
63
  swipeLeft = require(basepath + '/swipe').swipeleft;
59
64
  swipeRight = require(basepath + '/swipe').swiperight;
60
65
  swipeUp = require(basepath + '/swipe').swipeup;
66
+ swipetoFit= require(basepath + '/swipe').swipetofit;
67
+ swipeWithCoordinates = require(basepath + '/swipe').swipewithcoordinates;
61
68
 
62
69
  clickIfVisible = require(basepath + "/click").clickIfVisible;
63
70
  clickByIdWithExecute = require(basepath + "/click").clickByIdWithExecute;
71
+ doubleClick= require(basepath + "/click").doubleclick;
64
72
 
65
73
  assertText = require(basepath + '/assert').assertText;
66
74
  assertAttributeValue = require(basepath + '/assert').assertAttributeValue;
@@ -82,8 +90,8 @@ validate = require(basepath + '/apicall').validate;
82
90
 
83
91
  selectDropDownValue = require(basepath + '/dropDown').select4mDropDownValue;
84
92
 
85
- acceptalert = require(basepath + '/alert.js').acceptAlert;
86
- dismissalert = require(basepath + '/alert.js').dismissAlert;
93
+ acceptAlert = require(basepath + '/alert.js').acceptalert;
94
+ dismissAlert = require(basepath + '/alert.js').dismissalert;
87
95
 
88
96
  generateJWT = require(basepath + '/jwt').generateJWTToken;
89
97
 
@@ -97,6 +105,7 @@ module.exports = {
97
105
  scrollRightToView,
98
106
  clickIfVisible,
99
107
  clickByIdWithExecute,
108
+ doubleClick,
100
109
  assertText,
101
110
  assertAttributeValue,
102
111
  randomtext,
@@ -110,14 +119,17 @@ module.exports = {
110
119
  storevalue,
111
120
  storeattributevalue,
112
121
  scrollIntoView,
122
+ scrollUpUntilVisible,
113
123
  api,
114
124
  validate,
115
125
  selectDropDownValue,
116
- acceptalert,
117
- dismissalert,
126
+ acceptAlert,
127
+ dismissAlert,
118
128
  swipeLeft,
119
129
  swipeRight,
120
130
  swipeDown,
121
131
  swipeUp,
132
+ swipetoFit,
133
+ swipeWithCoordinates,
122
134
  generateJWT
123
135
  };
@@ -1,4 +1,4 @@
1
- async function acceptAlert() {
1
+ async function acceptalert() {
2
2
 
3
3
  try {
4
4
  await browser.waitUntil(async () => {
@@ -14,7 +14,7 @@ async function acceptAlert() {
14
14
 
15
15
  }
16
16
 
17
- async function dismissAlert() {
17
+ async function dismissalert() {
18
18
  try {
19
19
  await browser.waitUntil(async () => {
20
20
  return await browser.isAlertOpen();
@@ -31,4 +31,4 @@ async function dismissAlert() {
31
31
 
32
32
  }
33
33
 
34
- module.exports = { acceptAlert, dismissAlert };
34
+ module.exports = { acceptalert, dismissalert };
@@ -1,4 +1,4 @@
1
- const amendToBrowserstack = require("../api/browsersatckSessionInfo").amend2Browserstack;
1
+ const amendToBrowserstack = require("../froth_api_calls/browsersatckSessionInfo").amend2Browserstack;
2
2
 
3
3
  async function callapi(method, api_url, queryParams, payloaddetails, authentication, headers, attachments) {
4
4
  let response;
@@ -88,8 +88,14 @@ async function validate(attribute_name, attribute, actionname, buffer, buffernam
88
88
  await validateAttributeData(attribute_name, attribute, buffer, buffername_value, datatype);
89
89
  } else if (actionname.toLowerCase() == "setbuffer") {
90
90
  BUFFER.setItem(buffername_value, attribute);
91
+ let annotationMessage = `The vlaue has been stored in the buffer : ${buffername_value}.`;
92
+ await amendToBrowserstack(annotationMessage, "info");
93
+
91
94
  } else if (actionname.toLowerCase() == "getbuffer") {
95
+ let annotationMessage = `The vlaue has been retrived from the buffer : ${buffername_value}.`;
96
+ await amendToBrowserstack(annotationMessage, "info");
92
97
  return BUFFER.getItem(buffername_value);
98
+
93
99
  }
94
100
  // } catch (e) {
95
101
  // console.error('Error in validate method:', e);
@@ -109,19 +115,25 @@ async function validateAttributeData(attribute_name, attribute, buffer, bufferna
109
115
  valueToVerify = Number(valueToVerify);
110
116
  } else if (datatype.toLowerCase() == "boolean") {
111
117
  valueToVerify = Boolean(valueToVerify);
118
+ }else if (datatype.toLowerCase() == "float") {
119
+ valueToVerify = parseFloat(valueToVerify);
120
+ }else if (datatype.toLowerCase() == "double") {
121
+ valueToVerify = parseFloat(valueToVerify);
122
+ }else if (datatype.toLowerCase() == "string") {
123
+ valueToVerify = valueToVerify.toString();
112
124
  }
113
125
 
114
126
  expect(attribute).toBe(valueToVerify, `${attribute_name} --> Expected value: ${valueToVerify}, but got: ${attribute}`);
115
127
  assertionStatus = true; // If assertion passes, set status to true
116
128
 
117
- console.log("verification succeeded.");
118
- let annotationMessage = `${attribute_name} - verification passed. Actual text: ${attribute}, Expected text: ${valueToVerify}.`;
129
+ console.log(`Attribute name : ${attribute_name} verification passed. Actual text: ${attribute}, Expected text: ${valueToVerify}.`);
130
+ let annotationMessage = `Attribute name : ${attribute_name} - verification passed. Actual text: ${attribute}, Expected text: ${valueToVerify}.`;
119
131
  await amendToBrowserstack(annotationMessage, "info");
120
132
 
121
133
  } catch (e) {
122
134
  console.error('Error in validateAttributeData:', e);
123
- console.log(`${attribute_name} verification failed. Expected text: ${valueToVerify}.`);
124
- let annotationMessage = `${attribute_name} - verification failed. Expected text: ${valueToVerify}.`;
135
+ console.log(`Attribute name : ${attribute_name} verification failed. Expected text: ${valueToVerify}. error: ${e.message}`);
136
+ let annotationMessage = `Attribute name : ${attribute_name} - verification failed. Expected text: ${valueToVerify}. error: ${e.message}`;
125
137
  await amendToBrowserstack(annotationMessage, "error");
126
138
 
127
139
  throw e;
@@ -20,6 +20,29 @@ async function clickIfVisible(elementSelector) {
20
20
  }
21
21
  }
22
22
 
23
+ async function doubleclick(elementSelector) {
24
+ try {
25
+ let isDisplayed;
26
+ // Wait for the element to be visible
27
+ await driver.waitUntil(async () => {
28
+ console.log("Waiting for element to be visible");
29
+ const element = await $(elementSelector);
30
+ isDisplayed = await element.isDisplayed();
31
+ console.log("Element is displayed:", isDisplayed);
32
+ if (isDisplayed) {
33
+ // Get the actual text from the element
34
+ const element = await $(elementSelector);
35
+ await element.doubleClick();
36
+ console.log("Element is double clicked successfully.");
37
+ return;
38
+ }
39
+ }, { timeout: 30000 });
40
+ } catch (error) {
41
+ console.error("Element not found or not visible within 30 seconds");
42
+ }
43
+ }
44
+
45
+
23
46
 
24
47
  async function clickByIdWithExecute(elementid) {
25
48
  try {
@@ -31,4 +54,4 @@ async function clickByIdWithExecute(elementid) {
31
54
  }
32
55
  }
33
56
 
34
- module.exports = { clickIfVisible, clickByIdWithExecute };
57
+ module.exports = { clickIfVisible, clickByIdWithExecute ,doubleclick};
@@ -54,7 +54,7 @@ function main() {
54
54
  iat: currentTimestamp, // Issued at
55
55
  exp: currentTimestamp + 200, // Expiry time: 30 seconds from issuance
56
56
  user_agent: {
57
- id: "janga.reddy@ytlcomms.my"
57
+ id: "kartikaypriya.p@ytlcomms.my"
58
58
  }
59
59
  };
60
60
 
@@ -79,4 +79,26 @@ async function scrollIntoView(element){
79
79
  console.error(error.message);
80
80
  }
81
81
  }
82
- module.exports = { scrollToEnd, scrollToLeft, scrollToBeginning, scrollRightToView, scrollDownToView, scrollToRight ,scrollIntoView};
82
+
83
+ async function scrollupUntilVisible(selector) {
84
+ const element = await $(selector);
85
+
86
+ while (!(await element.isDisplayed())) {
87
+ await driver.performActions([
88
+ {
89
+ type: 'pointer',
90
+ id: 'finger1',
91
+ parameters: { pointerType: 'touch' },
92
+ actions: [
93
+ { type: 'pointerMove', duration: 0, x: 200, y: 800 },
94
+ { type: 'pointerDown', button: 0 },
95
+ { type: 'pause', duration: 100 },
96
+ { type: 'pointerMove', duration: 500, x: 200, y: 200 },
97
+ { type: 'pointerUp', button: 0 }
98
+ ]
99
+ }
100
+ ]);
101
+ await browser.pause(500);
102
+ }
103
+ }
104
+ module.exports = { scrollToEnd, scrollToLeft, scrollToBeginning, scrollRightToView, scrollDownToView, scrollToRight ,scrollIntoView,scrollupUntilVisible};