froth-webdriverio-framework 3.0.23 → 3.0.24
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 +38 -34
- package/package.json +1 -1
package/config/commonconfig.js
CHANGED
|
@@ -8,9 +8,7 @@ const { fail } = require("assert");
|
|
|
8
8
|
const isBrowserStackEnabled = process.env.BROWSERSTACK;
|
|
9
9
|
let starttime;
|
|
10
10
|
let endtime;
|
|
11
|
-
|
|
12
|
-
let failedTests = 0;
|
|
13
|
-
let totalTests = 0;
|
|
11
|
+
|
|
14
12
|
// Description: This file contains the common configuration for the webdriverio framework.
|
|
15
13
|
const commonconfig = {
|
|
16
14
|
|
|
@@ -34,10 +32,12 @@ const commonconfig = {
|
|
|
34
32
|
*/
|
|
35
33
|
beforeSuite: async function (suite) {
|
|
36
34
|
try {
|
|
37
|
-
console.log(
|
|
35
|
+
console.log(`========= Test suite: ' ${suite.title}' has been started=========`,);
|
|
36
|
+
const specCount = suite.tests.length;
|
|
37
|
+
console.log(`========= Number of specs in the suite: ${specCount}`);
|
|
38
|
+
|
|
38
39
|
starttime = new Date().getTime();
|
|
39
|
-
|
|
40
|
-
// BUFFER.setItem("SESSION_ID", sessionId)
|
|
40
|
+
|
|
41
41
|
if (isBrowserStackEnabled === true) {
|
|
42
42
|
console.log("BrowserStack is enabled");
|
|
43
43
|
await getBSSessionDetails(process.env.BS_SESSION_TYPE, process.env.BROWSERSTACK_USERNAME, process.env.BROWSERSTACK_ACCESS_KEY);
|
|
@@ -56,17 +56,12 @@ const commonconfig = {
|
|
|
56
56
|
* @param {object} context scope object the test was executed with
|
|
57
57
|
*/
|
|
58
58
|
beforeTest: function (test, context) {
|
|
59
|
-
console.log(
|
|
60
|
-
|
|
59
|
+
console.log(`========= Test '${test.title}' Started ========= `);
|
|
60
|
+
|
|
61
61
|
// console.log("File Name:", test.file);
|
|
62
62
|
|
|
63
63
|
},
|
|
64
64
|
|
|
65
|
-
afterStep: function (test, context, { error, result, duration, passed, retries }) {
|
|
66
|
-
// if (passed) {
|
|
67
|
-
// browser.takeScreenshot();
|
|
68
|
-
// }
|
|
69
|
-
},
|
|
70
65
|
|
|
71
66
|
/**
|
|
72
67
|
* Function to be executed after a test (in Mocha/Jasmine only)
|
|
@@ -79,13 +74,13 @@ const commonconfig = {
|
|
|
79
74
|
* @param {object} result.retries information about spec related retries, e.g. `{ attempts: 0, limit: 0 }`
|
|
80
75
|
*/
|
|
81
76
|
afterTest: async function (test, context, { error, result, duration, passed, retries }) {
|
|
82
|
-
console.log(
|
|
77
|
+
console.log(`========= Test name '${test.title}' finished.========`);
|
|
83
78
|
|
|
84
79
|
const fileName = path.basename(test.file);
|
|
85
|
-
console.log('Test File Name:', fileName);
|
|
80
|
+
console.log('========= Test File Name:', fileName);
|
|
86
81
|
// BUFFER.setItem("FROTH_TOTAL_DURATION", Number(BUFFER.getItem("FROTH_TOTAL_DURATION")) + duration)
|
|
87
|
-
console.log(
|
|
88
|
-
console.log(
|
|
82
|
+
console.log(`========= Total Duration for this test: ${duration}ms`);
|
|
83
|
+
console.log(`========= Status of test: ${passed}`);
|
|
89
84
|
let scriptresult = "NOT RUN";
|
|
90
85
|
|
|
91
86
|
if (passed) {
|
|
@@ -97,10 +92,9 @@ const commonconfig = {
|
|
|
97
92
|
failedTests++;
|
|
98
93
|
}
|
|
99
94
|
if (error) {
|
|
100
|
-
console.error(
|
|
95
|
+
console.error(`========= Error occured while executing the test: ${error.message}`);
|
|
101
96
|
// scriptresult = "FAILED"
|
|
102
97
|
}
|
|
103
|
-
console.log('---------------------------------------');
|
|
104
98
|
let scriptid = BUFFER.getItem(fileName.replace(".js", ""))
|
|
105
99
|
await exeDetails.updateScriptExecutionStatus(
|
|
106
100
|
BUFFER.getItem("ORGANISATION_DOMAIN_URL"),
|
|
@@ -114,7 +108,7 @@ const commonconfig = {
|
|
|
114
108
|
* @param {object} suite suite details
|
|
115
109
|
*/
|
|
116
110
|
afterSuite: function (suite) {
|
|
117
|
-
console.log(
|
|
111
|
+
console.log(`========= Test suite '${suite.title}' has completed.`);
|
|
118
112
|
},
|
|
119
113
|
/**
|
|
120
114
|
* Gets executed after all tests are done. You still have access to all global variables from
|
|
@@ -124,32 +118,36 @@ const commonconfig = {
|
|
|
124
118
|
* @param {Array.<String>} specs List of spec file paths that ran
|
|
125
119
|
*/
|
|
126
120
|
after: async function (result, config, capabilities, specs) {
|
|
127
|
-
console.log('All tests are
|
|
128
|
-
|
|
121
|
+
console.log('========= All tests are completed.' + result);
|
|
122
|
+
|
|
129
123
|
BUFFER.setItem("RESULT_DATA", result);
|
|
130
|
-
console.log("
|
|
124
|
+
console.log("========= Result data :" + BUFFER.getItem("RESULT_DATA"))
|
|
125
|
+
|
|
131
126
|
const resultdetails = {}
|
|
132
127
|
resultdetails.excution_status = BUFFER.getItem("RESULT_DATA") == 0 ? 'PASSED' : 'FAILED'
|
|
133
|
-
console.log("Total Duration:" + BUFFER.getItem("FROTH_TOTAL_DURATION"));
|
|
134
|
-
console.log("
|
|
128
|
+
console.log("========= Total Duration taken for the suite:" + BUFFER.getItem("FROTH_TOTAL_DURATION"));
|
|
129
|
+
console.log("========= Execution Status from results" + resultdetails.excution_status);
|
|
130
|
+
|
|
135
131
|
resultdetails.excution_time = await secondsToTime(BUFFER.getItem("FROTH_TOTAL_DURATION"))
|
|
136
132
|
await exeDetails.updateExecuitonDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), BUFFER.getItem("FROTH_EXECUTION_ID"), resultdetails)
|
|
137
133
|
|
|
138
134
|
},
|
|
139
135
|
|
|
140
136
|
afterSession: async function (config, capabilities, specs) {
|
|
141
|
-
console.log('This is the aftersession hook');
|
|
137
|
+
console.log('========= This is the aftersession hook');
|
|
142
138
|
// Perform any cleanup or post-test actions here
|
|
143
139
|
|
|
144
140
|
endtime = new Date().getTime();
|
|
145
141
|
let totalDuration = endtime - starttime;
|
|
146
|
-
console.log("Total Duration:" + totalDuration);
|
|
142
|
+
console.log("========= Total Duration in after session based on start time and end time:" + totalDuration);
|
|
143
|
+
|
|
147
144
|
if (isBrowserStackEnabled)
|
|
148
145
|
await getBSSessionDetails(process.env.BS_SESSION_TYPE, process.env.BROWSERSTACK_USERNAME, process.env.BROWSERSTACK_ACCESS_KEY);
|
|
149
146
|
|
|
150
147
|
const resultdetails = {}
|
|
151
148
|
resultdetails.excution_status = BUFFER.getItem("RESULT_DATA") == 0 ? 'PASSED' : 'FAILED'
|
|
152
|
-
console.log("Total Duration:" + BUFFER.getItem("FROTH_TOTAL_DURATION") === 0 ? await convertTimetoHHMMSS(totalDuration) : await secondsToTime(BUFFER.getItem("FROTH_TOTAL_DURATION")));
|
|
149
|
+
console.log("========= Total Duration calculation:" + BUFFER.getItem("FROTH_TOTAL_DURATION") === 0 ? await convertTimetoHHMMSS(totalDuration) : await secondsToTime(BUFFER.getItem("FROTH_TOTAL_DURATION")));
|
|
150
|
+
|
|
153
151
|
resultdetails.excution_time = BUFFER.getItem("FROTH_TOTAL_DURATION") === 0 ? await convertTimetoHHMMSS(totalDuration) : await secondsToTime(BUFFER.getItem("FROTH_TOTAL_DURATION"))
|
|
154
152
|
await exeDetails.updateExecuitonDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), BUFFER.getItem("FROTH_EXECUTION_ID"), resultdetails)
|
|
155
153
|
BUFFER.clear();
|
|
@@ -157,14 +155,20 @@ const commonconfig = {
|
|
|
157
155
|
},
|
|
158
156
|
|
|
159
157
|
onComplete: async function (exitCode, config, capabilities, results) {
|
|
160
|
-
console.log('This is the onComplete hook', results);
|
|
161
|
-
|
|
158
|
+
console.log('========= This is the onComplete hook', results);
|
|
162
159
|
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
160
|
console.log('----------------------------');
|
|
161
|
+
console.log('Total Tests:', results.total);
|
|
162
|
+
console.log('Passed:', results.passed);
|
|
163
|
+
console.log('Failed:', results.failed);
|
|
164
|
+
console.log('Skipped:', results.skipped);
|
|
165
|
+
console.log('----------------------------');
|
|
166
|
+
console.log('Execution Time:', results.duration);
|
|
167
|
+
console.log('----------------------------');
|
|
168
|
+
console.log('Exit Code:', exitCode);
|
|
169
|
+
console.log('----------------------------');
|
|
170
|
+
console.log('========= All tests are done, exiting the browser session.');
|
|
171
|
+
|
|
168
172
|
}
|
|
169
173
|
|
|
170
174
|
};
|