froth-webdriverio-framework 1.0.50 → 1.0.52

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.
@@ -106,14 +106,15 @@ const commonconfig = {
106
106
  console.log('Local storage has been cleared.');
107
107
 
108
108
  },
109
- aftersession: async function (config, capabilities, specs) {
109
+
110
+ afterSession: async function (config, capabilities, specs) {
110
111
 
111
112
  console.log('This is the aftersession hook');
112
113
  await getBSSessionDetails(process.env.BS_SESSION_TYPE, process.env.BROWSERSTACK_USERNAME, Buffer.from(process.env.BROWSERSTACK_ACCESS_KEY, 'base64').toString('utf-8'));
113
114
  const resultdetails = {}
114
115
  resultdetails.excution_status = BUFFER.getItem("RESULT_DATA") === 0 ? 'PASSED' : 'FAILED'
115
116
  console.log("Total Duration:" + BUFFER.getItem("TOTAL_DURATION"));
116
- resultdetails.excution_time = convertMillisecondsToTime(BUFFER.getItem("TOTAL_DURATION"))
117
+ resultdetails.excution_time = await secondsToTime(BUFFER.getItem("TOTAL_DURATION"))
117
118
  exeDetails.updateExecuitonDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("LOGIN_TOKEN"), BUFFER.getItem("EXECUTION_ID"), resultdetails)
118
119
  BUFFER.clear();
119
120
  // Perform any cleanup or post-test actions here
@@ -121,7 +122,7 @@ const commonconfig = {
121
122
 
122
123
  };
123
124
 
124
- function convertMillisecondsToTime(msdata) {
125
+ async function convertMillisecondsToTime(msdata) {
125
126
  const ms = parseInt(msdata.replace('ms', '').trim());
126
127
 
127
128
  let seconds = Math.floor(ms / 1000);
@@ -139,6 +140,18 @@ function convertMillisecondsToTime(msdata) {
139
140
  return `${hours}:${minutes}:${seconds}`;
140
141
  }
141
142
 
143
+ async function secondsToTime(secs) {
144
+ let hours = Math.floor(secs / 3600);
145
+ let minutes = Math.floor((secs % 3600) / 60);
146
+ let seconds = secs % 60;
147
+
148
+ // Adding leading zeros if the value is less than 10
149
+ if (hours < 10) hours = '0' + hours;
150
+ if (minutes < 10) minutes = '0' + minutes;
151
+ if (seconds < 10) seconds = '0' + seconds;
152
+
153
+ return hours + ':' + minutes + ':' + seconds;
154
+ }
142
155
  // async function main() {
143
156
  // try {
144
157
  // const frothUrl = "devapi.frothtestops.com";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "froth-webdriverio-framework",
3
- "version": "1.0.50",
3
+ "version": "1.0.52",
4
4
  "readme": "WebdriverIO Integration",
5
5
  "description": "WebdriverIO and BrowserStack App Automate",
6
6
  "license": "MIT",