froth-webdriverio-framework 2.0.47 → 2.0.48

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.
@@ -3,7 +3,8 @@ const { LocalStorage } = require('node-localstorage');
3
3
  global.BUFFER = new LocalStorage('./storage');
4
4
  const path = require('path');
5
5
  const exeDetails = require("../api/getexecutionDetails")
6
- const getBSSessionDetails = require("../api/browsersatckSessionInfo")
6
+ const getBSSessionDetails = require("../api/browsersatckSessionInfo");
7
+ const { time } = require("console");
7
8
  const isBrowserStackEnabled = process.env.BROWSERSTACK;
8
9
  let starttime;
9
10
  let endtime;
@@ -14,7 +15,7 @@ const commonconfig = {
14
15
 
15
16
  onPrepare: async function (capabilities, specs) {
16
17
  // This code runs before the test suite starts
17
- // console.log("organisation url" + process.env.ORGANISATION_DOMAIN_URL);
18
+ starttime = new Date().getTime();
18
19
  await setAllDetails.setEnvVariables();
19
20
  await setAllDetails.setLoginToken();
20
21
  await setAllDetails.setExecutionDetails();
@@ -33,7 +34,6 @@ const commonconfig = {
33
34
  beforeSuite: async function (suite) {
34
35
  try {
35
36
  console.log("Running suite:", suite.title);
36
- starttime = new Date().getTime();
37
37
  // const sessionId = browser.sessionId;
38
38
  // BUFFER.setItem("SESSION_ID", sessionId)
39
39
  if (isBrowserStackEnabled) {
@@ -128,7 +128,7 @@ const commonconfig = {
128
128
  afterSession: async function (config, capabilities, specs) {
129
129
  console.log('This is the aftersession hook');
130
130
  // Perform any cleanup or post-test actions here
131
-
131
+
132
132
  endtime = new Date().getTime();
133
133
  let totalDuration = endtime - starttime;
134
134
  console.log("Total Duration:" + totalDuration);
@@ -137,8 +137,8 @@ const commonconfig = {
137
137
 
138
138
  const resultdetails = {}
139
139
  resultdetails.excution_status = BUFFER.getItem("RESULT_DATA") == 0 ? 'PASSED' : 'FAILED'
140
- console.log("Total Duration:" + BUFFER.getItem("FROTH_TOTAL_DURATION") === 0 ? totalDuration:BUFFER.getItem("FROTH_TOTAL_DURATION"));
141
- resultdetails.excution_time = await secondsToTime(BUFFER.getItem("FROTH_TOTAL_DURATION")=== 0 ? totalDuration:BUFFER.getItem("FROTH_TOTAL_DURATION"))
140
+ console.log("Total Duration:" + BUFFER.getItem("FROTH_TOTAL_DURATION") === 0 ? await convertTimetoHHMMSS(totalDuration) : await secondsToTime(BUFFER.getItem("FROTH_TOTAL_DURATION")));
141
+ resultdetails.excution_time = BUFFER.getItem("FROTH_TOTAL_DURATION") === 0 ? await convertTimetoHHMMSS(totalDuration) : await secondsToTime(BUFFER.getItem("FROTH_TOTAL_DURATION"))
142
142
  await exeDetails.updateExecuitonDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), BUFFER.getItem("FROTH_EXECUTION_ID"), resultdetails)
143
143
  BUFFER.clear();
144
144
  // Perform any cleanup or post-test actions here
@@ -159,4 +159,14 @@ async function secondsToTime(secs) {
159
159
  return hours + ':' + minutes + ':' + seconds;
160
160
  }
161
161
 
162
+ async function convertTimetoHHMMSS(time) {
163
+ const seconds = Math.floor((time / 1000) % 60);
164
+ const minutes = Math.floor((time / (1000 * 60)) % 60);
165
+ const hours = Math.floor((time / (1000 * 60 * 60)) % 24);
166
+ const formattedTime = `${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}`;
167
+
168
+ console.log("Time:" + hours + ':' + minutes + ':' + seconds);
169
+ return formattedTime;
170
+ }
171
+
162
172
  module.exports = commonconfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "froth-webdriverio-framework",
3
- "version": "2.0.47",
3
+ "version": "2.0.48",
4
4
  "readme": "WebdriverIO Integration",
5
5
  "description": "WebdriverIO and BrowserStack App Automate",
6
6
  "license": "MIT",