froth-webdriverio-framework 3.0.21 → 3.0.23
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/config/commonconfig.js +26 -18
- package/package.json +1 -1
package/config/commonconfig.js
CHANGED
|
@@ -4,10 +4,13 @@ global.BUFFER = new LocalStorage('./storage');
|
|
|
4
4
|
const path = require('path');
|
|
5
5
|
const exeDetails = require("../api/getexecutionDetails")
|
|
6
6
|
const getBSSessionDetails = require("../api/browsersatckSessionInfo");
|
|
7
|
+
const { fail } = require("assert");
|
|
7
8
|
const isBrowserStackEnabled = process.env.BROWSERSTACK;
|
|
8
9
|
let starttime;
|
|
9
10
|
let endtime;
|
|
10
|
-
|
|
11
|
+
let passedTests = 0;
|
|
12
|
+
let failedTests = 0;
|
|
13
|
+
let totalTests = 0;
|
|
11
14
|
// Description: This file contains the common configuration for the webdriverio framework.
|
|
12
15
|
const commonconfig = {
|
|
13
16
|
|
|
@@ -54,6 +57,7 @@ const commonconfig = {
|
|
|
54
57
|
*/
|
|
55
58
|
beforeTest: function (test, context) {
|
|
56
59
|
console.log("Test Name:", test.title);
|
|
60
|
+
totalTests++;
|
|
57
61
|
// console.log("File Name:", test.file);
|
|
58
62
|
|
|
59
63
|
},
|
|
@@ -83,20 +87,26 @@ const commonconfig = {
|
|
|
83
87
|
console.log(`Duration: ${duration}ms`);
|
|
84
88
|
console.log(`Passed: ${passed}`);
|
|
85
89
|
let scriptresult = "NOT RUN";
|
|
86
|
-
let scriptid = BUFFER.getItem(fileName.replace(".js", ""))
|
|
87
90
|
|
|
88
91
|
if (passed) {
|
|
89
92
|
scriptresult = "PASSED"
|
|
93
|
+
passedTests++;
|
|
90
94
|
}
|
|
91
95
|
else {
|
|
92
96
|
scriptresult = "FAILED"
|
|
97
|
+
failedTests++;
|
|
93
98
|
}
|
|
94
99
|
if (error) {
|
|
95
100
|
console.error(`Error: ${error.message}`);
|
|
96
|
-
scriptresult = "FAILED"
|
|
101
|
+
// scriptresult = "FAILED"
|
|
97
102
|
}
|
|
98
103
|
console.log('---------------------------------------');
|
|
99
|
-
|
|
104
|
+
let scriptid = BUFFER.getItem(fileName.replace(".js", ""))
|
|
105
|
+
await exeDetails.updateScriptExecutionStatus(
|
|
106
|
+
BUFFER.getItem("ORGANISATION_DOMAIN_URL"),
|
|
107
|
+
BUFFER.getItem("FROTH_LOGIN_TOKEN"),
|
|
108
|
+
scriptid,
|
|
109
|
+
scriptresult)
|
|
100
110
|
|
|
101
111
|
},
|
|
102
112
|
/**
|
|
@@ -115,20 +125,7 @@ const commonconfig = {
|
|
|
115
125
|
*/
|
|
116
126
|
after: async function (result, config, capabilities, specs) {
|
|
117
127
|
console.log('All tests are done.' + result);
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
const totalDefinedTests = exports.config.specs.length; // Total test files/specs defined
|
|
121
|
-
const executedTests = result.finished; // Tests that were executed
|
|
122
|
-
const passedTests = result.passed;
|
|
123
|
-
const failedTests = result.failed;
|
|
124
|
-
const notRunTests = totalDefinedTests - executedTests;
|
|
125
|
-
|
|
126
|
-
console.log(`Total Defined Tests: ${totalDefinedTests}`);
|
|
127
|
-
console.log(`Executed Tests: ${executedTests}`);
|
|
128
|
-
console.log(`Passed Tests: ${passedTests}`);
|
|
129
|
-
console.log(`Failed Tests: ${failedTests}`);
|
|
130
|
-
console.log(`Tests Not Run: ${notRunTests}`);
|
|
131
|
-
|
|
128
|
+
console.log("specs ran :" + specs);
|
|
132
129
|
BUFFER.setItem("RESULT_DATA", result);
|
|
133
130
|
console.log("result data :" + BUFFER.getItem("RESULT_DATA"))
|
|
134
131
|
const resultdetails = {}
|
|
@@ -159,6 +156,17 @@ const commonconfig = {
|
|
|
159
156
|
// Perform any cleanup or post-test actions here
|
|
160
157
|
},
|
|
161
158
|
|
|
159
|
+
onComplete: async function (exitCode, config, capabilities, results) {
|
|
160
|
+
console.log('This is the onComplete hook', results);
|
|
161
|
+
|
|
162
|
+
console.log('--- Test Results Summary ---');
|
|
163
|
+
console.log(`Total Spec Files: ${totalTests}`);
|
|
164
|
+
console.log(`Passed: ${passedTests}`);
|
|
165
|
+
console.log(`Failed: ${failedTests}`);
|
|
166
|
+
console.log(`Total Time: ${Math.round(finished / 1000)} seconds`);
|
|
167
|
+
console.log('----------------------------');
|
|
168
|
+
}
|
|
169
|
+
|
|
162
170
|
};
|
|
163
171
|
|
|
164
172
|
async function secondsToTime(secs) {
|