froth-webdriverio-framework 4.0.42 → 4.0.44
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/commonconfig.js +22 -16
- package/package.json +1 -1
|
@@ -11,7 +11,7 @@ const { error } = require('console');
|
|
|
11
11
|
//const isBrowserStackEnabled = process.env.BROWSERSTACK;
|
|
12
12
|
let starttime;
|
|
13
13
|
let endtime;
|
|
14
|
-
|
|
14
|
+
global.duration_tests = 0;
|
|
15
15
|
console.log('===== common config===== ');
|
|
16
16
|
const resultdetails = {
|
|
17
17
|
comments: [],
|
|
@@ -144,7 +144,7 @@ const commonconfig = {
|
|
|
144
144
|
|
|
145
145
|
console.log('==== BEFORE TEST HOOK ====');
|
|
146
146
|
console.log(`====> Test Started '${test.title}'`);
|
|
147
|
-
|
|
147
|
+
|
|
148
148
|
},
|
|
149
149
|
|
|
150
150
|
|
|
@@ -166,14 +166,14 @@ const commonconfig = {
|
|
|
166
166
|
console.log('====> Test File Name:', fileName);
|
|
167
167
|
// BUFFER.setItem("FROTH_TOTAL_DURATION", Number(BUFFER.getItem("FROTH_TOTAL_DURATION")) + duration)
|
|
168
168
|
console.log(`====> Total Duration for this test: ${duration}ms`);
|
|
169
|
-
duration_tests += duration;
|
|
169
|
+
global.duration_tests += duration;
|
|
170
170
|
console.log(`====> Total Duration for all tests: ${duration_tests}ms`);
|
|
171
171
|
console.log(`====> Status of test: ${passed}`);
|
|
172
172
|
|
|
173
173
|
let scriptresult = "NOT RUN";
|
|
174
174
|
// Default assumption: test passed (unless soft assertion failed)
|
|
175
175
|
let finalPassed = passed;
|
|
176
|
-
|
|
176
|
+
|
|
177
177
|
if (passed) {
|
|
178
178
|
scriptresult = "PASSED"
|
|
179
179
|
resultdetails.comments.push(`${test.title} - passed`);
|
|
@@ -200,7 +200,7 @@ const commonconfig = {
|
|
|
200
200
|
jwtScript.scriptId,
|
|
201
201
|
jwtScript.platform.toLowerCase(),
|
|
202
202
|
scriptresult)
|
|
203
|
-
|
|
203
|
+
|
|
204
204
|
|
|
205
205
|
},
|
|
206
206
|
/**
|
|
@@ -239,7 +239,7 @@ const commonconfig = {
|
|
|
239
239
|
});
|
|
240
240
|
|
|
241
241
|
}
|
|
242
|
-
|
|
242
|
+
|
|
243
243
|
},
|
|
244
244
|
|
|
245
245
|
afterSession: async function (config, capabilities, specs) {
|
|
@@ -248,7 +248,7 @@ const commonconfig = {
|
|
|
248
248
|
// console.log("Capabilities:", capabilities);
|
|
249
249
|
console.log("Specs:", specs);
|
|
250
250
|
//console.log("Config:", config);
|
|
251
|
-
|
|
251
|
+
|
|
252
252
|
process.on('uncaughtException', (err) => {
|
|
253
253
|
console.error("Uncaught Exception:", err);
|
|
254
254
|
resultdetails.comments.push(`Execution failed with exit code: ${err}`);
|
|
@@ -277,16 +277,19 @@ const commonconfig = {
|
|
|
277
277
|
endtime = new Date().getTime();
|
|
278
278
|
let totalDuration = endtime - starttime;
|
|
279
279
|
console.log("====> Total Duration in after session based on start time and end time:" + totalDuration);
|
|
280
|
-
console.log("====> Total Duration in after session based on start time and end time:" + duration_tests
|
|
280
|
+
console.log("====> Total Duration in after session based on start time and end time:" + global.duration_tests);
|
|
281
281
|
|
|
282
282
|
resultdetails.excution_status = BUFFER.getItem("RESULT_DATA") == 0 ? 'PASSED' : 'FAILED'
|
|
283
|
-
|
|
284
|
-
console.log("====> Total Duration calculation:" +
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
283
|
+
|
|
284
|
+
console.log("====> Total Duration calculation:" +
|
|
285
|
+
(await isValidDuration(BUFFER.getItem("FROTH_TOTAL_DURATION"))
|
|
286
|
+
? (await isValidDuration(global.duration_tests) ? await convertTimetoHHMMSS(totalDuration) : await secondsToTime(global.duration_tests))
|
|
287
|
+
: await secondsToTime(BUFFER.getItem("FROTH_TOTAL_DURATION"))));
|
|
288
|
+
|
|
289
|
+
resultdetails.excution_time = await isValidDuration(BUFFER.getItem("FROTH_TOTAL_DURATION"))
|
|
290
|
+
? (await isValidDuration(global.duration_tests) ? await convertTimetoHHMMSS(totalDuration) : await secondsToTime(global.duration_tests))
|
|
291
|
+
: await secondsToTime(BUFFER.getItem("FROTH_TOTAL_DURATION"));
|
|
292
|
+
|
|
290
293
|
await exeDetails.updateExecuitonDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), BUFFER.getItem("FROTH_EXECUTION_ID"), resultdetails)
|
|
291
294
|
BUFFER.clear();
|
|
292
295
|
|
|
@@ -295,8 +298,11 @@ const commonconfig = {
|
|
|
295
298
|
}
|
|
296
299
|
|
|
297
300
|
};
|
|
298
|
-
|
|
301
|
+
async function isValidDuration(val) {
|
|
302
|
+
return val === null || val === 0 || val === undefined;
|
|
303
|
+
}
|
|
299
304
|
async function secondsToTime(secs) {
|
|
305
|
+
console.log("secs in secondsToTime :" + secs);
|
|
300
306
|
let hours = Math.floor(secs / 3600);
|
|
301
307
|
let minutes = Math.floor((secs % 3600) / 60);
|
|
302
308
|
let seconds = secs % 60;
|