froth-webdriverio-framework 7.0.69 → 7.0.70
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 +63 -57
- package/package.json +1 -1
|
@@ -104,11 +104,8 @@ const commonHooks = {
|
|
|
104
104
|
await setAllDetails.setExecutionDetails();
|
|
105
105
|
await setAllDetails.setSuiteDetails();
|
|
106
106
|
await setAllDetails.setTestDataDetails();
|
|
107
|
-
|
|
108
|
-
await setupBrowserStackCapabilities(
|
|
109
|
-
|
|
110
|
-
console.log('🚀 Final BrowserStack capabilities (onPrepare):');
|
|
111
|
-
console.log(JSON.stringify(config.capabilities, null, 2));
|
|
107
|
+
/** 2️⃣ Setup BrowserStack */
|
|
108
|
+
await setupBrowserStackCapabilities(capabilities);
|
|
112
109
|
console.log('✅ All Environment Variables:');
|
|
113
110
|
// for (const [key, value] of Object.entries(process.env)) {
|
|
114
111
|
// console.log(`${key} = ${value}`);
|
|
@@ -142,11 +139,14 @@ const commonHooks = {
|
|
|
142
139
|
console.log('==== BEFORE SESSION STARTED ====');
|
|
143
140
|
|
|
144
141
|
try {
|
|
142
|
+
/* 1️⃣ Print full capabilities */
|
|
143
|
+
console.log('🟡 Full capabilities object:');
|
|
144
|
+
console.log(JSON.stringify(capabilities, null, 2));
|
|
145
145
|
/** 1️⃣ Validate syntax */
|
|
146
146
|
await validateTestSyntax(specs);
|
|
147
147
|
|
|
148
|
-
/** 2️⃣ Setup BrowserStack */
|
|
149
|
-
|
|
148
|
+
// /** 2️⃣ Setup BrowserStack */
|
|
149
|
+
// await setupBrowserStackCapabilities(capabilities);
|
|
150
150
|
|
|
151
151
|
console.log('✅ beforeSession completed successfully');
|
|
152
152
|
|
|
@@ -401,70 +401,76 @@ async function setupBrowserStackCapabilities(capabilities) {
|
|
|
401
401
|
) {
|
|
402
402
|
return;
|
|
403
403
|
}
|
|
404
|
+
/* 1️⃣ Print full capabilities */
|
|
405
|
+
console.log('🟡 Full capabilities object:');
|
|
406
|
+
console.log(JSON.stringify(capabilities, null, 2));
|
|
404
407
|
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
process.env.BROWSERSTACK_BUILD_NAME || 'local-build';
|
|
410
|
-
|
|
411
|
-
bsOpts.buildName =
|
|
412
|
-
process.env.BROWSERSTACK_BUILD_DISPLAY_NAME ||
|
|
413
|
-
bsOpts.buildName
|
|
408
|
+
/* 2️⃣ Ensure bstack:options exists */
|
|
409
|
+
if (!capabilities['bstack:options']) {
|
|
410
|
+
capabilities['bstack:options'] = {};
|
|
411
|
+
}
|
|
414
412
|
|
|
413
|
+
let bsOpts = capabilities['bstack:options'];
|
|
415
414
|
|
|
416
|
-
|
|
415
|
+
/* 3️⃣ Print bstack:options as key–value pairs */
|
|
416
|
+
console.log('🟢 bstack:options details:');
|
|
417
|
+
Object.entries(bsOpts).forEach(([key, value]) => {
|
|
418
|
+
console.log(` ${key} : ${JSON.stringify(value)}`);
|
|
419
|
+
});
|
|
420
|
+
/* 4️⃣ Amend / add uploadMedia */
|
|
421
|
+
const uploadMediaList = [
|
|
422
|
+
'media://8440f686585de9b46e1c966ce764703836f918bc'
|
|
423
|
+
];
|
|
424
|
+
bsOpts.uploadMedia = uploadMediaList;
|
|
425
|
+
console.log('🟢 bstack:options after amending details:');
|
|
426
|
+
Object.entries(bsOpts).forEach(([key, value]) => {
|
|
427
|
+
console.log(` ${key} : ${JSON.stringify(value)}`);
|
|
428
|
+
});
|
|
429
|
+
/* 5️⃣ Re-assign (important) */
|
|
430
|
+
capabilities['bstack:options'] = bsOpts;
|
|
431
|
+
/* 6️⃣ Print updated bstack:options */
|
|
432
|
+
console.log('🔵 Updated bstack:options after adding uploadMedia:');
|
|
433
|
+
Object.entries(capabilities['bstack:options']).forEach(([key, value]) => {
|
|
434
|
+
console.log(` ${key} : ${JSON.stringify(value)}`);
|
|
435
|
+
});
|
|
417
436
|
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
437
|
+
/* 7️⃣ Final capabilities print */
|
|
438
|
+
console.log('🟣 Final capabilities sent forward:');
|
|
439
|
+
console.log(JSON.stringify(capabilities, null, 2));
|
|
440
|
+
return capabilities;
|
|
441
|
+
};
|
|
421
442
|
|
|
422
|
-
/** 🔹 Device consistency */
|
|
423
|
-
bsOpts.deviceName = bsOpts.deviceName || capabilities.deviceName;
|
|
424
|
-
bsOpts.osVersion = bsOpts.osVersion || capabilities.osVersion;
|
|
425
443
|
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
444
|
+
/** 🔹 App Automate */
|
|
445
|
+
if (process.env.BS_SESSION_TYPE === 'app-automate') {
|
|
446
|
+
const appPath = process.env.BROWSERSTACK_APP_PATH;
|
|
429
447
|
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
bsOpts.local = true;
|
|
433
|
-
bsOpts.localIdentifier =
|
|
434
|
-
process.env.BROWSERSTACK_LOCAL_IDENTIFIER ||
|
|
435
|
-
`wdio-${process.pid}`;
|
|
448
|
+
if (!appPath) {
|
|
449
|
+
throw new Error('❌ BROWSERSTACK_APP_PATH is missing');
|
|
436
450
|
}
|
|
437
451
|
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
if (!appPath) {
|
|
443
|
-
throw new Error('❌ BROWSERSTACK_APP_PATH is missing');
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
bsOpts.app = appPath;
|
|
447
|
-
capabilities['appium:app'] = appPath;
|
|
448
|
-
}
|
|
452
|
+
bsOpts.app = appPath;
|
|
453
|
+
capabilities['appium:app'] = appPath;
|
|
454
|
+
}
|
|
449
455
|
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
}
|
|
457
|
-
} catch (err) {
|
|
458
|
-
console.warn('⚠️ MEDIA_FILES is not valid JSON', err);
|
|
456
|
+
/** 🔹 Media upload */
|
|
457
|
+
if (process.env.MEDIA_FILES) {
|
|
458
|
+
try {
|
|
459
|
+
const mediaList = JSON.parse(process.env.MEDIA_FILES);
|
|
460
|
+
if (Array.isArray(mediaList) && mediaList.length > 0) {
|
|
461
|
+
bsOpts.uploadMedia = mediaList;
|
|
459
462
|
}
|
|
463
|
+
} catch (err) {
|
|
464
|
+
console.warn('⚠️ MEDIA_FILES is not valid JSON', err);
|
|
460
465
|
}
|
|
466
|
+
}
|
|
461
467
|
|
|
462
|
-
|
|
463
|
-
|
|
468
|
+
/** 🔹 Re-assign */
|
|
469
|
+
capabilities['bstack:options'] = bsOpts;
|
|
464
470
|
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
471
|
+
/** 🔹 Final BS log */
|
|
472
|
+
console.log('🚀 BrowserStack final options:');
|
|
473
|
+
console.log(JSON.stringify(bsOpts, null, 2));
|
|
468
474
|
}
|
|
469
475
|
|
|
470
476
|
async function validateTestSyntax(specs) {
|