froth-webdriverio-framework 7.0.83 → 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,62 +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
|
-
|
|
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);
|
|
87
|
+
}
|
|
88
|
+
} catch (err) {
|
|
89
|
+
console.error('❌ Failed to parse BS_UPLOAD_MEDIA env variable:', err.message);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
74
92
|
|
|
75
|
-
|
|
93
|
+
capability['bstack:options'] = bsOpts;
|
|
94
|
+
return capability;
|
|
95
|
+
});
|
|
76
96
|
|
|
97
|
+
return isArray ? updatedCaps : updatedCaps[0];
|
|
98
|
+
}
|
|
77
99
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
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();
|
|
82
106
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
const bsOpts = capability['bstack:options'];
|
|
107
|
+
// Get environment-specific config object
|
|
108
|
+
const envConfigObj = envConfigFn(bsCaps);
|
|
86
109
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
try {
|
|
90
|
-
const mediaFiles = JSON.parse(process.env.MEDIA_FILES);
|
|
91
|
-
if (Array.isArray(mediaFiles)) bsOpts.uploadMedia = mediaFiles;
|
|
92
|
-
} catch (err) {
|
|
93
|
-
console.error('Failed to parse BS_UPLOAD_MEDIA env variable:', err.message);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
110
|
+
// Ensure capabilities exist
|
|
111
|
+
envConfigObj.capabilities = getBrowserStackCapabilities(envConfigObj.capabilities, bsCaps);
|
|
96
112
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
});
|
|
113
|
+
// Merge with base config
|
|
114
|
+
const finalConfig = deepmerge(baseConfig, envConfigObj);
|
|
100
115
|
|
|
101
|
-
|
|
102
|
-
}
|
|
116
|
+
console.log('====> Final merged config ready for WDIO');
|
|
103
117
|
|
|
104
|
-
|
|
105
|
-
return deepmerge(baseConfig, envConfigObj);
|
|
118
|
+
return finalConfig;
|
|
106
119
|
})();
|
|
107
120
|
// // --------------------
|
|
108
121
|
// // Inject media files into BrowserStack capabilities
|