froth-webdriverio-framework 7.0.77 → 7.0.78
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.
- package/froth_configs/commonhook.js +40 -48
- package/package.json +1 -1
|
@@ -410,66 +410,58 @@ async function getBrowserStackCapabilities(baseCaps) {
|
|
|
410
410
|
process.env.PLATFORM !== 'browserstacklocal'
|
|
411
411
|
) {
|
|
412
412
|
return baseCaps;
|
|
413
|
-
}
|
|
414
|
-
|
|
413
|
+
}
|
|
415
414
|
|
|
416
415
|
console.log('🟡 Raw Capabilities (Before):');
|
|
417
416
|
console.log(JSON.stringify(baseCaps, null, 2));
|
|
418
|
-
return baseCaps.map(async (capabilities) => {
|
|
419
|
-
const bsOpts = capabilities['bstack:options'] || {};
|
|
420
417
|
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
if (process.env.BS_SESSION_TYPE === 'app-automate') {
|
|
426
|
-
const appPath = process.env.BROWSERSTACK_APP_PATH;
|
|
427
|
-
if (!appPath) {
|
|
428
|
-
await failExecution('BROWSERSTACK_APP_PATH is missing');
|
|
429
|
-
}
|
|
418
|
+
// ✅ Normalize to array
|
|
419
|
+
const isArray = Array.isArray(baseCaps);
|
|
420
|
+
const capsArray = isArray ? baseCaps : [baseCaps];
|
|
430
421
|
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
422
|
+
const updatedCaps = await Promise.all(
|
|
423
|
+
capsArray.map(async (capabilities) => {
|
|
424
|
+
const bsOpts = capabilities['bstack:options'] || {};
|
|
434
425
|
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
bsOpts.osVersion = "12.0"
|
|
438
|
-
bsOpts.networkLogs = 'false';
|
|
439
|
-
bsOpts.debug = 'false';
|
|
440
|
-
process.env.BS_UPLOAD_MEDIA="media://8440f686585de9b46e1c966ce764703836f918bc,media://2952ee7b9b7f0751624b0d4208d7c00b56d4e49b"
|
|
441
|
-
|
|
442
|
-
if (process.env.BS_UPLOAD_MEDIA) {
|
|
443
|
-
bsOpts.uploadMedia = process.env.BS_UPLOAD_MEDIA
|
|
444
|
-
.split(',')
|
|
445
|
-
.map(x => x.trim());
|
|
446
|
-
}
|
|
447
|
-
capabilities['bstack:options'] = bsOpts;
|
|
448
|
-
/** 🔍 Print existing BS options */
|
|
449
|
-
console.log('🟢 Existing bstack:options (Before Modification):');
|
|
450
|
-
console.log(JSON.stringify(bsOpts, null, 2));
|
|
426
|
+
console.log('🟢 Existing bstack:options (Before Modification):');
|
|
427
|
+
console.log(JSON.stringify(bsOpts, null, 2));
|
|
451
428
|
|
|
452
|
-
|
|
453
|
-
|
|
429
|
+
if (process.env.BS_SESSION_TYPE === 'app-automate') {
|
|
430
|
+
const appPath = process.env.BROWSERSTACK_APP_PATH;
|
|
431
|
+
if (!appPath) {
|
|
432
|
+
await failExecution('BROWSERSTACK_APP_PATH is missing');
|
|
433
|
+
}
|
|
454
434
|
|
|
435
|
+
bsOpts.app = appPath;
|
|
436
|
+
capabilities['appium:app'] = appPath;
|
|
437
|
+
}
|
|
455
438
|
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
439
|
+
bsOpts.deviceName = 'Samsung Galaxy S22 Ultra';
|
|
440
|
+
bsOpts.osVersion = '12.0';
|
|
441
|
+
bsOpts.networkLogs = false;
|
|
442
|
+
bsOpts.debug = false;
|
|
443
|
+
|
|
444
|
+
// ⚠️ NEVER assign env vars like this inside code
|
|
445
|
+
// process.env.BS_UPLOAD_MEDIA = "..."
|
|
446
|
+
process.env.BS_UPLOAD_MEDIA = "media://8440f686585de9b46e1c966ce764703836f918bc,media://2952ee7b9b7f0751624b0d4208d7c00b56d4e49b"
|
|
447
|
+
if (process.env.BS_UPLOAD_MEDIA) {
|
|
448
|
+
bsOpts.uploadMedia = process.env.BS_UPLOAD_MEDIA
|
|
449
|
+
.split(',')
|
|
450
|
+
.map(x => x.trim());
|
|
465
451
|
}
|
|
466
|
-
} catch (err) {
|
|
467
|
-
console.warn('⚠️ MEDIA_FILES is not valid JSON', err);
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
baseCaps['bstack:options'] = bsOpts;
|
|
471
452
|
|
|
453
|
+
capabilities['bstack:options'] = bsOpts;
|
|
472
454
|
|
|
455
|
+
console.log('🟢 Existing bstack:options (After Modification):');
|
|
456
|
+
console.log(JSON.stringify(bsOpts, null, 2));
|
|
457
|
+
|
|
458
|
+
return capabilities;
|
|
459
|
+
})
|
|
460
|
+
);
|
|
461
|
+
|
|
462
|
+
// ✅ Return in original shape
|
|
463
|
+
return isArray ? updatedCaps : updatedCaps[0];
|
|
473
464
|
}
|
|
474
465
|
|
|
466
|
+
|
|
475
467
|
module.exports = commonHooks;
|