froth-webdriverio-framework 1.0.43 → 1.0.44
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.
|
@@ -34,9 +34,12 @@ async function getBSSessionDetails(sessiontype,bs_username,bs_pwd) {
|
|
|
34
34
|
|
|
35
35
|
// Accessing the public_url property
|
|
36
36
|
const publicUrl = data.automation_session.public_url;
|
|
37
|
+
const duration=data.automation_session.duration;
|
|
37
38
|
BUFFER.setItem("REPORT_URL",publicUrl)
|
|
39
|
+
BUFFER.setItem("TOTAL_DURATION",duration)
|
|
40
|
+
|
|
38
41
|
console.log("public url : " + publicUrl);
|
|
39
|
-
//
|
|
42
|
+
//return jsondata;
|
|
40
43
|
} else if (response.status === 401) { //
|
|
41
44
|
console.log("Unauthorized, token expired")
|
|
42
45
|
|
|
@@ -9,7 +9,7 @@ async function getExecuitonDetails(frothUrl, token, id) {
|
|
|
9
9
|
|
|
10
10
|
try {
|
|
11
11
|
console.log("URL: " + url)
|
|
12
|
-
console.log("setExecutionDetails token "+token)
|
|
12
|
+
console.log("setExecutionDetails token " + token)
|
|
13
13
|
|
|
14
14
|
const response = await fetch(url, {
|
|
15
15
|
method: 'GET',
|
|
@@ -39,7 +39,7 @@ async function getExecuitonDetails(frothUrl, token, id) {
|
|
|
39
39
|
} else {
|
|
40
40
|
const errorText = await response.text();
|
|
41
41
|
console.error(`Data fetch failed response: ${response.status}`);
|
|
42
|
-
|
|
42
|
+
// throw new Error(`HTTP error! status: ${response.status}`);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
|
|
@@ -57,12 +57,14 @@ async function getExecuitonDetails(frothUrl, token, id) {
|
|
|
57
57
|
async function updateExecuitonDetails(frothUrl, token, id, resultdetails) {
|
|
58
58
|
if (id != 0) {
|
|
59
59
|
const url = `https://${frothUrl}/api/test-execution-update/${id}/`;
|
|
60
|
-
|
|
60
|
+
const formData = new FormData();
|
|
61
61
|
try {
|
|
62
62
|
console.log("resultdetails" + JSON.stringify(resultdetails))
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
|
|
64
|
+
if (resultdetails.excution_status != null)
|
|
65
|
+
formData.append('excution_status', resultdetails.excution_status);
|
|
66
|
+
if (resultdetails.excution_time != null)
|
|
67
|
+
formData.append('excution_time', resultdetails.excution_time);
|
|
66
68
|
formData.append('id', BUFFER.getItem("EXECUTION_ID"))
|
|
67
69
|
formData.append('report_url', BUFFER.getItem("REPORT_URL"))
|
|
68
70
|
|
package/config/commonconfig.js
CHANGED
|
@@ -34,6 +34,8 @@ const commonconfig = {
|
|
|
34
34
|
console.log("Reading test data from the API");
|
|
35
35
|
|
|
36
36
|
getBSSessionDetails( process.env.BS_SESSION_TYPE, process.env.BROWSERSTACK_USERNAME, Buffer.from(process.env.BROWSERSTACK_ACCESS_KEY, 'base64').toString('utf-8'));
|
|
37
|
+
const resultdetails = {};
|
|
38
|
+
exeDetails.updateExecuitonDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("LOGIN_TOKEN"), BUFFER.getItem("EXECUTION_ID"), resultdetails)
|
|
37
39
|
|
|
38
40
|
} catch (e) {
|
|
39
41
|
console.log("Error in beforeSuite:", e);
|
|
@@ -95,19 +97,17 @@ const commonconfig = {
|
|
|
95
97
|
*/
|
|
96
98
|
after: function (result, capabilities, specs) {
|
|
97
99
|
console.log('All tests are done.');
|
|
98
|
-
const resultdata = result === 0 ? 'Pass' : 'Fail';
|
|
99
|
-
console.log(`Result: ${resultdata}`);
|
|
100
|
+
//const resultdata = result === 0 ? 'Pass' : 'Fail';
|
|
101
|
+
//console.log(`Result: ${resultdata}`);
|
|
100
102
|
|
|
101
103
|
const resultdetails = {}
|
|
102
|
-
|
|
104
|
+
getBSSessionDetails( process.env.BS_SESSION_TYPE, process.env.BROWSERSTACK_USERNAME, Buffer.from(process.env.BROWSERSTACK_ACCESS_KEY, 'base64').toString('utf-8'));
|
|
105
|
+
resultdetails.excution_status = result === 0 ? 'PASSED' : 'FAILED'
|
|
106
|
+
console.log("Total Duration:" + BUFFER.getItem("TOTAL_DURATION"));
|
|
103
107
|
resultdetails.excution_time = convertMillisecondsToTime(BUFFER.getItem("TOTAL_DURATION"))
|
|
104
108
|
exeDetails.updateExecuitonDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("LOGIN_TOKEN"), BUFFER.getItem("EXECUTION_ID"), resultdetails)
|
|
105
|
-
|
|
109
|
+
BUFFER.clear();
|
|
106
110
|
console.log('Local storage has been cleared.');
|
|
107
|
-
// console.log('Capabilities:');
|
|
108
|
-
// console.log(capabilities);
|
|
109
|
-
// console.log('Specs:');
|
|
110
|
-
// console.log(specs);
|
|
111
111
|
|
|
112
112
|
},
|
|
113
113
|
|