froth-webdriverio-framework 7.0.82 → 7.0.84
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.
|
@@ -47,59 +47,75 @@ console.log('====> PLATFORM NAME :', platformName);
|
|
|
47
47
|
console.log('====> BS SESSION TYPE :', process.env.BS_SESSION_TYPE);
|
|
48
48
|
|
|
49
49
|
|
|
50
|
-
//
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
if (PLATFORM === 'browserstack' || PLATFORM === 'browserstacklocal') {
|
|
64
|
-
envConfig = OS === 'web'
|
|
65
|
-
? require('./browserstack/web.config')
|
|
66
|
-
: require('./browserstack/mobile.config');
|
|
67
|
-
} else {
|
|
68
|
-
envConfig = OS === 'web'
|
|
69
|
-
? require('./local/web.config')
|
|
70
|
-
: require('./local/mobile.config');
|
|
71
|
-
}
|
|
50
|
+
// --------------------
|
|
51
|
+
// Load environment-specific config
|
|
52
|
+
// --------------------
|
|
53
|
+
let envConfigFn;
|
|
54
|
+
if (PLATFORM === 'browserstack' || PLATFORM === 'browserstacklocal') {
|
|
55
|
+
envConfigFn = OS === 'web'
|
|
56
|
+
? require('./browserstack/web.config')
|
|
57
|
+
: require('./browserstack/mobile.config');
|
|
58
|
+
} else {
|
|
59
|
+
envConfigFn = OS === 'web'
|
|
60
|
+
? require('./local/web.config')
|
|
61
|
+
: require('./local/mobile.config');
|
|
62
|
+
}
|
|
72
63
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
64
|
+
// --------------------
|
|
65
|
+
// Function to inject BrowserStack media files into capabilities
|
|
66
|
+
// --------------------
|
|
67
|
+
function getBrowserStackCapabilities(baseCaps) {
|
|
68
|
+
if (!baseCaps) return baseCaps;
|
|
69
|
+
|
|
70
|
+
const isArray = Array.isArray(baseCaps);
|
|
71
|
+
const capsArray = isArray ? baseCaps : [baseCaps];
|
|
72
|
+
|
|
73
|
+
const updatedCaps = capsArray.map((capability) => {
|
|
74
|
+
capability['bstack:options'] = capability['bstack:options'] || {};
|
|
75
|
+
const bsOpts = capability['bstack:options'];
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
// ✅ Inject media from ENV variable
|
|
80
|
+
const bsMediaEnv = process.env.MEDIA_FILES;
|
|
81
|
+
if (bsMediaEnv) {
|
|
82
|
+
try {
|
|
83
|
+
const mediaFiles = JSON.parse(bsMediaEnv);
|
|
84
|
+
if (Array.isArray(mediaFiles)) {
|
|
85
|
+
bsOpts.uploadMedia = mediaFiles;
|
|
86
|
+
console.log('🟢 Uploading media files from ENV:', bsOpts.uploadMedia);
|
|
89
87
|
}
|
|
88
|
+
} catch (err) {
|
|
89
|
+
console.error('❌ Failed to parse BS_UPLOAD_MEDIA env variable:', err.message);
|
|
90
90
|
}
|
|
91
|
+
}
|
|
91
92
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
capability['bstack:options'] = bsOpts;
|
|
94
|
+
return capability;
|
|
95
|
+
});
|
|
95
96
|
|
|
96
|
-
|
|
97
|
-
|
|
97
|
+
return isArray ? updatedCaps : updatedCaps[0];
|
|
98
|
+
}
|
|
98
99
|
|
|
99
|
-
|
|
100
|
+
// --------------------
|
|
101
|
+
// Export WDIO config as async promise (WDIO supports this)
|
|
102
|
+
// --------------------
|
|
103
|
+
exports.config = (async () => {
|
|
104
|
+
// Await your async setup
|
|
105
|
+
await setAllDetails.setExecutionDetails();
|
|
106
|
+
|
|
107
|
+
// Get environment-specific config object
|
|
108
|
+
const envConfigObj = envConfigFn(bsCaps);
|
|
109
|
+
|
|
110
|
+
// Ensure capabilities exist
|
|
111
|
+
envConfigObj.capabilities = getBrowserStackCapabilities(envConfigObj.capabilities, bsCaps);
|
|
100
112
|
|
|
101
113
|
// Merge with base config
|
|
102
|
-
|
|
114
|
+
const finalConfig = deepmerge(baseConfig, envConfigObj);
|
|
115
|
+
|
|
116
|
+
console.log('====> Final merged config ready for WDIO');
|
|
117
|
+
|
|
118
|
+
return finalConfig;
|
|
103
119
|
})();
|
|
104
120
|
// // --------------------
|
|
105
121
|
// // Inject media files into BrowserStack capabilities
|