froth-webdriverio-framework 4.0.33 → 4.0.35
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.
|
@@ -171,6 +171,8 @@ const commonconfig = {
|
|
|
171
171
|
let scriptresult = "NOT RUN";
|
|
172
172
|
// Default assumption: test passed (unless soft assertion failed)
|
|
173
173
|
let finalPassed = passed;
|
|
174
|
+
let combinedError = error;
|
|
175
|
+
|
|
174
176
|
// Check soft assertion failures
|
|
175
177
|
const softErrors = browser.testErrors || [];
|
|
176
178
|
if (softErrors.length > 0) {
|
|
@@ -180,19 +182,19 @@ const commonconfig = {
|
|
|
180
182
|
|
|
181
183
|
// Log in resultdetails
|
|
182
184
|
resultdetails.comments.push(`${test.title} - failed: ${softErrorMessage}`);
|
|
183
|
-
|
|
185
|
+
global.__SOFT_FAIL__ = true;
|
|
184
186
|
// Overwrite the error param so your logic can pick it up
|
|
185
|
-
|
|
187
|
+
combinedError = new Error(softErrorMessage);
|
|
186
188
|
}
|
|
187
189
|
if (finalPassed) {
|
|
188
190
|
scriptresult = "PASSED"
|
|
189
191
|
resultdetails.comments.push(`${test.title} - passed`);
|
|
190
192
|
}
|
|
191
|
-
else if (!finalPassed ||
|
|
193
|
+
else if (!finalPassed || combinedError) {
|
|
192
194
|
scriptresult = "FAILED"
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
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"}`);
|
|
196
198
|
|
|
197
199
|
}
|
|
198
200
|
|
|
@@ -209,7 +211,10 @@ const commonconfig = {
|
|
|
209
211
|
jwtScript.scriptId,
|
|
210
212
|
jwtScript.platform.toLowerCase(),
|
|
211
213
|
scriptresult)
|
|
212
|
-
|
|
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
|
+
}
|
|
213
218
|
|
|
214
219
|
},
|
|
215
220
|
/**
|
|
@@ -230,7 +235,7 @@ const commonconfig = {
|
|
|
230
235
|
after: async function (result, config, capabilities, specs) {
|
|
231
236
|
console.log('==== AFTER HOOK ====');
|
|
232
237
|
console.log('====> All tests are completed.' + result);
|
|
233
|
-
BUFFER.setItem("RESULT_DATA", result);
|
|
238
|
+
BUFFER.setItem("RESULT_DATA", global.__SOFT_FAIL__ ? 1 : result);
|
|
234
239
|
console.log("====> Result data :" + BUFFER.getItem("RESULT_DATA"))
|
|
235
240
|
/// const resultdetails = {}
|
|
236
241
|
resultdetails.excution_status = BUFFER.getItem("RESULT_DATA") == 0 ? 'PASSED' : 'FAILED'
|
|
@@ -298,7 +303,12 @@ const commonconfig = {
|
|
|
298
303
|
console.log('Execution Time:', results.duration);
|
|
299
304
|
console.log('Exit Code:', exitCode);
|
|
300
305
|
console.log('==== ALL TESTS ARE COMPLETED ====');
|
|
306
|
+
if (global.__SOFT_FAIL__) {
|
|
307
|
+
console.log('❌ One or more tests failed due to soft assertion.');
|
|
308
|
+
process.exit(1); // ✅ Force failure
|
|
309
|
+
}
|
|
301
310
|
|
|
311
|
+
return exitCode;
|
|
302
312
|
}
|
|
303
313
|
|
|
304
314
|
};
|