froth-webdriverio-framework 4.0.44 → 4.0.46

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.
@@ -11,12 +11,12 @@ const { error } = require('console');
11
11
  //const isBrowserStackEnabled = process.env.BROWSERSTACK;
12
12
  let starttime;
13
13
  let endtime;
14
- global.duration_tests = 0;
14
+ let duration_tests = 0;
15
15
  console.log('===== common config===== ');
16
16
  const resultdetails = {
17
17
  comments: [],
18
18
  excution_status: null, // Pass/Fail
19
- excution_time: null, // Execution time in milliseconds
19
+ excution_time: 0, // Execution time in milliseconds
20
20
  };
21
21
  // Description: This file contains the common configuration for the webdriverio framework.
22
22
  const commonconfig = {
@@ -166,7 +166,7 @@ const commonconfig = {
166
166
  console.log('====> Test File Name:', fileName);
167
167
  // BUFFER.setItem("FROTH_TOTAL_DURATION", Number(BUFFER.getItem("FROTH_TOTAL_DURATION")) + duration)
168
168
  console.log(`====> Total Duration for this test: ${duration}ms`);
169
- global.duration_tests += duration;
169
+ duration_tests += duration;
170
170
  console.log(`====> Total Duration for all tests: ${duration_tests}ms`);
171
171
  console.log(`====> Status of test: ${passed}`);
172
172
 
@@ -239,7 +239,7 @@ const commonconfig = {
239
239
  });
240
240
 
241
241
  }
242
-
242
+
243
243
  },
244
244
 
245
245
  afterSession: async function (config, capabilities, specs) {
@@ -260,7 +260,28 @@ const commonconfig = {
260
260
  resultdetails.comments.push(`Execution failed with exit code: ${reason}`);
261
261
  });
262
262
 
263
+ endtime = new Date().getTime();
264
+ let totalDuration = endtime - starttime;
265
+ console.log("====> Total Duration taken for :" + BUFFER.getItem("FROTH_TOTAL_DURATION"));
266
+ console.log("====> Total Duration in after session based on start time and end time:" + totalDuration);
267
+ console.log("====> Total Duration in after session based on summing up the test execution times:" + duration_tests);
268
+
269
+ resultdetails.excution_status = BUFFER.getItem("RESULT_DATA") == 0 ? 'PASSED' : 'FAILED'
270
+
271
+ if(await isValidDuration(BUFFER.getItem("FROTH_TOTAL_DURATION")))
272
+ if(await isValidDuration(duration_tests))
273
+ resultdetails.excution_time = await convertTimetoHHMMSS(totalDuration);
274
+ else
275
+ resultdetails.excution_time = await secondsToTime(duration_tests)
276
+ else
277
+ resultdetails.excution_time = await secondsToTime(BUFFER.getItem("FROTH_TOTAL_DURATION"));
278
+
279
+ console.log("====> Total Duration calculation:" +resultdetails.excution_time);
280
+
281
+ await exeDetails.updateExecuitonDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), BUFFER.getItem("FROTH_EXECUTION_ID"), resultdetails)
282
+
263
283
  // Perform any cleanup or post-test actions here
284
+ BUFFER.clear();
264
285
  },
265
286
 
266
287
  onComplete: async function (exitCode, config, capabilities, results) {
@@ -274,32 +295,17 @@ const commonconfig = {
274
295
  console.log('Execution Time:', results.duration);
275
296
  console.log('Exit Code:', exitCode);
276
297
 
277
- endtime = new Date().getTime();
278
- let totalDuration = endtime - starttime;
279
- console.log("====> Total Duration in after session based on start time and end time:" + totalDuration);
280
- console.log("====> Total Duration in after session based on start time and end time:" + global.duration_tests);
281
-
282
- resultdetails.excution_status = BUFFER.getItem("RESULT_DATA") == 0 ? 'PASSED' : 'FAILED'
283
-
284
- console.log("====> Total Duration calculation:" +
285
- (await isValidDuration(BUFFER.getItem("FROTH_TOTAL_DURATION"))
286
- ? (await isValidDuration(global.duration_tests) ? await convertTimetoHHMMSS(totalDuration) : await secondsToTime(global.duration_tests))
287
- : await secondsToTime(BUFFER.getItem("FROTH_TOTAL_DURATION"))));
288
-
289
- resultdetails.excution_time = await isValidDuration(BUFFER.getItem("FROTH_TOTAL_DURATION"))
290
- ? (await isValidDuration(global.duration_tests) ? await convertTimetoHHMMSS(totalDuration) : await secondsToTime(global.duration_tests))
291
- : await secondsToTime(BUFFER.getItem("FROTH_TOTAL_DURATION"));
292
-
293
- await exeDetails.updateExecuitonDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), BUFFER.getItem("FROTH_EXECUTION_ID"), resultdetails)
294
- BUFFER.clear();
295
-
296
298
  console.log('==== ALL TESTS ARE COMPLETED ====');
297
299
  return exitCode;
298
300
  }
299
301
 
300
302
  };
301
303
  async function isValidDuration(val) {
302
- return val === null || val === 0 || val === undefined;
304
+ console.log("val in isValidDuration:" + val);
305
+ // Check if the value is null, 0, or undefined
306
+ let isValid = val === null || val === 0 || val === undefined;
307
+ console.log("isValid in isValidDuration:" + isValid);
308
+ return isValid;
303
309
  }
304
310
  async function secondsToTime(secs) {
305
311
  console.log("secs in secondsToTime :" + secs);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "froth-webdriverio-framework",
3
- "version": "4.0.44",
3
+ "version": "4.0.46",
4
4
  "readme": "WebdriverIO Integration",
5
5
  "description": "WebdriverIO and BrowserStack App Automate",
6
6
  "license": "MIT",