froth-webdriverio-framework 3.0.133 → 3.0.135

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.
@@ -22,34 +22,30 @@ async function getSuiteDetails(frothUrl, token, id) {
22
22
  jsondata.automation_suite_id = data.id == null ? 0 : data.id;
23
23
  jsondata.automation_suite_name = data.automation_suite_name == null ? "" : data.automation_suite_name;
24
24
  jsondata.test_data_id = data.test_data_id == null ? 0 : data.test_data_id;
25
- // jsondata.browser_stack_urls = data.browser_stack_urls == null ? "" : data.browser_stack_urls;
25
+ // jsondata.browser_stack_urls = data.browser_stack_urls == null ? "" : data.browser_stack_urls;
26
26
  jsondata.script_details = data.script_details == null ? [] : data.script_details;
27
27
  // console.log("automation_script_id:" + JSON.stringify(jsondata.automation_script_id))
28
- const automationScripts = jsondata.script_details.reduce((obj, item) => {
29
- obj[item.script_Id] = item.script_Id;
30
- BUFFER.setItem(item.scriptName, item.scriptId);
31
- BUFFER.setItem(item.scriptName + "_PLATFORM", item.platform);
28
+ // const automationScripts = jsondata.script_details.reduce((obj, item) => {
29
+ // obj[item.script_Id] = item.script_Id;
30
+ // BUFFER.setItem(item.scriptName, item.scriptId);
31
+ // BUFFER.setItem(item.scriptName + "_PLATFORM", item.platform);
32
32
 
33
- return obj;
34
- }, {});
33
+ // return obj;
34
+ // }, {});
35
35
  jsondata.test_sequence = data.test_sequence;
36
36
  // console.log("automation_script_ details:" + JSON.stringify(BUFFER))
37
37
 
38
- console.log("json data :" + JSON.stringify(jsondata));
38
+ console.log("json data :" + JSON.stringify(jsondata));
39
+
39
40
 
40
- return jsondata;
41
41
 
42
42
  } else if (response.status === 401) { // Unauthorized, token expired
43
- // Call login function to obtain a new token
44
- // const newToken = await getLoginToken(BUFFER.getItem("SERVICE_USER"), BUFFER.getItem("SERVICE_PASSWORD")); // You need to implement the login function
45
- // // Retry the request with the new token
46
- // return getSuiteDetails(frothUrl, newToken, id);
43
+
47
44
  console.log("Unauthorized, token expired" + response.status)
48
45
  }
49
46
  else {
50
47
  const errorText = await response.text();
51
48
  console.error(`Data fetch failed response in getSuiteDetails: ${response.status}`);
52
- // throw new Error(`HTTP error! status: ${response.status}`);
53
49
  }
54
50
 
55
51
 
@@ -58,10 +54,11 @@ async function getSuiteDetails(frothUrl, token, id) {
58
54
  console.error('Error fetching data:', error);
59
55
 
60
56
  }
57
+
61
58
  } else {
62
59
  console.error('Error fetching data: Invalid ID or no suite id is linked to execution');
63
60
  }
64
-
61
+ return jsondata;
65
62
  }
66
63
 
67
64
  // async function main() {
@@ -9,7 +9,7 @@ const { fail } = require("assert");
9
9
  let starttime;
10
10
  let endtime;
11
11
  console.log('===== common config===== ');
12
-
12
+ let suite_info;
13
13
  const resultdetails = {
14
14
  comments: [],
15
15
  excution_status: 'SKIPPED', // Pass/Fail
@@ -29,7 +29,7 @@ const commonconfig = {
29
29
  await setAllDetails.setExecutionDetails();
30
30
 
31
31
  // await setAllDetails.setIntegrationsDetails();
32
- await setAllDetails.setSuiteDetails();
32
+ suite_info= await setAllDetails.setSuiteDetails();
33
33
  await setAllDetails.setTestDataDetails();
34
34
  console.log("on prepare:", JSON.stringify(capabilities))
35
35
 
@@ -155,8 +155,17 @@ const commonconfig = {
155
155
 
156
156
  // scriptresult = "FAILED"
157
157
  }
158
- let scriptid = BUFFER.getItem(fileName.replace(".js", ""))
159
- let script_platform = BUFFER.getItem(fileName.replace(".js", "") + "_PLATFORM")
158
+ console.log("suite info:", JSON.stringify(suite_info))
159
+ const jwtScript = suite_info.script_details.find(script => script.scriptName === fileName.replace(".js", ""));
160
+ console.log("jwtScript:", jwtScript);
161
+ if (jwtScript) {
162
+ console.log("Script ID:", jwtScript.scriptId);
163
+ console.log("Script Platform:", jwtScript.platform);
164
+ }
165
+ let scriptid = jwtScript.scriptId
166
+ let script_platform = jwtScript.platform
167
+ // let scriptid = BUFFER.getItem(fileName.replace(".js", ""))
168
+ // let script_platform = BUFFER.getItem(fileName.replace(".js", "") + "_PLATFORM")
160
169
 
161
170
  await exeDetails.updateScriptExecutionStatus(
162
171
  BUFFER.getItem("ORGANISATION_DOMAIN_URL"),
@@ -77,8 +77,9 @@ async function setSuiteDetails() {
77
77
  try {
78
78
  const getSuiteDetail = await getSuiteDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), process.env.AUTOMATION_SUITE_ID);
79
79
  // process.env.BROWSERSTACK_APP_PATH = getSuiteDetail.browser_stack_urls;
80
+ console.log("Suite Details:", JSON.stringify(getSuiteDetail));
80
81
  process.env.TESTDATA_ID = getSuiteDetail.test_data_id;
81
-
82
+ return getSuiteDetail;
82
83
 
83
84
  } catch (error) {
84
85
  // console.error('Error in main function:', error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "froth-webdriverio-framework",
3
- "version": "3.0.133",
3
+ "version": "3.0.135",
4
4
 
5
5
  "readme": "WebdriverIO Integration",
6
6
  "description": "WebdriverIO and BrowserStack App Automate",