froth-webdriverio-framework 5.0.15 → 6.0.0

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.
@@ -170,7 +170,6 @@ async function updateExecuitonDetails(frothUrl, token, id, resultdetails) {
170
170
  } else
171
171
  formData.append('excution_time', resultdetails.excution_time);
172
172
 
173
-
174
173
  if (resultdetails.comments === null)
175
174
  console.log("Comments is null")
176
175
  else if (resultdetails.comments.length === 0)
@@ -178,6 +177,7 @@ async function updateExecuitonDetails(frothUrl, token, id, resultdetails) {
178
177
  else
179
178
  formData.append('comments', resultdetails.comments.join('<br>'))
180
179
 
180
+
181
181
  // formData.append('comments', JSON.stringify(resultdetails.comments))
182
182
 
183
183
  const response = await fetch(url, {
@@ -255,20 +255,20 @@ async function updateScriptExecutionStatus(frothUrl, token, scriptid, script_pla
255
255
  }
256
256
 
257
257
  }
258
- async function updateScriptExecutionStatus(frothUrl, token, scriptid, script_platform, status) {
259
-
260
- if (scriptid != 0) {
261
- try {
262
- console.log("script platform is " + script_platform)
263
- const id = await getExecuitonScriptDetails(frothUrl, token, BUFFER.getItem("FROTH_EXECUTION_ID"), scriptid, script_platform)
264
- console.log("ID is :" + id)
265
- const url = `${frothUrl}/api/script-status-percentage/${id}/`;
258
+ async function updateReportUrl(frothUrl, token, id) {
259
+ try {
260
+ console.log("in update execution details UPDATE_EXECUTION: " + BUFFER.getItem("UPDATE_EXECUTION"))
261
+ if (BUFFER.getItem("FROTH_UPDATE_EXECUTION") === 'TRUE') {
262
+ console.log("Execution already updated.")
263
+ }
264
+ else {
265
+ const url = `${frothUrl}/api/test-execution-update/${id}/`;
266
266
  const formData = new FormData();
267
267
 
268
268
  console.log("URL" + url)
269
- // formData.append('execution_id', BUFFER.getItem("EXECUTION_ID"))
270
- formData.append('script_status', status)
271
269
  formData.append('updated_through_bot', true)
270
+ formData.append('report_url', `reports/${process.env.EXECUTION_ID}/test-report.html`)
271
+
272
272
 
273
273
  const response = await fetch(url, {
274
274
  method: 'PUT',
@@ -281,15 +281,9 @@ async function updateScriptExecutionStatus(frothUrl, token, scriptid, script_pla
281
281
 
282
282
  if (response.ok) {
283
283
  const data = await response.json();
284
- // console.log("data is :"+data)
285
-
284
+ BUFFER.setItem("FROTH_UPDATE_EXECUTION", 'TRUE')
286
285
  } else if (response.status === 401) { // Unauthorized, token expired
287
- // Call login function to obtain a new token
288
- // const newToken = await getLoginToken(BUFFER.getItem("SERVICE_USER"), BUFFER.getItem("SERVICE_PASSWORD")); // You need to implement the login function
289
- // // Retry the request with the new token
290
- // return updateScriptExecutionStatus(frothUrl, newToken, scriptid, script_platform, status);
291
286
  console.log("Unauthorized, token expired" + response.status)
292
-
293
287
  } else {
294
288
  const errorText = await response.text();
295
289
  console.error(`error in updating the status into DB ${response.status}`);
@@ -297,13 +291,10 @@ async function updateScriptExecutionStatus(frothUrl, token, scriptid, script_pla
297
291
  }
298
292
 
299
293
 
300
-
301
- } catch (error) {
302
- console.error('Error updating data for script status:', error);
303
-
304
294
  }
305
- } else {
306
- console.error('Else: Error updating data for script status: Invalid ID');
295
+ } catch (error) {
296
+ console.error('Error in update report url :', error);
297
+
307
298
  }
308
299
 
309
300
  }
@@ -337,5 +328,5 @@ async function updateScriptExecutionStatus(frothUrl, token, scriptid, script_pla
337
328
  // }
338
329
 
339
330
  // main();
340
- module.exports = { getExecuitonDetails, updateExecuitonDetails, updateScriptExecutionStatus, update_CICDRUNID_ReportUrl };
331
+ module.exports = { getExecuitonDetails, updateExecuitonDetails, updateScriptExecutionStatus, update_CICDRUNID_ReportUrl, updateReportUrl};
341
332
 
@@ -392,6 +392,10 @@ const commonconfig = {
392
392
 
393
393
  const reportGenerator = new HTMLReportGenerator(outputFilePath, historyFile);
394
394
  await reportGenerator.convertJSONFolderToHTML(jsonFolder);
395
+
396
+ await exeDetails.updateReportUrl(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), BUFFER.getItem("FROTH_EXECUTION_ID"))
397
+
398
+
395
399
  // return exitCode;
396
400
  }
397
401
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "froth-webdriverio-framework",
3
- "version": "5.0.15",
3
+ "version": "6.0.0",
4
4
  "readme": "WebdriverIO Integration",
5
5
  "description": "WebdriverIO and BrowserStack App Automate",
6
6
  "license": "MIT",