froth-webdriverio-framework 3.0.110 → 3.0.111
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/.github/workflows/main.yml +23 -0
- package/{froth_api_calls → api}/browsersatckSessionInfo.js +4 -8
- package/{froth_api_calls → api}/getexecutionDetails.js +17 -20
- package/{froth_api_calls → api}/getsuiteDetails.js +10 -10
- package/{froth_api_calls → api}/loginapi.js +4 -2
- package/{froth_api_calls → api}/readTestdata.js +1 -1
- package/{froth_common_actions → commonMethods}/Utils.js +9 -21
- package/{froth_common_actions → commonMethods}/alert.js +3 -3
- package/{froth_common_actions → commonMethods}/apicall.js +5 -17
- package/{froth_common_actions → commonMethods}/click.js +1 -24
- package/{froth_common_actions → commonMethods}/jwt.js +3 -3
- package/{froth_common_actions → commonMethods}/scroll.js +1 -23
- package/commonMethods/swipe.js +59 -0
- package/config/android.conf.js +49 -0
- package/config/api.conf.bs.js +76 -0
- package/config/api.conf.js +77 -0
- package/config/common.mobile.conf.js +45 -0
- package/{froth_configs → config}/commonconfig.js +37 -66
- package/config/injectimage.js +4 -0
- package/config/ios.conf.js +47 -0
- package/{froth_configs → config}/setallDatailinBuffer.js +13 -15
- package/config/web.conf.bs.js +76 -0
- package/config/web.conf.js +70 -0
- package/package.json +6 -5
- package/froth_common_actions/swipe.js +0 -219
- package/froth_configs/wdio.common.conf.js +0 -74
- /package/{froth_api_calls → api}/aesEncryption.js +0 -0
- /package/{froth_common_actions → commonMethods}/assert.js +0 -0
- /package/{froth_common_actions → commonMethods}/dropDown.js +0 -0
- /package/{froth_common_actions → commonMethods}/random.js +0 -0
- /package/{froth_common_actions → commonMethods}/storeToBuffer.js +0 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
name: npm_package
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
release:
|
|
8
|
+
name: release
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- name: Checkout code
|
|
12
|
+
uses: actions/checkout@v2
|
|
13
|
+
- name: Setup Node.js
|
|
14
|
+
uses: actions/setup-node@v2
|
|
15
|
+
with:
|
|
16
|
+
node-version: '12.x'
|
|
17
|
+
registry-url: https://registry.npmjs.org
|
|
18
|
+
|
|
19
|
+
- name: Publish to npm
|
|
20
|
+
run: npm publish --access public
|
|
21
|
+
env:
|
|
22
|
+
NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
|
|
23
|
+
|
|
@@ -5,13 +5,12 @@ 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)
|
|
9
8
|
const basicAuth = btoa(`${username}:${accessKey}`);
|
|
10
9
|
|
|
11
10
|
let hashed_id = null;
|
|
12
11
|
|
|
13
12
|
// const sessionid= BUFFER.getItem("SESSION_ID");
|
|
14
|
-
|
|
13
|
+
|
|
15
14
|
const url = `https://api.browserstack.com/${sessiontype}/builds.json?name=${process.env.BROWSERSTACK_BUILD_NAME}`;
|
|
16
15
|
|
|
17
16
|
console.log("url:" + url)
|
|
@@ -36,7 +35,6 @@ async function getBSBuildDetails(sessiontype, bs_username, bs_pwd) {
|
|
|
36
35
|
} else {
|
|
37
36
|
const errorText = await response.text();
|
|
38
37
|
console.error(`Data fetch failed response in getBSBuildDetails:${response.status}`);
|
|
39
|
-
// console.error(`Data fetch failed response in getBSBuildDetails:${errorText}`);
|
|
40
38
|
// throw new Error(`HTTP error! status: ${response.status}`);
|
|
41
39
|
}
|
|
42
40
|
|
|
@@ -54,9 +52,7 @@ async function getBSSessionDetails(sessiontype, bs_username, bs_pwd) {
|
|
|
54
52
|
try {
|
|
55
53
|
// const sessionId = sessionIdd;
|
|
56
54
|
const username = bs_username;
|
|
57
|
-
|
|
58
|
-
const accessKey = bs_pwd;
|
|
59
|
-
|
|
55
|
+
const accessKey = Buffer.from(bs_pwd, 'base64').toString('utf-8');
|
|
60
56
|
const basicAuth = btoa(`${username}:${accessKey}`);
|
|
61
57
|
|
|
62
58
|
const hash_id = await getBSBuildDetails(sessiontype, bs_username, accessKey)
|
|
@@ -81,7 +77,7 @@ async function getBSSessionDetails(sessiontype, bs_username, bs_pwd) {
|
|
|
81
77
|
const duration = data[0].automation_session.duration;
|
|
82
78
|
BUFFER.setItem("REPORT_URL", publicUrl)
|
|
83
79
|
BUFFER.setItem("FROTH_TOTAL_DURATION", duration)
|
|
84
|
-
|
|
80
|
+
|
|
85
81
|
//return jsondata;
|
|
86
82
|
} else if (response.status === 401) { //
|
|
87
83
|
console.log("Unauthorized, token expired")
|
|
@@ -106,7 +102,7 @@ async function amend2Browserstack(annotationMessage, level) {
|
|
|
106
102
|
try {
|
|
107
103
|
|
|
108
104
|
console.log("Annotation message inside amend2Browserstack:" + annotationMessage)
|
|
109
|
-
if (process.env.
|
|
105
|
+
if (process.env.BROWSERSTACK)
|
|
110
106
|
await driver.execute('browserstack_executor: {"action": "annotate", "arguments": {"data":"' + annotationMessage + '","level": "' + level + '"}}');
|
|
111
107
|
|
|
112
108
|
} catch (error) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
const getLoginToken = require("
|
|
2
|
+
const getLoginToken = require("../api/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,16 +21,13 @@ 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
|
-
//console.log("
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
console.log("in get execution details json data :" + JSON.stringify(jsondata));
|
|
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));
|
|
34
31
|
|
|
35
32
|
return jsondata;
|
|
36
33
|
} else if (response.status === 401) { // Unauthorized, token expired
|
|
@@ -56,7 +53,7 @@ async function getExecuitonDetails(frothUrl, token, id) {
|
|
|
56
53
|
|
|
57
54
|
}
|
|
58
55
|
|
|
59
|
-
async function getExecuitonScriptDetails(frothUrl, token, execution_id, script_id,
|
|
56
|
+
async function getExecuitonScriptDetails(frothUrl, token, execution_id, script_id,script_platform) {
|
|
60
57
|
let id;
|
|
61
58
|
const url = `${frothUrl}/api/execution-script-mapping/?execution_id=${execution_id}&automation_script_id=${script_id}&platform=${script_platform}`;
|
|
62
59
|
|
|
@@ -100,7 +97,7 @@ async function getExecuitonScriptDetails(frothUrl, token, execution_id, script_i
|
|
|
100
97
|
}
|
|
101
98
|
|
|
102
99
|
async function updateExecuitonDetails(frothUrl, token, id, resultdetails) {
|
|
103
|
-
|
|
100
|
+
if (id != 0) {
|
|
104
101
|
|
|
105
102
|
|
|
106
103
|
const url = `${frothUrl}/api/test-execution-update/${id}/`;
|
|
@@ -148,18 +145,18 @@ async function updateExecuitonDetails(frothUrl, token, id, resultdetails) {
|
|
|
148
145
|
console.error('Error fetching data:', error);
|
|
149
146
|
|
|
150
147
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
148
|
+
} else {
|
|
149
|
+
console.error('Error fetching data: Invalid ID');
|
|
150
|
+
}
|
|
154
151
|
|
|
155
152
|
}
|
|
156
153
|
|
|
157
|
-
async function updateScriptExecutionStatus(frothUrl, token, scriptid,
|
|
154
|
+
async function updateScriptExecutionStatus(frothUrl, token, scriptid,script_platform, status) {
|
|
158
155
|
|
|
159
156
|
if (scriptid != 0) {
|
|
160
157
|
try {
|
|
161
|
-
console.log("script platform is "
|
|
162
|
-
const id = await getExecuitonScriptDetails(frothUrl, token, BUFFER.getItem("FROTH_EXECUTION_ID"), scriptid,
|
|
158
|
+
console.log("script platform is "+script_platform)
|
|
159
|
+
const id = await getExecuitonScriptDetails(frothUrl, token, BUFFER.getItem("FROTH_EXECUTION_ID"), scriptid,script_platform)
|
|
163
160
|
console.log("ID is :" + id)
|
|
164
161
|
const url = `${frothUrl}/api/script-status-percentage/${id}/`;
|
|
165
162
|
const formData = new FormData();
|
|
@@ -185,7 +182,7 @@ async function updateScriptExecutionStatus(frothUrl, token, scriptid, script_pla
|
|
|
185
182
|
// Call login function to obtain a new token
|
|
186
183
|
const newToken = await getLoginToken(BUFFER.getItem("SERVICE_USER"), BUFFER.getItem("SERVICE_PASSWORD")); // You need to implement the login function
|
|
187
184
|
// Retry the request with the new token
|
|
188
|
-
return updateScriptExecutionStatus(frothUrl, newToken, scriptid,
|
|
185
|
+
return updateScriptExecutionStatus(frothUrl, newToken, scriptid,script_platform, status);
|
|
189
186
|
} else {
|
|
190
187
|
const errorText = await response.text();
|
|
191
188
|
console.error(`error in updating the status into DB ${response.status}`);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
const getLoginToken
|
|
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,24 +18,24 @@ 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
|
|
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
|
|
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
|
|
|
@@ -48,7 +48,7 @@ async function getSuiteDetails(frothUrl, token, id) {
|
|
|
48
48
|
else {
|
|
49
49
|
const errorText = await response.text();
|
|
50
50
|
console.error(`Data fetch failed response in getSuiteDetails: ${response.status}`);
|
|
51
|
-
|
|
51
|
+
// throw new Error(`HTTP error! status: ${response.status}`);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
|
|
@@ -8,8 +8,10 @@ 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('
|
|
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);
|
|
13
15
|
|
|
14
16
|
const response = await fetch(url, {
|
|
15
17
|
method: 'POST',
|
|
@@ -7,17 +7,14 @@ let scrollToLeft = null;
|
|
|
7
7
|
let scrollToRight = null;
|
|
8
8
|
let scrollDownToView = null;
|
|
9
9
|
let scrollRightToView = null;
|
|
10
|
-
let scrollUpUntilVisible = null;
|
|
11
10
|
|
|
12
11
|
let swipeRight = null;
|
|
13
12
|
let swipeLeft = null;
|
|
14
13
|
let swipeUp = null;
|
|
15
14
|
let swipeDown = null;
|
|
16
|
-
|
|
17
|
-
let swipeWithCoordinates = null;
|
|
15
|
+
|
|
18
16
|
|
|
19
17
|
let clickIfVisible = null;
|
|
20
|
-
let doubleClick = null;
|
|
21
18
|
|
|
22
19
|
let assertText = null;
|
|
23
20
|
let randomtext = null;
|
|
@@ -38,15 +35,15 @@ let api = null;
|
|
|
38
35
|
|
|
39
36
|
let selectDropDownValue = null;
|
|
40
37
|
|
|
41
|
-
let
|
|
42
|
-
let
|
|
38
|
+
let acceptalert = null;
|
|
39
|
+
let dismissalert = null;
|
|
43
40
|
|
|
44
41
|
let generateJWT=null;
|
|
45
42
|
|
|
46
|
-
if (process.env.LOCATION ==
|
|
43
|
+
if (process.env.LOCATION == 'local') {
|
|
47
44
|
basepath = ".";
|
|
48
45
|
} else {
|
|
49
|
-
basepath = "froth-webdriverio-framework/
|
|
46
|
+
basepath = "froth-webdriverio-framework/commonMethods";
|
|
50
47
|
}
|
|
51
48
|
|
|
52
49
|
scrollToEnd = require(basepath + "/scroll").scrollToEnd;
|
|
@@ -56,19 +53,14 @@ scrollToRight = require(basepath + '/scroll').scrollToRight;
|
|
|
56
53
|
scrollDownToView = require(basepath + '/scroll').scrollDownToView;
|
|
57
54
|
scrollRightToView = require(basepath + '/scroll').scrollRightToView;
|
|
58
55
|
scrollIntoView = require(basepath + '/scroll').scrollIntoView;
|
|
59
|
-
scrollUpUntilVisible = require(basepath + '/scroll').scrollupUntilVisible;
|
|
60
|
-
|
|
61
56
|
|
|
62
57
|
swipeDown = require(basepath + '/swipe').swipedown;
|
|
63
58
|
swipeLeft = require(basepath + '/swipe').swipeleft;
|
|
64
59
|
swipeRight = require(basepath + '/swipe').swiperight;
|
|
65
60
|
swipeUp = require(basepath + '/swipe').swipeup;
|
|
66
|
-
swipetoFit= require(basepath + '/swipe').swipetofit;
|
|
67
|
-
swipeWithCoordinates = require(basepath + '/swipe').swipewithcoordinates;
|
|
68
61
|
|
|
69
62
|
clickIfVisible = require(basepath + "/click").clickIfVisible;
|
|
70
63
|
clickByIdWithExecute = require(basepath + "/click").clickByIdWithExecute;
|
|
71
|
-
doubleClick= require(basepath + "/click").doubleclick;
|
|
72
64
|
|
|
73
65
|
assertText = require(basepath + '/assert').assertText;
|
|
74
66
|
assertAttributeValue = require(basepath + '/assert').assertAttributeValue;
|
|
@@ -90,8 +82,8 @@ validate = require(basepath + '/apicall').validate;
|
|
|
90
82
|
|
|
91
83
|
selectDropDownValue = require(basepath + '/dropDown').select4mDropDownValue;
|
|
92
84
|
|
|
93
|
-
|
|
94
|
-
|
|
85
|
+
acceptalert = require(basepath + '/alert.js').acceptAlert;
|
|
86
|
+
dismissalert = require(basepath + '/alert.js').dismissAlert;
|
|
95
87
|
|
|
96
88
|
generateJWT = require(basepath + '/jwt').generateJWTToken;
|
|
97
89
|
|
|
@@ -105,7 +97,6 @@ module.exports = {
|
|
|
105
97
|
scrollRightToView,
|
|
106
98
|
clickIfVisible,
|
|
107
99
|
clickByIdWithExecute,
|
|
108
|
-
doubleClick,
|
|
109
100
|
assertText,
|
|
110
101
|
assertAttributeValue,
|
|
111
102
|
randomtext,
|
|
@@ -119,17 +110,14 @@ module.exports = {
|
|
|
119
110
|
storevalue,
|
|
120
111
|
storeattributevalue,
|
|
121
112
|
scrollIntoView,
|
|
122
|
-
scrollUpUntilVisible,
|
|
123
113
|
api,
|
|
124
114
|
validate,
|
|
125
115
|
selectDropDownValue,
|
|
126
|
-
|
|
127
|
-
|
|
116
|
+
acceptalert,
|
|
117
|
+
dismissalert,
|
|
128
118
|
swipeLeft,
|
|
129
119
|
swipeRight,
|
|
130
120
|
swipeDown,
|
|
131
121
|
swipeUp,
|
|
132
|
-
swipetoFit,
|
|
133
|
-
swipeWithCoordinates,
|
|
134
122
|
generateJWT
|
|
135
123
|
};
|
|
@@ -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("../api/browsersatckSessionInfo").amend2Browserstack;
|
|
2
2
|
|
|
3
3
|
async function callapi(method, api_url, queryParams, payloaddetails, authentication, headers, attachments) {
|
|
4
4
|
let response;
|
|
@@ -88,14 +88,8 @@ 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
|
-
|
|
94
91
|
} else if (actionname.toLowerCase() == "getbuffer") {
|
|
95
|
-
let annotationMessage = `The vlaue has been retrived from the buffer : ${buffername_value}.`;
|
|
96
|
-
await amendToBrowserstack(annotationMessage, "info");
|
|
97
92
|
return BUFFER.getItem(buffername_value);
|
|
98
|
-
|
|
99
93
|
}
|
|
100
94
|
// } catch (e) {
|
|
101
95
|
// console.error('Error in validate method:', e);
|
|
@@ -115,25 +109,19 @@ async function validateAttributeData(attribute_name, attribute, buffer, bufferna
|
|
|
115
109
|
valueToVerify = Number(valueToVerify);
|
|
116
110
|
} else if (datatype.toLowerCase() == "boolean") {
|
|
117
111
|
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();
|
|
124
112
|
}
|
|
125
113
|
|
|
126
114
|
expect(attribute).toBe(valueToVerify, `${attribute_name} --> Expected value: ${valueToVerify}, but got: ${attribute}`);
|
|
127
115
|
assertionStatus = true; // If assertion passes, set status to true
|
|
128
116
|
|
|
129
|
-
console.log(
|
|
130
|
-
let annotationMessage =
|
|
117
|
+
console.log("verification succeeded.");
|
|
118
|
+
let annotationMessage = `${attribute_name} - verification passed. Actual text: ${attribute}, Expected text: ${valueToVerify}.`;
|
|
131
119
|
await amendToBrowserstack(annotationMessage, "info");
|
|
132
120
|
|
|
133
121
|
} catch (e) {
|
|
134
122
|
console.error('Error in validateAttributeData:', e);
|
|
135
|
-
console.log(
|
|
136
|
-
let annotationMessage =
|
|
123
|
+
console.log(`${attribute_name} verification failed. Expected text: ${valueToVerify}.`);
|
|
124
|
+
let annotationMessage = `${attribute_name} - verification failed. Expected text: ${valueToVerify}.`;
|
|
137
125
|
await amendToBrowserstack(annotationMessage, "error");
|
|
138
126
|
|
|
139
127
|
throw e;
|
|
@@ -20,29 +20,6 @@ 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
|
-
|
|
46
23
|
|
|
47
24
|
async function clickByIdWithExecute(elementid) {
|
|
48
25
|
try {
|
|
@@ -54,4 +31,4 @@ async function clickByIdWithExecute(elementid) {
|
|
|
54
31
|
}
|
|
55
32
|
}
|
|
56
33
|
|
|
57
|
-
module.exports = { clickIfVisible, clickByIdWithExecute
|
|
34
|
+
module.exports = { clickIfVisible, clickByIdWithExecute };
|
|
@@ -54,11 +54,11 @@ 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: "
|
|
57
|
+
id: "janga.reddy@ytlcomms.my"
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
60
|
|
|
61
61
|
console.log('JWT signed token:', generateJWTToken(payload));
|
|
62
62
|
}
|
|
63
|
-
main()
|
|
64
|
-
|
|
63
|
+
//main()
|
|
64
|
+
module.exports = { generateJWTToken}
|
|
@@ -79,26 +79,4 @@ async function scrollIntoView(element){
|
|
|
79
79
|
console.error(error.message);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
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};
|
|
82
|
+
module.exports = { scrollToEnd, scrollToLeft, scrollToBeginning, scrollRightToView, scrollDownToView, scrollToRight ,scrollIntoView};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
async function swipeleft(selector, xoffset, speedinsec) {
|
|
2
|
+
try {
|
|
3
|
+
console.log('Swiping left');
|
|
4
|
+
|
|
5
|
+
if (xoffset == null) {
|
|
6
|
+
driver.swipeLeft(selector, speedinsec);
|
|
7
|
+
} else {
|
|
8
|
+
driver.swipeLeft(selector, xoffset, speedinsec);
|
|
9
|
+
}
|
|
10
|
+
} catch (error) {
|
|
11
|
+
console.error(error.message);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
async function swiperight(selector, xoffset, speedinsec) {
|
|
17
|
+
try {
|
|
18
|
+
console.log('Swiping right');
|
|
19
|
+
|
|
20
|
+
if (xoffset == null) {
|
|
21
|
+
driver.swipeRight(selector, speedinsec);
|
|
22
|
+
} else {
|
|
23
|
+
driver.swipeRight(selector, xoffset, speedinsec);
|
|
24
|
+
}
|
|
25
|
+
} catch (error) {
|
|
26
|
+
console.error(error.message);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async function swipeup(selector, yoffset, speedinsec) {
|
|
32
|
+
try {
|
|
33
|
+
console.log('Swiping up');
|
|
34
|
+
|
|
35
|
+
if (yoffset == null) {
|
|
36
|
+
driver.swipeUp(selector, speedinsec);
|
|
37
|
+
} else {
|
|
38
|
+
driver.swipeUp(selector, yoffset, speedinsec);
|
|
39
|
+
}
|
|
40
|
+
} catch (error) {
|
|
41
|
+
console.error(error.message);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async function swipedown(selector, yoffset, speedinsec) {
|
|
46
|
+
try {
|
|
47
|
+
console.log('Swiping down');
|
|
48
|
+
|
|
49
|
+
if (yoffset == null) {
|
|
50
|
+
driver.swipeDown(selector, speedinsec);
|
|
51
|
+
} else {
|
|
52
|
+
driver.swipeDown(selector, yoffset, speedinsec);
|
|
53
|
+
}
|
|
54
|
+
} catch (error) {
|
|
55
|
+
console.error(error.message);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
module.exports = { swipeleft, swipedown, swiperight, swipeup };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
const deepmerge = require('deepmerge')
|
|
2
|
+
process.env.BROWSERSTACK = true;
|
|
3
|
+
const commonmobileconfig = require('./common.mobile.conf');
|
|
4
|
+
|
|
5
|
+
const androidConfig = deepmerge.all([commonmobileconfig, {
|
|
6
|
+
services: [
|
|
7
|
+
[
|
|
8
|
+
'browserstack',
|
|
9
|
+
{
|
|
10
|
+
// testObservability: true,
|
|
11
|
+
// buildName: "ANDROID BUILD",
|
|
12
|
+
// buildIdentifier: "ANDROID BUILD_" + process.env.BUILD_NUMBER,
|
|
13
|
+
browserstackLocal: process.env.BROWSERSTACK_LOCAL || false,
|
|
14
|
+
opts: {
|
|
15
|
+
forcelocal: false
|
|
16
|
+
},
|
|
17
|
+
app: process.env.BROWSERSTACK_APP_PATH
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
],
|
|
21
|
+
|
|
22
|
+
capabilities: [{
|
|
23
|
+
'bstack:options': {
|
|
24
|
+
projectName: process.env.PROJECTNAME || "roboticodigital",
|
|
25
|
+
|
|
26
|
+
deviceName: process.env.DEVICENAME || 'Samsung Galaxy S23 Ultra',
|
|
27
|
+
platformVersion: process.env.OSVERSION || '13.0',
|
|
28
|
+
platformName: 'android',
|
|
29
|
+
interactiveDebugging: true,
|
|
30
|
+
buildName: process.env.BROWSERSTACK_BUILD_NAME || 'Android_Build',
|
|
31
|
+
networkLogs: "true",
|
|
32
|
+
debug: "true",
|
|
33
|
+
appProfiling: "true",
|
|
34
|
+
//enableCameraImageInjection: true,
|
|
35
|
+
// enableCameraVideoInjection: true,
|
|
36
|
+
deviceOrientation: process.env.DEVICENAME.toLowerCase().includes('tab') ? 'landscape' : 'portrait',
|
|
37
|
+
}
|
|
38
|
+
}],
|
|
39
|
+
before: function (capabilities, specs) {
|
|
40
|
+
process.env.BS_SESSION_TYPE = "app-automate";
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
}]);
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
module.exports = androidConfig;
|
|
48
|
+
|
|
49
|
+
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
const deepmerge = require('deepmerge')
|
|
2
|
+
const commonmobileconfig = require('./common.mobile.conf');
|
|
3
|
+
|
|
4
|
+
const apiconfig = deepmerge.all([commonmobileconfig, {
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
services: [
|
|
8
|
+
['browserstack', {
|
|
9
|
+
|
|
10
|
+
browserstackLocal: process.env.BROWSERSTACK_LOCAL || false,
|
|
11
|
+
opts: {
|
|
12
|
+
forcelocal: false,
|
|
13
|
+
// localIdentifier: "webdriverio-appium"
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
}]
|
|
17
|
+
],
|
|
18
|
+
// ====================
|
|
19
|
+
// Capabilities
|
|
20
|
+
// ====================
|
|
21
|
+
capabilities: [
|
|
22
|
+
{
|
|
23
|
+
'bstack:options': {
|
|
24
|
+
projectName: process.env.PROJECTNAME || "roboticodigital",
|
|
25
|
+
|
|
26
|
+
browserName: process.env.BROWSERSTACK_BROWSER || 'chrome', // Choose the browser you want to test
|
|
27
|
+
browserVersion: process.env.BROWSERSTACK_BROWSER_VERSION || '129', // Specify the browser version
|
|
28
|
+
os: 'Windows', // Specify the operating system
|
|
29
|
+
os_version: '10', // Specify the operating system version
|
|
30
|
+
interactiveDebugging: true,
|
|
31
|
+
buildName: process.env.BROWSERSTACK_BUILD_NAME || 'WEB_Build',
|
|
32
|
+
networkLogs: "true",
|
|
33
|
+
debug: "true",
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
// Add more capabilities for other browsers or devices as needed
|
|
37
|
+
],
|
|
38
|
+
|
|
39
|
+
// ====================
|
|
40
|
+
// Test Configurations
|
|
41
|
+
// ====================
|
|
42
|
+
// logLevel: 'info', // Set the log level
|
|
43
|
+
// bail: 0, // Set to 1 to stop the test suite after the first test failure
|
|
44
|
+
// baseUrl: '', // Specify the base URL of your application
|
|
45
|
+
// waitforTimeout: 90000, // Set the timeout for all waitFor* commands
|
|
46
|
+
// connectionRetryTimeout: 90000, // Set the timeout in milliseconds for test retries
|
|
47
|
+
// connectionRetryCount: 2, // Set the number of times to retry the entire spec file
|
|
48
|
+
|
|
49
|
+
// ====================
|
|
50
|
+
// Framework
|
|
51
|
+
// ====================
|
|
52
|
+
// framework: 'mocha', // Use the Mocha framework
|
|
53
|
+
// reporters: ['spec'
|
|
54
|
+
|
|
55
|
+
// ], // Use the spec reporter
|
|
56
|
+
|
|
57
|
+
// ====================
|
|
58
|
+
// Hooks
|
|
59
|
+
// ====================
|
|
60
|
+
before: function (capabilities, specs) {
|
|
61
|
+
browser.maximizeWindow()
|
|
62
|
+
process.env.BS_SESSION_TYPE = "automate";
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
// // ====================
|
|
68
|
+
// // Mocha Options
|
|
69
|
+
// // ====================
|
|
70
|
+
// mochaOpts: {
|
|
71
|
+
// ui: 'bdd', // Set the test interface to BDD
|
|
72
|
+
// timeout: 90000, // Set the timeout for test cases in milliseconds
|
|
73
|
+
// },
|
|
74
|
+
}]);
|
|
75
|
+
|
|
76
|
+
module.exports = apiconfig;
|