froth-webdriverio-framework 4.0.32 → 4.0.34
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.
|
@@ -18,7 +18,6 @@ const resultdetails = {
|
|
|
18
18
|
excution_status: null, // Pass/Fail
|
|
19
19
|
excution_time: null, // Execution time in milliseconds
|
|
20
20
|
};
|
|
21
|
-
browser.testErrors = [];
|
|
22
21
|
// Description: This file contains the common configuration for the webdriverio framework.
|
|
23
22
|
const commonconfig = {
|
|
24
23
|
|
|
@@ -143,7 +142,7 @@ const commonconfig = {
|
|
|
143
142
|
|
|
144
143
|
console.log('==== BEFORE TEST HOOK ====');
|
|
145
144
|
console.log(`====> Test Started '${test.title}'`);
|
|
146
|
-
|
|
145
|
+
browser.testErrors = [];
|
|
147
146
|
// console.log("File Name:", test.file);
|
|
148
147
|
|
|
149
148
|
},
|
|
@@ -172,6 +171,8 @@ const commonconfig = {
|
|
|
172
171
|
let scriptresult = "NOT RUN";
|
|
173
172
|
// Default assumption: test passed (unless soft assertion failed)
|
|
174
173
|
let finalPassed = passed;
|
|
174
|
+
let combinedError = error;
|
|
175
|
+
|
|
175
176
|
// Check soft assertion failures
|
|
176
177
|
const softErrors = browser.testErrors || [];
|
|
177
178
|
if (softErrors.length > 0) {
|
|
@@ -183,17 +184,17 @@ const commonconfig = {
|
|
|
183
184
|
resultdetails.comments.push(`${test.title} - failed: ${softErrorMessage}`);
|
|
184
185
|
|
|
185
186
|
// Overwrite the error param so your logic can pick it up
|
|
186
|
-
|
|
187
|
+
combinedError = new Error(softErrorMessage);
|
|
187
188
|
}
|
|
188
189
|
if (finalPassed) {
|
|
189
190
|
scriptresult = "PASSED"
|
|
190
191
|
resultdetails.comments.push(`${test.title} - passed`);
|
|
191
192
|
}
|
|
192
|
-
else if (!finalPassed ||
|
|
193
|
+
else if (!finalPassed || combinedError) {
|
|
193
194
|
scriptresult = "FAILED"
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
195
|
+
console.log(`====> Failed or error while executing the test: ${combinedError ? combinedError.message : "Test failed"}`);
|
|
196
|
+
if (!resultdetails.comments.some(comment => typeof comment === 'string' && comment.includes(test.title)))
|
|
197
|
+
resultdetails.comments.push(`${test.title} - failed: ${combinedError ? combinedError.message : "Test failed"}`);
|
|
197
198
|
|
|
198
199
|
}
|
|
199
200
|
|
|
@@ -210,7 +211,10 @@ const commonconfig = {
|
|
|
210
211
|
jwtScript.scriptId,
|
|
211
212
|
jwtScript.platform.toLowerCase(),
|
|
212
213
|
scriptresult)
|
|
213
|
-
|
|
214
|
+
// ✅ Force test failure if soft errors exist
|
|
215
|
+
if (softErrors.length > 0) {
|
|
216
|
+
throw combinedError; // 👈 this is what forces the test to fail in WDIO
|
|
217
|
+
}
|
|
214
218
|
|
|
215
219
|
},
|
|
216
220
|
/**
|