froth-webdriverio-framework 7.0.38 → 7.0.39

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.
@@ -110,6 +110,28 @@ const commonHooks = {
110
110
  }
111
111
  },
112
112
 
113
+ /* ========== ON WORKER ERROR (SESSION / DRIVER FAILURES) ========== */
114
+ onWorkerError: async function (cid, error, specs, retries) {
115
+ console.error('==== ON WORKER ERROR HOOK ====');
116
+ console.error(`Worker ID : ${cid}`);
117
+ console.error(`Specs : ${specs?.join(', ')}`);
118
+ console.error(`Retries : ${retries}`);
119
+ console.error(`Error : ${error?.message}`);
120
+ console.error(error?.stack);
121
+
122
+ // Prevent duplicate updates
123
+ if (executionUpdated) return;
124
+
125
+ const userMessage = await normalizeWdioError(error);
126
+
127
+ resultdetails.excution_status = 'FAILED';
128
+ resultdetails.comments.push(userMessage);
129
+
130
+ await safeUpdateExecution();
131
+ },
132
+ /* ========== ON ERROR ========== */
133
+
134
+
113
135
  /* ========== BEFORE SESSION ========== */
114
136
 
115
137
  beforeSession: async function (config, capabilities, specs) {
@@ -284,7 +306,6 @@ const commonHooks = {
284
306
 
285
307
  },
286
308
 
287
- /* ========== ON ERROR ========== */
288
309
 
289
310
  onError: async function (error) {
290
311
  console.error('==== ON ERROR HOOK ====');
@@ -307,6 +328,11 @@ const commonHooks = {
307
328
  onComplete: async (exitCode, _, __, results) => {
308
329
  console.log('==== ON COMPLETE ====');
309
330
  console.log(`Total: ${results.total || 0}, Passed: ${results.passed || 0}, Failed: ${results.failed || 0}`);
331
+ exitCode = exitCode ?? 0;
332
+ resultdetails.excution_status = exitCode === 0 ? 'PASSED' : 'FAILED';
333
+ resultdetails.comments.push(`WDIO Error: ${error.message}`);
334
+
335
+ await safeUpdateExecution();
310
336
 
311
337
 
312
338
  return exitCode;
@@ -315,5 +341,27 @@ const commonHooks = {
315
341
 
316
342
 
317
343
  };
344
+ async function normalizeWdioError(error) {
345
+ const msg = error?.message || String(error);
346
+
347
+ if (msg.includes('driver.version')) {
348
+ return 'Browser driver could not be initialized. Please verify browser compatibility and driver version.';
349
+ }
350
+
351
+ if (msg.toLowerCase().includes('opera')) {
352
+ return 'Opera browser is unstable on BrowserStack. Please switch to Chrome or Edge.';
353
+ }
354
+
355
+ if (msg.includes('session not created')) {
356
+ return 'Automation session could not be created. Please check browser capabilities.';
357
+ }
358
+
359
+ if (msg.includes('timeout')) {
360
+ return 'Session timed out while initializing the browser.';
361
+ }
362
+
363
+ return `Automation framework error: ${msg}`;
364
+ }
365
+
318
366
 
319
367
  module.exports = commonHooks;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "froth-webdriverio-framework",
3
- "version": "7.0.38",
3
+ "version": "7.0.39",
4
4
  "readme": "WebdriverIO Integration",
5
5
  "description": "WebdriverIO and BrowserStack App Automate",
6
6
  "license": "MIT",