froth-webdriverio-framework 1.0.42 → 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
- // 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
 
@@ -13,7 +13,8 @@ const androidConfig = deepmerge.all([commonmobileconfig, {
13
13
  buildName: "ANDROID BUILD",
14
14
  buildIdentifier: "ANDROID BUILD_" + process.env.BUILD_NUMBER,
15
15
  browserstackLocal: false,
16
- opts: { forcelocal: false },
16
+ opts: {
17
+ forcelocal: false },
17
18
  app: process.env.BROWSERSTACK_APP_PATH
18
19
  }
19
20
  ]
@@ -28,7 +29,6 @@ const androidConfig = deepmerge.all([commonmobileconfig, {
28
29
  }
29
30
  }],
30
31
  before: function (capabilities, specs) {
31
- // browser.maximizeWindow()
32
32
  process.env.BS_SESSION_TYPE = "app-automate";
33
33
  },
34
34
 
@@ -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
- resultdetails.excution_status = resultdata === 'Pass' ? 'PASSED' : 'FAILED'
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
- // BUFFER.clear();
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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "froth-webdriverio-framework",
3
- "version": "1.0.42",
3
+ "version": "1.0.44",
4
4
  "readme": "WebdriverIO Integration",
5
5
  "description": "WebdriverIO and BrowserStack App Automate",
6
6
  "license": "MIT",