froth-webdriverio-framework 3.0.117 → 3.0.119
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/{api → froth_api_calls}/browsersatckSessionInfo.js +8 -4
- package/{api → froth_api_calls}/getexecutionDetails.js +73 -58
- package/{api → froth_api_calls}/getsuiteDetails.js +14 -13
- package/{api → froth_api_calls}/readTestdata.js +6 -4
- package/{commonMethods → froth_common_actions}/Utils.js +21 -9
- package/{commonMethods → froth_common_actions}/alert.js +3 -3
- package/{commonMethods → froth_common_actions}/apicall.js +19 -5
- package/{commonMethods → froth_common_actions}/click.js +24 -1
- package/{commonMethods → froth_common_actions}/jwt.js +1 -1
- package/{commonMethods → froth_common_actions}/scroll.js +23 -1
- package/froth_common_actions/swipe.js +219 -0
- package/{config → froth_configs}/commonconfig.js +68 -26
- package/{config → froth_configs}/setallDatailinBuffer.js +17 -16
- package/froth_configs/wdio.common.conf.js +74 -0
- package/package.json +6 -6
- package/.github/workflows/main.yml +0 -23
- package/commonMethods/swipe.js +0 -59
- package/config/android.conf.js +0 -49
- package/config/api.conf.bs.js +0 -76
- package/config/api.conf.js +0 -77
- package/config/common.mobile.conf.js +0 -45
- package/config/injectimage.js +0 -4
- package/config/ios.conf.js +0 -47
- package/config/web.conf.bs.js +0 -76
- package/config/web.conf.js +0 -70
- /package/{api → froth_api_calls}/aesEncryption.js +0 -0
- /package/{api → froth_api_calls}/loginapi.js +0 -0
- /package/{commonMethods → froth_common_actions}/assert.js +0 -0
- /package/{commonMethods → froth_common_actions}/dropDown.js +0 -0
- /package/{commonMethods → froth_common_actions}/random.js +0 -0
- /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.
|
|
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("
|
|
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.
|
|
25
|
-
jsondata.test_cycle_id = data.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
//
|
|
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,68 +103,74 @@ 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
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
109
|
+
const url = `${frothUrl}/api/test-execution-update/${id}/`;
|
|
110
|
+
const formData = new FormData();
|
|
111
|
+
try {
|
|
112
|
+
console.log("URL" + url)
|
|
107
113
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
if (resultdetails.excution_status != null) {
|
|
115
|
+
formData.append('excution_status', resultdetails.excution_status);
|
|
116
|
+
}
|
|
117
|
+
if (resultdetails.excution_time != null) {
|
|
118
|
+
formData.append('excution_time', resultdetails.excution_time);
|
|
119
|
+
}
|
|
120
|
+
formData.append('id', BUFFER.getItem("FROTH_EXECUTION_ID"))
|
|
121
|
+
formData.append('report_url', BUFFER.getItem("REPORT_URL"))
|
|
122
|
+
formData.append('updated_through_bot', true)
|
|
123
|
+
if (resultdetails.comments != null)
|
|
116
124
|
formData.append('comments', JSON.stringify(resultdetails.comments))
|
|
117
125
|
|
|
118
|
-
|
|
126
|
+
console.log("Report URL:" + BUFFER.getItem("REPORT_URL"))
|
|
119
127
|
|
|
120
|
-
const response = await fetch(url, {
|
|
121
|
-
method: 'PUT',
|
|
122
|
-
headers: {
|
|
123
|
-
'Authorization': `Bearer ${token}`
|
|
124
|
-
},
|
|
125
|
-
body: formData
|
|
126
|
-
|
|
127
|
-
});
|
|
128
128
|
|
|
129
|
-
if (response.ok) {
|
|
130
|
-
const data = await response.json();
|
|
131
|
-
// console.log("data is :"+data)
|
|
132
129
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
const errorText = await response.text();
|
|
140
|
-
console.error(`error in updating the status into DB ${response.status}`);
|
|
141
|
-
// throw new Error(`HTTP error! status: ${response.status}`);
|
|
142
|
-
}
|
|
130
|
+
const response = await fetch(url, {
|
|
131
|
+
method: 'PUT',
|
|
132
|
+
headers: {
|
|
133
|
+
'Authorization': `Bearer ${token}`
|
|
134
|
+
},
|
|
135
|
+
body: formData
|
|
143
136
|
|
|
137
|
+
});
|
|
144
138
|
|
|
139
|
+
if (response.ok) {
|
|
140
|
+
const data = await response.json();
|
|
141
|
+
// console.log("data is :"+data)
|
|
145
142
|
|
|
146
|
-
}
|
|
147
|
-
|
|
143
|
+
} else if (response.status === 401) { // Unauthorized, token expired
|
|
144
|
+
// Call login function to obtain a new token
|
|
145
|
+
// const newToken = await getLoginToken(BUFFER.getItem("SERVICE_USER"), BUFFER.getItem("SERVICE_PASSWORD")); // You need to implement the login function
|
|
146
|
+
// // Retry the request with the new token
|
|
147
|
+
// return updateExecuitonDetails(frothUrl, newToken, id, resultdetails);
|
|
148
|
+
console.log("Unauthorized, token expired" + response.status)
|
|
148
149
|
|
|
150
|
+
} else {
|
|
151
|
+
const errorText = await response.text();
|
|
152
|
+
console.error(`error in updating the status into DB ${response.status}`);
|
|
153
|
+
// throw new Error(`HTTP error! status: ${response.status}`);
|
|
149
154
|
}
|
|
150
|
-
|
|
151
|
-
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
} catch (error) {
|
|
159
|
+
console.error('Error fetching data:', error);
|
|
160
|
+
|
|
152
161
|
}
|
|
162
|
+
// } else {
|
|
163
|
+
// console.error('Error fetching data: Invalid ID');
|
|
164
|
+
// }
|
|
153
165
|
|
|
154
166
|
}
|
|
155
167
|
|
|
156
|
-
async function updateScriptExecutionStatus(frothUrl, token, scriptid,script_platform, status) {
|
|
168
|
+
async function updateScriptExecutionStatus(frothUrl, token, scriptid, script_platform, status) {
|
|
157
169
|
|
|
158
170
|
if (scriptid != 0) {
|
|
159
171
|
try {
|
|
160
|
-
console.log("script platform is "+script_platform)
|
|
161
|
-
const id = await getExecuitonScriptDetails(frothUrl, token, BUFFER.getItem("FROTH_EXECUTION_ID"), scriptid,script_platform)
|
|
172
|
+
console.log("script platform is " + script_platform)
|
|
173
|
+
const id = await getExecuitonScriptDetails(frothUrl, token, BUFFER.getItem("FROTH_EXECUTION_ID"), scriptid, script_platform)
|
|
162
174
|
console.log("ID is :" + id)
|
|
163
175
|
const url = `${frothUrl}/api/script-status-percentage/${id}/`;
|
|
164
176
|
const formData = new FormData();
|
|
@@ -166,6 +178,7 @@ async function updateScriptExecutionStatus(frothUrl, token, scriptid,script_plat
|
|
|
166
178
|
console.log("URL" + url)
|
|
167
179
|
// formData.append('execution_id', BUFFER.getItem("EXECUTION_ID"))
|
|
168
180
|
formData.append('script_status', status)
|
|
181
|
+
formData.append('updated_through_bot', true)
|
|
169
182
|
|
|
170
183
|
const response = await fetch(url, {
|
|
171
184
|
method: 'PUT',
|
|
@@ -182,9 +195,11 @@ async function updateScriptExecutionStatus(frothUrl, token, scriptid,script_plat
|
|
|
182
195
|
|
|
183
196
|
} else if (response.status === 401) { // Unauthorized, token expired
|
|
184
197
|
// Call login function to obtain a new token
|
|
185
|
-
const newToken = await getLoginToken(BUFFER.getItem("SERVICE_USER"), BUFFER.getItem("SERVICE_PASSWORD")); // You need to implement the login function
|
|
186
|
-
// Retry the request with the new token
|
|
187
|
-
return updateScriptExecutionStatus(frothUrl, newToken, scriptid,script_platform, status);
|
|
198
|
+
// const newToken = await getLoginToken(BUFFER.getItem("SERVICE_USER"), BUFFER.getItem("SERVICE_PASSWORD")); // You need to implement the login function
|
|
199
|
+
// // Retry the request with the new token
|
|
200
|
+
// return updateScriptExecutionStatus(frothUrl, newToken, scriptid, script_platform, status);
|
|
201
|
+
console.log("Unauthorized, token expired" + response.status)
|
|
202
|
+
|
|
188
203
|
} else {
|
|
189
204
|
const errorText = await response.text();
|
|
190
205
|
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
|
-
|
|
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
|
-
|
|
26
|
-
jsondata.script_details=data.script_details == null ? [] : data.script_details;
|
|
27
|
-
|
|
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
|
-
|
|
33
|
+
return obj;
|
|
34
34
|
}, {});
|
|
35
35
|
jsondata.test_sequence = data.test_sequence;
|
|
36
|
-
|
|
36
|
+
// console.log("automation_script_ details:" + JSON.stringify(BUFFER))
|
|
37
37
|
|
|
38
|
-
|
|
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
|
-
|
|
52
|
+
// throw new Error(`HTTP error! status: ${response.status}`);
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
const getLoginToken = require('
|
|
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
|
|
39
|
-
let
|
|
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/
|
|
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
|
-
|
|
86
|
-
|
|
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
|
-
|
|
117
|
-
|
|
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
|
|
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
|
|
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 = {
|
|
34
|
+
module.exports = { acceptalert, dismissalert };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const amendToBrowserstack = require("../
|
|
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;
|
|
@@ -57,6 +57,8 @@ async function jsonToFormData(json) {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
appendFormData(json);
|
|
60
|
+
console.log("FormData in json to formdata:",formData);
|
|
61
|
+
console.log("FormData in json to formdata:", JSON.stringify(formData));
|
|
60
62
|
return formData;
|
|
61
63
|
}
|
|
62
64
|
|
|
@@ -88,8 +90,14 @@ async function validate(attribute_name, attribute, actionname, buffer, buffernam
|
|
|
88
90
|
await validateAttributeData(attribute_name, attribute, buffer, buffername_value, datatype);
|
|
89
91
|
} else if (actionname.toLowerCase() == "setbuffer") {
|
|
90
92
|
BUFFER.setItem(buffername_value, attribute);
|
|
93
|
+
let annotationMessage = `The vlaue has been stored in the buffer : ${buffername_value}.`;
|
|
94
|
+
await amendToBrowserstack(annotationMessage, "info");
|
|
95
|
+
|
|
91
96
|
} else if (actionname.toLowerCase() == "getbuffer") {
|
|
97
|
+
let annotationMessage = `The vlaue has been retrived from the buffer : ${buffername_value}.`;
|
|
98
|
+
await amendToBrowserstack(annotationMessage, "info");
|
|
92
99
|
return BUFFER.getItem(buffername_value);
|
|
100
|
+
|
|
93
101
|
}
|
|
94
102
|
// } catch (e) {
|
|
95
103
|
// console.error('Error in validate method:', e);
|
|
@@ -109,19 +117,25 @@ async function validateAttributeData(attribute_name, attribute, buffer, bufferna
|
|
|
109
117
|
valueToVerify = Number(valueToVerify);
|
|
110
118
|
} else if (datatype.toLowerCase() == "boolean") {
|
|
111
119
|
valueToVerify = Boolean(valueToVerify);
|
|
120
|
+
}else if (datatype.toLowerCase() == "float") {
|
|
121
|
+
valueToVerify = parseFloat(valueToVerify);
|
|
122
|
+
}else if (datatype.toLowerCase() == "double") {
|
|
123
|
+
valueToVerify = parseFloat(valueToVerify);
|
|
124
|
+
}else if (datatype.toLowerCase() == "string") {
|
|
125
|
+
valueToVerify = valueToVerify.toString();
|
|
112
126
|
}
|
|
113
127
|
|
|
114
128
|
expect(attribute).toBe(valueToVerify, `${attribute_name} --> Expected value: ${valueToVerify}, but got: ${attribute}`);
|
|
115
129
|
assertionStatus = true; // If assertion passes, set status to true
|
|
116
130
|
|
|
117
|
-
console.log(
|
|
118
|
-
let annotationMessage =
|
|
131
|
+
console.log(`Attribute name : ${attribute_name} verification passed. Actual text: ${attribute}, Expected text: ${valueToVerify}.`);
|
|
132
|
+
let annotationMessage = `Attribute name : ${attribute_name} - verification passed. Actual text: ${attribute}, Expected text: ${valueToVerify}.`;
|
|
119
133
|
await amendToBrowserstack(annotationMessage, "info");
|
|
120
134
|
|
|
121
135
|
} catch (e) {
|
|
122
136
|
console.error('Error in validateAttributeData:', e);
|
|
123
|
-
console.log(
|
|
124
|
-
let annotationMessage =
|
|
137
|
+
console.log(`Attribute name : ${attribute_name} verification failed. Expected text: ${valueToVerify}. error: ${e.message}`);
|
|
138
|
+
let annotationMessage = `Attribute name : ${attribute_name} - verification failed. Expected text: ${valueToVerify}. error: ${e.message}`;
|
|
125
139
|
await amendToBrowserstack(annotationMessage, "error");
|
|
126
140
|
|
|
127
141
|
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};
|
|
@@ -79,4 +79,26 @@ async function scrollIntoView(element){
|
|
|
79
79
|
console.error(error.message);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
|
|
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};
|