froth-webdriverio-framework 4.0.45 → 4.0.47

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.
@@ -262,20 +262,30 @@ const commonconfig = {
262
262
 
263
263
  endtime = new Date().getTime();
264
264
  let totalDuration = endtime - starttime;
265
+ console.log("====> Total Duration taken for :" + BUFFER.getItem("FROTH_TOTAL_DURATION"));
265
266
  console.log("====> Total Duration in after session based on start time and end time:" + totalDuration);
266
- console.log("====> Total Duration in after session based on start time and end time:" + duration_tests);
267
+ console.log("====> Total Duration in after session based on summing up the test execution times:" + duration_tests);
267
268
 
268
269
  resultdetails.excution_status = BUFFER.getItem("RESULT_DATA") == 0 ? 'PASSED' : 'FAILED'
270
+ const frothDuration = BUFFER.getItem("FROTH_TOTAL_DURATION");
269
271
 
270
- console.log("====> Total Duration calculation:" +
271
- (await isValidDuration(BUFFER.getItem("FROTH_TOTAL_DURATION"))
272
- ? (await isValidDuration(duration_tests) ? await convertTimetoHHMMSS(totalDuration) : await secondsToTime(duration_tests))
273
- : await secondsToTime(BUFFER.getItem("FROTH_TOTAL_DURATION"))));
272
+ if(await isInvalidDuration(frothDuration)){
273
+ console.log("inside froth duration");
274
+ if (await isInvalidDuration(duration_tests)) {
275
+ console.log("inside froth duration_tests");
274
276
 
275
- resultdetails.excution_time = await isValidDuration(BUFFER.getItem("FROTH_TOTAL_DURATION"))
276
- ? (await isValidDuration(duration_tests) ? await convertTimetoHHMMSS(totalDuration) : await secondsToTime(duration_tests))
277
- : await secondsToTime(BUFFER.getItem("FROTH_TOTAL_DURATION"));
277
+ resultdetails.excution_time = await convertTimetoHHMMSS(totalDuration);
278
+ } else {
279
+ console.log("inside froth totalDuration");
280
+ resultdetails.excution_time = await millisecondsToTime(duration_tests);
281
+ }
282
+ } else {
283
+ console.log("inside froth duration else");
284
+ resultdetails.excution_time = await secondsToTime(frothDuration);
285
+ }
278
286
 
287
+ console.log("====> Total Duration calculation:" +resultdetails.excution_time);
288
+
279
289
  await exeDetails.updateExecuitonDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), BUFFER.getItem("FROTH_EXECUTION_ID"), resultdetails)
280
290
 
281
291
  // Perform any cleanup or post-test actions here
@@ -298,8 +308,12 @@ const commonconfig = {
298
308
  }
299
309
 
300
310
  };
301
- async function isValidDuration(val) {
302
- return val === null || val === 0 || val === undefined;
311
+ async function isInvalidDuration(val) {
312
+ console.log("val in isValidDuration:" + val);
313
+ // Check if the value is null, 0, or undefined
314
+ let isValid = val === null || val === 0 || val === undefined;
315
+ console.log("isValid in isValidDuration:" + isValid);
316
+ return isValid;
303
317
  }
304
318
  async function secondsToTime(secs) {
305
319
  console.log("secs in secondsToTime :" + secs);
@@ -314,6 +328,29 @@ async function secondsToTime(secs) {
314
328
  console.log("Time:" + hours + ':' + minutes + ':' + seconds);
315
329
  return hours + ':' + minutes + ':' + seconds;
316
330
  }
331
+ async function millisecondsToTime(ms) {
332
+ console.log("ms in millisecondsToTime: " + ms);
333
+
334
+ // Ensure input is a number
335
+ ms = Number(ms);
336
+ if (isNaN(ms)) {
337
+ return '00:00:00';
338
+ }
339
+
340
+ let totalSeconds = Math.floor(ms / 1000);
341
+ let hours = Math.floor(totalSeconds / 3600);
342
+ let minutes = Math.floor((totalSeconds % 3600) / 60);
343
+ let seconds = totalSeconds % 60;
344
+
345
+ // Pad with leading zeros
346
+ hours = hours < 10 ? '0' + hours : hours;
347
+ minutes = minutes < 10 ? '0' + minutes : minutes;
348
+ seconds = seconds < 10 ? '0' + seconds : seconds;
349
+
350
+ const timeStr = `${hours}:${minutes}:${seconds}`;
351
+ console.log("Formatted time:", timeStr);
352
+ return timeStr;
353
+ }
317
354
 
318
355
  async function convertTimetoHHMMSS(time) {
319
356
  const seconds = Math.floor((time / 1000) % 60);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "froth-webdriverio-framework",
3
- "version": "4.0.45",
3
+ "version": "4.0.47",
4
4
  "readme": "WebdriverIO Integration",
5
5
  "description": "WebdriverIO and BrowserStack App Automate",
6
6
  "license": "MIT",