froth-webdriverio-framework 1.0.56 → 1.0.58
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/browsersatckSessionInfo.js +2 -4
- package/api/getexecutionDetails.js +6 -10
- package/api/getsuiteDetails.js +2 -2
- package/api/loginapi.js +1 -1
- package/config/common.mobile.conf.js +1 -3
- package/config/commonconfig.js +3 -25
- package/config/ios.conf.js +1 -2
- package/config/setallDatailinBuffer.js +0 -2
- package/package.json +1 -1
|
@@ -21,7 +21,6 @@ async function getBSSessionDetails(sessiontype,bs_username,bs_pwd) {
|
|
|
21
21
|
|
|
22
22
|
if (response.ok) {
|
|
23
23
|
const data = await response.json();
|
|
24
|
-
console.log('Session Info:', data);
|
|
25
24
|
|
|
26
25
|
// Accessing the public_url property
|
|
27
26
|
const publicUrl = data.automation_session.public_url;
|
|
@@ -29,15 +28,14 @@ async function getBSSessionDetails(sessiontype,bs_username,bs_pwd) {
|
|
|
29
28
|
BUFFER.setItem("REPORT_URL",publicUrl)
|
|
30
29
|
BUFFER.setItem("TOTAL_DURATION",duration)
|
|
31
30
|
|
|
32
|
-
console.log("public url : " + publicUrl);
|
|
33
31
|
//return jsondata;
|
|
34
32
|
} else if (response.status === 401) { //
|
|
35
33
|
console.log("Unauthorized, token expired")
|
|
36
34
|
|
|
37
35
|
} else {
|
|
38
36
|
const errorText = await response.text();
|
|
39
|
-
console.error(
|
|
40
|
-
|
|
37
|
+
console.error(`Data fetch failed response:${response.status}`);
|
|
38
|
+
// throw new Error(`HTTP error! status: ${response.status}`);
|
|
41
39
|
}
|
|
42
40
|
|
|
43
41
|
|
|
@@ -9,7 +9,6 @@ async function getExecuitonDetails(frothUrl, token, id) {
|
|
|
9
9
|
|
|
10
10
|
try {
|
|
11
11
|
console.log("URL: " + url)
|
|
12
|
-
console.log("setExecutionDetails token " + token)
|
|
13
12
|
|
|
14
13
|
const response = await fetch(url, {
|
|
15
14
|
method: 'GET',
|
|
@@ -21,14 +20,14 @@ async function getExecuitonDetails(frothUrl, token, id) {
|
|
|
21
20
|
});
|
|
22
21
|
if (response.ok) {
|
|
23
22
|
const data = await response.json();
|
|
24
|
-
|
|
23
|
+
// console.log(data)
|
|
25
24
|
jsondata.automation_suite_id = data.automation_suite_id;
|
|
26
25
|
jsondata.test_cycle_id = data.test_cycle_id;
|
|
27
26
|
if (data.testcycle_type === "Android" || data.testcycle_type === "Ios") {
|
|
28
27
|
jsondata.device_name = data.device_name
|
|
29
28
|
jsondata.version = data.version
|
|
30
29
|
}
|
|
31
|
-
|
|
30
|
+
// console.log("json data :" + JSON.stringify(jsondata));
|
|
32
31
|
|
|
33
32
|
return jsondata;
|
|
34
33
|
} else if (response.status === 401) { // Unauthorized, token expired
|
|
@@ -60,15 +59,12 @@ async function updateExecuitonDetails(frothUrl, token, id, resultdetails) {
|
|
|
60
59
|
const formData = new FormData();
|
|
61
60
|
try {
|
|
62
61
|
console.log("URL" + url)
|
|
63
|
-
|
|
64
|
-
console.log("resultdetails" + token)
|
|
62
|
+
|
|
65
63
|
|
|
66
64
|
if (resultdetails != null) {
|
|
67
|
-
console.log("resultdetails" + resultdetails.excution_status)
|
|
68
65
|
formData.append('excution_status', resultdetails.excution_status);
|
|
69
66
|
}
|
|
70
67
|
if (resultdetails.excution_time != null) {
|
|
71
|
-
console.log("excution_time" + resultdetails.excution_time)
|
|
72
68
|
formData.append('excution_time', resultdetails.excution_time);
|
|
73
69
|
}
|
|
74
70
|
formData.append('id', BUFFER.getItem("EXECUTION_ID"))
|
|
@@ -85,7 +81,7 @@ async function updateExecuitonDetails(frothUrl, token, id, resultdetails) {
|
|
|
85
81
|
|
|
86
82
|
if (response.ok) {
|
|
87
83
|
const data = await response.json();
|
|
88
|
-
|
|
84
|
+
// console.log("data is :"+data)
|
|
89
85
|
|
|
90
86
|
} else if (response.status === 401) { // Unauthorized, token expired
|
|
91
87
|
// Call login function to obtain a new token
|
|
@@ -94,8 +90,8 @@ async function updateExecuitonDetails(frothUrl, token, id, resultdetails) {
|
|
|
94
90
|
return updateExecuitonDetails(frothUrl, newToken, id, resultdetails);
|
|
95
91
|
} else {
|
|
96
92
|
const errorText = await response.text();
|
|
97
|
-
console.error(
|
|
98
|
-
|
|
93
|
+
console.error(`Data fetch failed response: ${response.status}`);
|
|
94
|
+
// throw new Error(`HTTP error! status: ${response.status}`);
|
|
99
95
|
}
|
|
100
96
|
|
|
101
97
|
|
package/api/getsuiteDetails.js
CHANGED
|
@@ -17,12 +17,12 @@ async function getSuiteDetails(frothUrl, token, id) {
|
|
|
17
17
|
});
|
|
18
18
|
if (response.ok) {
|
|
19
19
|
const data = await response.json();
|
|
20
|
-
|
|
20
|
+
// console.log(data)
|
|
21
21
|
jsondata.automation_suite_id = data.id;
|
|
22
22
|
jsondata.automation_suite_name = data.automation_suite_name;
|
|
23
23
|
jsondata.test_data_id = data.test_data_id;
|
|
24
24
|
jsondata.browser_stack_urls = data.browser_stack_urls;
|
|
25
|
-
|
|
25
|
+
// console.log("json data :" + JSON.stringify(jsondata));
|
|
26
26
|
|
|
27
27
|
return jsondata;
|
|
28
28
|
|
package/api/loginapi.js
CHANGED
|
@@ -20,7 +20,7 @@ async function getLoginToken(frothUrl, email, password) {
|
|
|
20
20
|
|
|
21
21
|
if (response.ok) {
|
|
22
22
|
const data = await response.json();
|
|
23
|
-
|
|
23
|
+
// console.log('Token:', data.access_token);
|
|
24
24
|
return data.access_token;
|
|
25
25
|
} else {
|
|
26
26
|
console.error('Login failed:', response.statusText);
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
const deepmerge = require('deepmerge')
|
|
2
2
|
const commonconfig = require('./commonconfig');
|
|
3
|
-
console.log("device name in common mobile:", process.env.BROWSERSTACK_ACCESS_KEY);
|
|
4
|
-
console.log("device name in common mobile:", Buffer.from(process.env.BROWSERSTACK_ACCESS_KEY, 'base64').toString('utf-8'));
|
|
5
|
-
console.log("device name in common mobile:", process.env.BROWSERSTACK_USERNAME);
|
|
6
3
|
|
|
7
4
|
const commonmobconfig = deepmerge.all([commonconfig, {
|
|
8
5
|
|
|
@@ -32,6 +29,7 @@ const commonmobconfig = deepmerge.all([commonconfig, {
|
|
|
32
29
|
commonCapabilities: {
|
|
33
30
|
'bstack:options': {
|
|
34
31
|
projectName: process.env.PROJECTNAME || "roboticodigital",
|
|
32
|
+
buildName: "Automation Build_"+process.env.BUILD_NUMBER,
|
|
35
33
|
sessionName: 'Automation test session',
|
|
36
34
|
debug: true,
|
|
37
35
|
networkLogs: true
|
package/config/commonconfig.js
CHANGED
|
@@ -18,7 +18,7 @@ const commonconfig = {
|
|
|
18
18
|
// await setAllDetails.setIntegrationsDetails();
|
|
19
19
|
await setAllDetails.setSuiteDetails();
|
|
20
20
|
await setAllDetails.setTestDataDetails();
|
|
21
|
-
|
|
21
|
+
// console.log("ALL JSON DATA in env variable :" + JSON.stringify(process.env));
|
|
22
22
|
},
|
|
23
23
|
|
|
24
24
|
|
|
@@ -31,9 +31,8 @@ const commonconfig = {
|
|
|
31
31
|
console.log("Running suite:", suite.title);
|
|
32
32
|
const sessionId = browser.sessionId;
|
|
33
33
|
BUFFER.setItem("SESSION_ID", sessionId)
|
|
34
|
-
console.log('Session ID: ' + BUFFER.getItem("SESSION_ID"));
|
|
35
34
|
await getBSSessionDetails(process.env.BS_SESSION_TYPE, process.env.BROWSERSTACK_USERNAME, Buffer.from(process.env.BROWSERSTACK_ACCESS_KEY, 'base64').toString('utf-8'));
|
|
36
|
-
|
|
35
|
+
// console.log("ALL JSON DATA IN BUFFER:" + JSON.stringify(BUFFER));
|
|
37
36
|
const resultdetails = {};
|
|
38
37
|
exeDetails.updateExecuitonDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("LOGIN_TOKEN"), BUFFER.getItem("EXECUTION_ID"), resultdetails)
|
|
39
38
|
|
|
@@ -49,7 +48,7 @@ const commonconfig = {
|
|
|
49
48
|
*/
|
|
50
49
|
beforeTest: function (test, context) {
|
|
51
50
|
console.log("Test Name:", test.title);
|
|
52
|
-
|
|
51
|
+
// console.log("File Name:", test.file);
|
|
53
52
|
|
|
54
53
|
},
|
|
55
54
|
|
|
@@ -102,9 +101,6 @@ const commonconfig = {
|
|
|
102
101
|
// const resultdata = result === 0 ? 'PASSED' : 'FAILED'
|
|
103
102
|
BUFFER.setItem("RESULT_DATA", result);
|
|
104
103
|
|
|
105
|
-
|
|
106
|
-
console.log('Local storage has been cleared.');
|
|
107
|
-
|
|
108
104
|
},
|
|
109
105
|
|
|
110
106
|
afterSession: async function (config, capabilities, specs) {
|
|
@@ -122,24 +118,6 @@ const commonconfig = {
|
|
|
122
118
|
|
|
123
119
|
};
|
|
124
120
|
|
|
125
|
-
async function convertMillisecondsToTime(msdata) {
|
|
126
|
-
const ms = parseInt(msdata.replace('ms', '').trim());
|
|
127
|
-
|
|
128
|
-
let seconds = Math.floor(ms / 1000);
|
|
129
|
-
let minutes = Math.floor(seconds / 60);
|
|
130
|
-
let hours = Math.floor(minutes / 60);
|
|
131
|
-
|
|
132
|
-
seconds = seconds % 60;
|
|
133
|
-
minutes = minutes % 60;
|
|
134
|
-
|
|
135
|
-
// Pad the values with leading zeros if they are less than 10
|
|
136
|
-
hours = String(hours).padStart(2, '0');
|
|
137
|
-
minutes = String(minutes).padStart(2, '0');
|
|
138
|
-
seconds = String(seconds).padStart(2, '0');
|
|
139
|
-
|
|
140
|
-
return `${hours}:${minutes}:${seconds}`;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
121
|
async function secondsToTime(secs) {
|
|
144
122
|
let hours = Math.floor(secs / 3600);
|
|
145
123
|
let minutes = Math.floor((secs % 3600) / 60);
|
package/config/ios.conf.js
CHANGED
|
@@ -7,8 +7,7 @@ const iosconfig = deepmerge.all([commonmobileconfig, {
|
|
|
7
7
|
'browserstack',
|
|
8
8
|
{
|
|
9
9
|
testObservability: true,
|
|
10
|
-
|
|
11
|
-
buildIdentifier: 'BUILD_'+process.env.BUILD_NUMBER,
|
|
10
|
+
buildIdentifier: `#${process.env.BUILD_NUMBER}`,
|
|
12
11
|
browserstackLocal: false,
|
|
13
12
|
opts: {
|
|
14
13
|
forcelocal: false,
|
|
@@ -50,12 +50,10 @@ async function setEnvVariables() {
|
|
|
50
50
|
|
|
51
51
|
async function setLoginToken() {
|
|
52
52
|
try {
|
|
53
|
-
console.log("setting all login token ")
|
|
54
53
|
|
|
55
54
|
const getToken = await getLoginToken(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("SERVICE_USER"), BUFFER.getItem("SERVICE_PASSWORD"));
|
|
56
55
|
process.env.LOGIN_TOKEN = getToken;
|
|
57
56
|
BUFFER.setItem("LOGIN_TOKEN", getToken)
|
|
58
|
-
console.log("setting all login token " + BUFFER.getItem("LOGIN_TOKEN"))
|
|
59
57
|
|
|
60
58
|
} catch (error) {
|
|
61
59
|
// console.error('Error in main function:', error);
|