froth-webdriverio-framework 6.0.73 → 6.0.74

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.
@@ -29,8 +29,8 @@ module.exports = (bsCaps) => {
29
29
  platformName: bsCaps.platformName || 'Android',
30
30
  'bstack:options': {
31
31
  // projectName: 'BrowserStack Samples',
32
- buildName: 'Mobile_Build-',
33
- sessionName: 'Mobile Test',
32
+ // buildName: 'Mobile_Build-',
33
+ // sessionName: 'Mobile Test',
34
34
  deviceName: bsCaps.deviceName || 'Samsung Galaxy S22 Ultra',
35
35
  osVersion: bsCaps.platformVersion || '12.0',
36
36
  debug: bsCaps.debug,
@@ -31,7 +31,7 @@ module.exports = (bsCaps) => {
31
31
  'bstack:options': {
32
32
  os: bsCaps.os,
33
33
  osVersion: bsCaps.osVersion,
34
- buildName: 'Web_Build-',
34
+ // buildName: 'Web_Build-',
35
35
  debug: bsCaps.debug,
36
36
  networkLogs: bsCaps.networkLogs,
37
37
  interactiveDebugging: bsCaps.interactiveDebugging,
@@ -218,14 +218,16 @@ const commonHooks = {
218
218
  /* ==== AFTER SESSION ==== */
219
219
  afterSession: async (config, capabilities, specs, exitCode) => {
220
220
  console.log('==== AFTER SESSION ====');
221
- const endTime = Date.now();
222
- if (!suiteStartTime) suiteStartTime = endTime;
221
+ // Do not calculate time here; we will use WDIO's total duration in onComplete
222
+ console.log('⏱ Leaving execution time calculation for onComplete hook');
223
+ // const endTime = Date.now();
224
+ // if (!suiteStartTime) suiteStartTime = endTime;
223
225
 
224
- const totalTime = Math.max(endTime - suiteStartTime, totalTestDuration);
225
- // resultdetails.excution_status = exitCode === 0 ? 'PASSED' : 'FAILED';
226
- resultdetails.excution_time = msToTime(totalTime);
226
+ // const totalTime = Math.max(endTime - suiteStartTime, totalTestDuration);
227
+ // // resultdetails.excution_status = exitCode === 0 ? 'PASSED' : 'FAILED';
228
+ // resultdetails.excution_time = msToTime(totalTime);
227
229
 
228
- console.log('⏱ Final execution time:', resultdetails.excution_time);
230
+ // console.log('⏱ Final execution time:', resultdetails.excution_time);
229
231
 
230
232
  // console.log('📤 Updating DB with final execution details');
231
233
  // console.log('Status:', resultdetails.excution_status);
@@ -257,40 +259,33 @@ const commonHooks = {
257
259
  /* ========== ON COMPLETE ========== */
258
260
  onComplete: async (exitCode, _, __, results) => {
259
261
  console.log('==== ON COMPLETE ====');
260
- console.log(`Total: ${results.total}, Passed: ${results.passed}, Failed: ${results.failed}`);
262
+ console.log('==== ON COMPLETE ====');
263
+ console.log(`Total: ${results.total || 0}, Passed: ${results.passed || 0}, Failed: ${results.failed || 0}`);
261
264
 
265
+ // Status
262
266
  resultdetails.excution_status = exitCode === 0 ? 'PASSED' : 'FAILED';
263
267
 
264
- if (exitCode !== 0 && resultdetails.comments.length === 0) {
265
- resultdetails.comments.push(`Execution failed with exit code ${exitCode}`);
266
- }
267
- // Set final status
268
- resultdetails.excution_status = exitCode === 0 ? 'PASSED' : 'FAILED';
268
+ // Execution time using WDIO's internal duration (in ms)
269
+ const totalDuration = results._duration || 0;
270
+ resultdetails.excution_time = msToTime(totalDuration);
271
+ console.log('⏱ Final execution time (ms):', totalDuration);
272
+ console.log('⏱ Final execution time (hh:mm:ss):', resultdetails.excution_time);
269
273
 
270
- // If execution failed but no comments, add default comment
274
+ // Add generic failure comment if exitCode != 0 and no comments yet
271
275
  if (exitCode !== 0 && resultdetails.comments.length === 0) {
272
276
  resultdetails.comments.push(`Execution failed with exit code ${exitCode}`);
273
277
  }
274
278
 
275
- // Make sure excution_time is set (if not, fallback)
276
- if (!resultdetails.excution_time || resultdetails.excution_time === 'NaN:NaN:NaN') {
277
- const fallbackTime = totalTestDuration || 0;
278
- resultdetails.excution_time = msToTime(fallbackTime);
279
- }
280
-
279
+ // Update DB
281
280
  console.log('📤 Updating DB with final execution details');
282
281
  console.log('Status:', resultdetails.excution_status);
283
282
  console.log('Duration:', resultdetails.excution_time);
283
+ console.log('Comments:', resultdetails.comments.join('; '));
284
284
 
285
- // await exeDetails.updateExecuitonDetails(
286
- // BUFFER.getItem('ORGANISATION_DOMAIN_URL'),
287
- // BUFFER.getItem('FROTH_LOGIN_TOKEN'),
288
- // BUFFER.getItem('FROTH_EXECUTION_ID'),
289
- // resultdetails
290
- // );
291
285
  await safeUpdateExecution();
292
286
  BUFFER.clear();
293
287
 
288
+
294
289
  return exitCode;
295
290
  },
296
291
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "froth-webdriverio-framework",
3
- "version": "6.0.73",
3
+ "version": "6.0.74",
4
4
  "readme": "WendriverIO Integration with [BrowserStack](https://www.browserstack.com)",
5
5
  "description": "Selenium examples for WebdriverIO and BrowserStack App Automate",
6
6
  "scripts": {