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