froth-webdriverio-framework 7.0.69 → 7.0.71
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 -53
- 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,39 +401,22 @@ 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
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
bsOpts.projectName = bsOpts.projectName || 'BrowserStack Samples';
|
|
417
|
-
|
|
418
|
-
bsOpts.sessionName =
|
|
419
|
-
process.env.BROWSERSTACK_SESSION_NAME ||
|
|
420
|
-
'BStack WDIO Appium Session';
|
|
421
|
-
|
|
422
|
-
/** 🔹 Device consistency */
|
|
423
|
-
bsOpts.deviceName = bsOpts.deviceName || capabilities.deviceName;
|
|
424
|
-
bsOpts.osVersion = bsOpts.osVersion || capabilities.osVersion;
|
|
408
|
+
/* 2️⃣ Ensure bstack:options exists */
|
|
409
|
+
if (!capabilities['bstack:options']) {
|
|
410
|
+
capabilities['bstack:options'] = {};
|
|
411
|
+
}
|
|
425
412
|
|
|
426
|
-
|
|
427
|
-
bsOpts.debug = bsOpts.debug ?? true;
|
|
428
|
-
bsOpts.networkLogs = bsOpts.networkLogs ?? false;
|
|
413
|
+
let bsOpts = capabilities['bstack:options'];
|
|
429
414
|
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
`wdio-${process.pid}`;
|
|
436
|
-
}
|
|
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
|
+
});
|
|
437
420
|
|
|
438
421
|
/** 🔹 App Automate */
|
|
439
422
|
if (process.env.BS_SESSION_TYPE === 'app-automate') {
|
|
@@ -447,24 +430,28 @@ async function setupBrowserStackCapabilities(capabilities) {
|
|
|
447
430
|
capabilities['appium:app'] = appPath;
|
|
448
431
|
}
|
|
449
432
|
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
/** 🔹 Re-assign */
|
|
433
|
+
/* 4️⃣ Amend / add uploadMedia */
|
|
434
|
+
const uploadMediaList = [
|
|
435
|
+
'media://8440f686585de9b46e1c966ce764703836f918bc'
|
|
436
|
+
];
|
|
437
|
+
bsOpts.uploadMedia = uploadMediaList;
|
|
438
|
+
console.log('🟢 bstack:options after amending details:');
|
|
439
|
+
Object.entries(bsOpts).forEach(([key, value]) => {
|
|
440
|
+
console.log(` ${key} : ${JSON.stringify(value)}`);
|
|
441
|
+
});
|
|
442
|
+
/* 5️⃣ Re-assign (important) */
|
|
463
443
|
capabilities['bstack:options'] = bsOpts;
|
|
444
|
+
/* 6️⃣ Print updated bstack:options */
|
|
445
|
+
console.log('🔵 Updated bstack:options after adding uploadMedia:');
|
|
446
|
+
Object.entries(capabilities['bstack:options']).forEach(([key, value]) => {
|
|
447
|
+
console.log(` ${key} : ${JSON.stringify(value)}`);
|
|
448
|
+
});
|
|
449
|
+
|
|
450
|
+
/* 7️⃣ Final capabilities print */
|
|
451
|
+
console.log('🟣 Final capabilities sent forward:');
|
|
452
|
+
console.log(JSON.stringify(capabilities, null, 2));
|
|
453
|
+
return capabilities;
|
|
464
454
|
|
|
465
|
-
/** 🔹 Final BS log */
|
|
466
|
-
console.log('🚀 BrowserStack final options:');
|
|
467
|
-
console.log(JSON.stringify(bsOpts, null, 2));
|
|
468
455
|
}
|
|
469
456
|
|
|
470
457
|
async function validateTestSyntax(specs) {
|