froth-webdriverio-framework 6.0.80 → 6.0.81

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.
@@ -82,10 +82,16 @@ async function failExecution(reason) {
82
82
  process.exit(1);
83
83
  }
84
84
 
85
+ // pushComment now only updates BUFFER
85
86
  async function pushComment(msg) {
86
- //const comments = BUFFER.getItem('RESULT_COMMENTS') || [];
87
- resultdetails.comments.push(msg);
88
- BUFFER.setItem('RESULT_COMMENTS', resultdetails.comments);
87
+ let comments = [];
88
+ try {
89
+ comments = JSON.parse(BUFFER.getItem('RESULT_COMMENTS') || '[]');
90
+ } catch {
91
+ comments = [];
92
+ }
93
+ comments.push(msg);
94
+ BUFFER.setItem('RESULT_COMMENTS', JSON.stringify(comments));
89
95
  }
90
96
  /* ------------------ COMMON CONFIG ------------------ */
91
97
 
@@ -191,6 +197,21 @@ const commonHooks = {
191
197
  /* ========== BEFORE TEST ========== */
192
198
  beforeTest: async (test) => {
193
199
  console.log(`▶️ START TEST: ${test.title}`);
200
+
201
+ // Update script status to IN_PROGRESS
202
+ // const fileName = path.basename(test.file);
203
+ // const suiteDetails = JSON.parse(BUFFER.getItem('FROTHE_SUITE_DETAILS'));
204
+ // const script = suiteDetails.find(s => s.scriptName === fileName.replace('.js', ''));
205
+
206
+ // if (script) {
207
+ // await exeDetails.updateScriptExecutionStatus(
208
+ // BUFFER.getItem('ORGANISATION_DOMAIN_URL'),
209
+ // BUFFER.getItem('FROTH_LOGIN_TOKEN'),
210
+ // script.scriptId,
211
+ // script.platform.toLowerCase(),
212
+ // 'IN_PROGRESS'
213
+ // );
214
+ // }
194
215
  },
195
216
 
196
217
  /* ========== AFTER TEST ========== */
@@ -264,16 +285,24 @@ const commonHooks = {
264
285
  resultdetails.excution_time = await msToTime(totalTime);
265
286
  resultdetails.excution_status = exitCode === 0 ? 'PASSED' : 'FAILED';
266
287
 
267
- const allComments = BUFFER.getItem('RESULT_COMMENTS') || [];
268
- console.log("All Comments:"+allComments)
269
- // In positive case, you can still push a success comment
270
- if (allComments.length === 0) {
271
- allComments.push(`All tests passed ✅`);
288
+
289
+ console.log("All Comments:" + allComments)
290
+ // Collect all comments from BUFFER
291
+ let allComments = [];
292
+ try {
293
+ allComments = JSON.parse(BUFFER.getItem('RESULT_COMMENTS'));
294
+ console.log("All comments after parsing:" + JSON.stringify(allComments))
295
+ } catch {
296
+ allComments = [];
272
297
  }
273
- if (exitCode !== 0 && resultdetails.comments.length === 0) {
274
- resultdetails.comments.push(`Execution failed with exit code ${exitCode}`);
298
+
299
+ // Add default success/failure messages if needed
300
+ if (allComments.length === 0 && exitCode === 0) {
301
+ console.log("All comments wer zero so adding the comments ")
302
+ allComments.push('All tests passed ✅');
275
303
  }
276
304
  resultdetails.comments = allComments;
305
+
277
306
  console.log('Comments being sent:', resultdetails.comments);
278
307
  console.log('⏱ Final execution time (ms):', totalTime);
279
308
  console.log('⏱ Final execution time (hh:mm:ss):', resultdetails.excution_time);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "froth-webdriverio-framework",
3
- "version": "6.0.80",
3
+ "version": "6.0.81",
4
4
  "readme": "WendriverIO Integration with [BrowserStack](https://www.browserstack.com)",
5
5
  "description": "Selenium examples for WebdriverIO and BrowserStack App Automate",
6
6
  "scripts": {