froth-webdriverio-framework 1.0.43 → 1.0.45

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
- // return jsondata;
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
- // throw new Error(`HTTP error! status: ${response.status}`);
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
- const formData = new FormData();
64
- formData.append('excution_status', resultdetails.excution_status);
65
- formData.append('excution_time', resultdetails.excution_time);
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
 
@@ -33,8 +33,6 @@ const commonconfig = {
33
33
  console.log("Running suite:", suite.title);
34
34
  console.log("Reading test data from the API");
35
35
 
36
- getBSSessionDetails( process.env.BS_SESSION_TYPE, process.env.BROWSERSTACK_USERNAME, Buffer.from(process.env.BROWSERSTACK_ACCESS_KEY, 'base64').toString('utf-8'));
37
-
38
36
  } catch (e) {
39
37
  console.log("Error in beforeSuite:", e);
40
38
  }
@@ -48,6 +46,11 @@ const commonconfig = {
48
46
  beforeTest: function (test, context) {
49
47
  console.log("Test Name:", test.title);
50
48
  console.log("File Name:", test.file);
49
+
50
+ getBSSessionDetails( process.env.BS_SESSION_TYPE, process.env.BROWSERSTACK_USERNAME, Buffer.from(process.env.BROWSERSTACK_ACCESS_KEY, 'base64').toString('utf-8'));
51
+ const resultdetails = {};
52
+ exeDetails.updateExecuitonDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("LOGIN_TOKEN"), BUFFER.getItem("EXECUTION_ID"), resultdetails)
53
+
51
54
 
52
55
  },
53
56
 
@@ -95,19 +98,17 @@ const commonconfig = {
95
98
  */
96
99
  after: function (result, capabilities, specs) {
97
100
  console.log('All tests are done.');
98
- const resultdata = result === 0 ? 'Pass' : 'Fail';
99
- console.log(`Result: ${resultdata}`);
101
+ //const resultdata = result === 0 ? 'Pass' : 'Fail';
102
+ //console.log(`Result: ${resultdata}`);
100
103
 
101
104
  const resultdetails = {}
102
- resultdetails.excution_status = resultdata === 'Pass' ? 'PASSED' : 'FAILED'
105
+ getBSSessionDetails( process.env.BS_SESSION_TYPE, process.env.BROWSERSTACK_USERNAME, Buffer.from(process.env.BROWSERSTACK_ACCESS_KEY, 'base64').toString('utf-8'));
106
+ resultdetails.excution_status = result === 0 ? 'PASSED' : 'FAILED'
107
+ console.log("Total Duration:" + BUFFER.getItem("TOTAL_DURATION"));
103
108
  resultdetails.excution_time = convertMillisecondsToTime(BUFFER.getItem("TOTAL_DURATION"))
104
109
  exeDetails.updateExecuitonDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("LOGIN_TOKEN"), BUFFER.getItem("EXECUTION_ID"), resultdetails)
105
- // BUFFER.clear();
110
+ BUFFER.clear();
106
111
  console.log('Local storage has been cleared.');
107
- // console.log('Capabilities:');
108
- // console.log(capabilities);
109
- // console.log('Specs:');
110
- // console.log(specs);
111
112
 
112
113
  },
113
114
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "froth-webdriverio-framework",
3
- "version": "1.0.43",
3
+ "version": "1.0.45",
4
4
  "readme": "WebdriverIO Integration",
5
5
  "description": "WebdriverIO and BrowserStack App Automate",
6
6
  "license": "MIT",