froth-webdriverio-framework 4.0.43 → 4.0.45

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,7 +11,7 @@ const { error } = require('console');
11
11
  //const isBrowserStackEnabled = process.env.BROWSERSTACK;
12
12
  let starttime;
13
13
  let endtime;
14
- let duration_tests=0;
14
+ let duration_tests = 0;
15
15
  console.log('===== common config===== ');
16
16
  const resultdetails = {
17
17
  comments: [],
@@ -144,7 +144,7 @@ const commonconfig = {
144
144
 
145
145
  console.log('==== BEFORE TEST HOOK ====');
146
146
  console.log(`====> Test Started '${test.title}'`);
147
-
147
+
148
148
  },
149
149
 
150
150
 
@@ -173,7 +173,7 @@ const commonconfig = {
173
173
  let scriptresult = "NOT RUN";
174
174
  // Default assumption: test passed (unless soft assertion failed)
175
175
  let finalPassed = passed;
176
-
176
+
177
177
  if (passed) {
178
178
  scriptresult = "PASSED"
179
179
  resultdetails.comments.push(`${test.title} - passed`);
@@ -200,7 +200,7 @@ const commonconfig = {
200
200
  jwtScript.scriptId,
201
201
  jwtScript.platform.toLowerCase(),
202
202
  scriptresult)
203
-
203
+
204
204
 
205
205
  },
206
206
  /**
@@ -248,7 +248,7 @@ const commonconfig = {
248
248
  // console.log("Capabilities:", capabilities);
249
249
  console.log("Specs:", specs);
250
250
  //console.log("Config:", config);
251
-
251
+
252
252
  process.on('uncaughtException', (err) => {
253
253
  console.error("Uncaught Exception:", err);
254
254
  resultdetails.comments.push(`Execution failed with exit code: ${err}`);
@@ -260,7 +260,26 @@ 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 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
+
268
+ resultdetails.excution_status = BUFFER.getItem("RESULT_DATA") == 0 ? 'PASSED' : 'FAILED'
269
+
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"))));
274
+
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"));
278
+
279
+ await exeDetails.updateExecuitonDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), BUFFER.getItem("FROTH_EXECUTION_ID"), resultdetails)
280
+
263
281
  // Perform any cleanup or post-test actions here
282
+ BUFFER.clear();
264
283
  },
265
284
 
266
285
  onComplete: async function (exitCode, config, capabilities, results) {
@@ -274,32 +293,13 @@ const commonconfig = {
274
293
  console.log('Execution Time:', results.duration);
275
294
  console.log('Exit Code:', exitCode);
276
295
 
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:" + 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(duration_tests) ? await convertTimetoHHMMSS(totalDuration) : await secondsToTime(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(duration_tests) ? await convertTimetoHHMMSS(totalDuration) : await secondsToTime(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
296
  console.log('==== ALL TESTS ARE COMPLETED ====');
297
297
  return exitCode;
298
298
  }
299
299
 
300
300
  };
301
301
  async function isValidDuration(val) {
302
- return val === null && val === 0 && val === undefined;
302
+ return val === null || val === 0 || val === undefined;
303
303
  }
304
304
  async function secondsToTime(secs) {
305
305
  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.43",
3
+ "version": "4.0.45",
4
4
  "readme": "WebdriverIO Integration",
5
5
  "description": "WebdriverIO and BrowserStack App Automate",
6
6
  "license": "MIT",