froth-webdriverio-framework 6.0.72 → 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,
@@ -216,16 +216,18 @@ const commonHooks = {
216
216
  },
217
217
 
218
218
  /* ==== AFTER SESSION ==== */
219
- afterSession: async (config, capabilities, specs,exitCode) => {
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,17 +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
 
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);
273
+
274
+ // Add generic failure comment if exitCode != 0 and no comments yet
264
275
  if (exitCode !== 0 && resultdetails.comments.length === 0) {
265
276
  resultdetails.comments.push(`Execution failed with exit code ${exitCode}`);
266
277
  }
267
278
 
279
+ // Update DB
280
+ console.log('📤 Updating DB with final execution details');
281
+ console.log('Status:', resultdetails.excution_status);
282
+ console.log('Duration:', resultdetails.excution_time);
283
+ console.log('Comments:', resultdetails.comments.join('; '));
284
+
268
285
  await safeUpdateExecution();
269
286
  BUFFER.clear();
270
287
 
288
+
271
289
  return exitCode;
272
290
  },
273
291
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "froth-webdriverio-framework",
3
- "version": "6.0.72",
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": {