froth-webdriverio-framework 6.0.63 → 6.0.65
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 +31 -5
- package/package.json +1 -1
|
@@ -53,8 +53,19 @@ async function safeUpdateExecution() {
|
|
|
53
53
|
|
|
54
54
|
/* ----------------- HELPER FUNCTIONS ----------------- */
|
|
55
55
|
function msToTime(ms) {
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
if (!ms || isNaN(ms)) return '00:00:00';
|
|
57
|
+
|
|
58
|
+
let seconds = Math.floor(ms / 1000);
|
|
59
|
+
let hours = Math.floor(seconds / 3600);
|
|
60
|
+
seconds %= 3600;
|
|
61
|
+
let minutes = Math.floor(seconds / 60);
|
|
62
|
+
seconds %= 60;
|
|
63
|
+
|
|
64
|
+
return [
|
|
65
|
+
hours.toString().padStart(2, '0'),
|
|
66
|
+
minutes.toString().padStart(2, '0'),
|
|
67
|
+
seconds.toString().padStart(2, '0')
|
|
68
|
+
].join(':');
|
|
58
69
|
}
|
|
59
70
|
|
|
60
71
|
async function failExecution(reason) {
|
|
@@ -200,16 +211,30 @@ const commonHooks = {
|
|
|
200
211
|
/* ==== AFTER SESSION ==== */
|
|
201
212
|
afterSession: async (config, capabilities, specs, exitCode) => {
|
|
202
213
|
console.log('==== AFTER SESSION ====');
|
|
214
|
+
const endTime = Date.now();
|
|
203
215
|
|
|
204
|
-
|
|
216
|
+
if (!suiteStartTime) {
|
|
217
|
+
suiteStartTime = endTime; // fallback safety
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
const totalTime = Math.max(endTime - suiteStartTime, totalTestDuration);
|
|
205
221
|
resultdetails.excution_status = exitCode === 0 ? 'PASSED' : 'FAILED';
|
|
206
222
|
resultdetails.excution_time = msToTime(Math.max(totalTime, totalTestDuration));
|
|
207
223
|
|
|
208
|
-
|
|
224
|
+
console.log('⏱ Final execution time:', resultdetails.excution_time);
|
|
225
|
+
|
|
226
|
+
resultdetails.excution_status = exitCode === 0 ? 'PASSED' : 'FAILED';
|
|
227
|
+
|
|
209
228
|
if (exitCode !== 0) {
|
|
210
|
-
resultdetails.comments.push(
|
|
229
|
+
resultdetails.comments.push(
|
|
230
|
+
`❌ Execution failed with exit code ${exitCode}`
|
|
231
|
+
);
|
|
211
232
|
}
|
|
212
233
|
|
|
234
|
+
console.log('📤 Updating DB with final execution details');
|
|
235
|
+
console.log('Status:', resultdetails.excution_status);
|
|
236
|
+
console.log('Duration:', resultdetails.excution_time);
|
|
237
|
+
|
|
213
238
|
await safeUpdateExecution();
|
|
214
239
|
BUFFER.clear();
|
|
215
240
|
},
|
|
@@ -237,6 +262,7 @@ const commonHooks = {
|
|
|
237
262
|
onComplete: async (exitCode, _, __, results) => {
|
|
238
263
|
console.log('==== ON COMPLETE ====');
|
|
239
264
|
console.log(`Total: ${results.total}, Passed: ${results.passed}, Failed: ${results.failed}`);
|
|
265
|
+
|
|
240
266
|
return exitCode;
|
|
241
267
|
},
|
|
242
268
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "froth-webdriverio-framework",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.65",
|
|
4
4
|
"readme": "WendriverIO Integration with [BrowserStack](https://www.browserstack.com)",
|
|
5
5
|
"description": "Selenium examples for WebdriverIO and BrowserStack App Automate",
|
|
6
6
|
"scripts": {
|