froth-webdriverio-framework 3.0.110 → 3.0.112

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.
@@ -1,5 +1,5 @@
1
1
 
2
- const getLoginToken = require("./loginapi.js")
2
+ //const getLoginToken = require("./loginapi.js")
3
3
  // Function to get data from the API using the Bearer token
4
4
 
5
5
  async function getExecuitonDetails(frothUrl, token, id) {
@@ -35,9 +35,10 @@ async function getExecuitonDetails(frothUrl, token, id) {
35
35
  return jsondata;
36
36
  } else if (response.status === 401) { // Unauthorized, token expired
37
37
  // Call login function to obtain a new token
38
- const newToken = await getLoginToken(BUFFER.getItem("SERVICE_USER"), BUFFER.getItem("SERVICE_PASSWORD")); // You need to implement the login function
38
+ // const newToken = await getLoginToken(BUFFER.getItem("SERVICE_USER"), BUFFER.getItem("SERVICE_PASSWORD")); // You need to implement the login function
39
39
  // Retry the request with the new token
40
- return getExecuitonDetails(frothUrl, newToken, id);
40
+ // return getExecuitonDetails(frothUrl, newToken, id);
41
+ console.log("Unauthorized, token expired"+response.status)
41
42
  } else {
42
43
  const errorText = await response.text();
43
44
  console.error(`Data fetch failed response in getExecuitonDetails: ${response.status}`);
@@ -80,10 +81,12 @@ async function getExecuitonScriptDetails(frothUrl, token, execution_id, script_i
80
81
 
81
82
  return id;
82
83
  } else if (response.status === 401) { // Unauthorized, token expired
84
+ console.log("Unauthorized, token expired"+response.status)
85
+
83
86
  // Call login function to obtain a new token
84
- const newToken = await getLoginToken(BUFFER.getItem("SERVICE_USER"), BUFFER.getItem("SERVICE_PASSWORD")); // You need to implement the login function
87
+ // const newToken = await getLoginToken(BUFFER.getItem("SERVICE_USER"), BUFFER.getItem("SERVICE_PASSWORD")); // You need to implement the login function
85
88
  // Retry the request with the new token
86
- return getExecuitonScriptDetails(frothUrl, newToken, execution_id, script_id);
89
+ // return getExecuitonScriptDetails(frothUrl, newToken, execution_id, script_id);
87
90
  } else {
88
91
  const errorText = await response.text();
89
92
  console.error(`Data fetch failed response in getExecuitonScriptDetails: ${response.status}`);
@@ -116,7 +119,11 @@ async function updateExecuitonDetails(frothUrl, token, id, resultdetails) {
116
119
  }
117
120
  formData.append('id', BUFFER.getItem("FROTH_EXECUTION_ID"))
118
121
  formData.append('report_url', BUFFER.getItem("REPORT_URL"))
122
+ formData.append('updated_through_bot', true)
123
+
119
124
  console.log("Report URL:" + BUFFER.getItem("REPORT_URL"))
125
+
126
+
120
127
 
121
128
  const response = await fetch(url, {
122
129
  method: 'PUT',
@@ -133,9 +140,11 @@ async function updateExecuitonDetails(frothUrl, token, id, resultdetails) {
133
140
 
134
141
  } else if (response.status === 401) { // Unauthorized, token expired
135
142
  // Call login function to obtain a new token
136
- const newToken = await getLoginToken(BUFFER.getItem("SERVICE_USER"), BUFFER.getItem("SERVICE_PASSWORD")); // You need to implement the login function
137
- // Retry the request with the new token
138
- return updateExecuitonDetails(frothUrl, newToken, id, resultdetails);
143
+ // const newToken = await getLoginToken(BUFFER.getItem("SERVICE_USER"), BUFFER.getItem("SERVICE_PASSWORD")); // You need to implement the login function
144
+ // // Retry the request with the new token
145
+ // return updateExecuitonDetails(frothUrl, newToken, id, resultdetails);
146
+ console.log("Unauthorized, token expired"+response.status)
147
+
139
148
  } else {
140
149
  const errorText = await response.text();
141
150
  console.error(`error in updating the status into DB ${response.status}`);
@@ -167,6 +176,7 @@ async function updateScriptExecutionStatus(frothUrl, token, scriptid, script_pla
167
176
  console.log("URL" + url)
168
177
  // formData.append('execution_id', BUFFER.getItem("EXECUTION_ID"))
169
178
  formData.append('script_status', status)
179
+ formData.append('updated_through_bot', true)
170
180
 
171
181
  const response = await fetch(url, {
172
182
  method: 'PUT',
@@ -183,9 +193,11 @@ async function updateScriptExecutionStatus(frothUrl, token, scriptid, script_pla
183
193
 
184
194
  } else if (response.status === 401) { // Unauthorized, token expired
185
195
  // Call login function to obtain a new token
186
- const newToken = await getLoginToken(BUFFER.getItem("SERVICE_USER"), BUFFER.getItem("SERVICE_PASSWORD")); // You need to implement the login function
187
- // Retry the request with the new token
188
- return updateScriptExecutionStatus(frothUrl, newToken, scriptid, script_platform, status);
196
+ // const newToken = await getLoginToken(BUFFER.getItem("SERVICE_USER"), BUFFER.getItem("SERVICE_PASSWORD")); // You need to implement the login function
197
+ // // Retry the request with the new token
198
+ // return updateScriptExecutionStatus(frothUrl, newToken, scriptid, script_platform, status);
199
+ console.log("Unauthorized, token expired"+response.status)
200
+
189
201
  } else {
190
202
  const errorText = await response.text();
191
203
  console.error(`error in updating the status into DB ${response.status}`);
@@ -1,5 +1,5 @@
1
1
 
2
- const getLoginToken = require('./loginapi')
2
+ //const getLoginToken = require('./loginapi')
3
3
  // Function to get data from the API using the Bearer token
4
4
  async function getSuiteDetails(frothUrl, token, id) {
5
5
  let jsondata = {};
@@ -41,9 +41,10 @@ async function getSuiteDetails(frothUrl, token, id) {
41
41
 
42
42
  } else if (response.status === 401) { // Unauthorized, token expired
43
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);
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);
47
+ console.log("Unauthorized, token expired" + response.status)
47
48
  }
48
49
  else {
49
50
  const errorText = await response.text();
@@ -35,9 +35,11 @@ async function getDataById(frothUrl, token, id) {
35
35
  }
36
36
  else if (response.status === 401) { // Unauthorized, token expired
37
37
  // Call login function to obtain a new token
38
- const newToken = await getLoginToken(BUFFER.getItem("SERVICE_USER"), BUFFER.getItem("SERVICE_PASSWORD")); // You need to implement the login function
39
- // Retry the request with the new token
40
- return getDataById(frothUrl, newToken, id);
38
+ // const newToken = await getLoginToken(BUFFER.getItem("SERVICE_USER"), BUFFER.getItem("SERVICE_PASSWORD")); // You need to implement the login function
39
+ // // Retry the request with the new token
40
+ // return getDataById(frothUrl, newToken, id);
41
+ console.log("Unauthorized, token expired" + response.status)
42
+
41
43
  }
42
44
  else {
43
45
  const errorText = await response.text();
@@ -60,5 +60,5 @@ function main() {
60
60
 
61
61
  console.log('JWT signed token:', generateJWTToken(payload));
62
62
  }
63
- main()
64
- //module.exports = { generateJWTToken}
63
+ //main()
64
+ module.exports = { generateJWTToken}
@@ -19,7 +19,8 @@ const commonconfig = {
19
19
  console.log('==== ON PREPARE HOOK ====');
20
20
  // This code runs before the test suite starts
21
21
  await setAllDetails.setEnvVariables();
22
- await setAllDetails.setLoginToken();
22
+ // await setAllDetails.setLoginToken();
23
+ FROTH_LOGIN_TOKEN
23
24
  await setAllDetails.setExecutionDetails();
24
25
 
25
26
  // await setAllDetails.setIntegrationsDetails();
@@ -41,16 +41,17 @@ async function setEnvVariables() {
41
41
  BUFFER.setItem("FROTH_EXECUTION_ID", process.env.EXECUTION_ID || 1);
42
42
  BUFFER.setItem("FROTH_INTEGRATION_ID", process.env.INTEGRATION_ID || 1);
43
43
  BUFFER.setItem("ORGANISATION_DOMAIN_URL", process.env.ORGANISATION_DOMAIN_URL || "https://devapi.frothtestops.com");
44
- BUFFER.setItem("SERVICE_USER", "frothbot@roboticodigital.com");
45
- BUFFER.setItem("SERVICE_PASSWORD", "Frothtestops@555");
46
-
44
+ // BUFFER.setItem("SERVICE_USER", "frothbot@roboticodigital.com");
45
+ // BUFFER.setItem("SERVICE_PASSWORD", "Frothtestops@555");
46
+ BUFFER.setItem("FROTH_LOGIN_TOKEN", process.env.API_TOKEN)
47
+ console.log("api token in set evn variable :" + BUFFER.getItem("FROTH_LOGIN_TOKEN"))
47
48
 
48
49
  }
49
50
 
50
51
  async function setLoginToken() {
51
52
  try {
52
53
 
53
- const getToken = await getLoginToken(BUFFER.getItem("ORGANISATION_DOMAIN_URL") , BUFFER.getItem("SERVICE_USER"), BUFFER.getItem("SERVICE_PASSWORD"));
54
+ const getToken = await getLoginToken(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("SERVICE_USER"), BUFFER.getItem("SERVICE_PASSWORD"));
54
55
  process.env.FROTH_LOGIN_TOKEN = getToken;
55
56
  BUFFER.setItem("FROTH_LOGIN_TOKEN", getToken)
56
57
 
@@ -62,10 +63,10 @@ async function setLoginToken() {
62
63
  async function setExecutionDetails() {
63
64
  try {
64
65
  const getExeDetails = await exeDetails.getExecuitonDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), BUFFER.getItem("FROTH_EXECUTION_ID"));
65
- process.env.AUTOMATION_SUITE_ID= getExeDetails.automation_suite_id;
66
- process.env.BROWSERSTACK_LOCAL= getExeDetails.browser_stack_local;
67
- process.env.BROWSERSTACK_APP_PATH=getExeDetails.app_url;
68
- process.env.MEDIA_FILES=JSON.stringify( getExeDetails.mediaurls);
66
+ process.env.AUTOMATION_SUITE_ID = getExeDetails.automation_suite_id;
67
+ process.env.BROWSERSTACK_LOCAL = getExeDetails.browser_stack_local;
68
+ process.env.BROWSERSTACK_APP_PATH = getExeDetails.app_url;
69
+ process.env.MEDIA_FILES = JSON.stringify(getExeDetails.mediaurls);
69
70
  console.log("Execution Details:", JSON.stringify(getExeDetails));
70
71
 
71
72
  } catch (error) {
@@ -77,8 +78,8 @@ async function setExecutionDetails() {
77
78
  async function setSuiteDetails() {
78
79
  try {
79
80
  const getSuiteDetail = await getSuiteDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), process.env.AUTOMATION_SUITE_ID);
80
- // process.env.BROWSERSTACK_APP_PATH = getSuiteDetail.browser_stack_urls;
81
- process.env.TESTDATA_ID= getSuiteDetail.test_data_id;
81
+ // process.env.BROWSERSTACK_APP_PATH = getSuiteDetail.browser_stack_urls;
82
+ process.env.TESTDATA_ID = getSuiteDetail.test_data_id;
82
83
 
83
84
 
84
85
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "froth-webdriverio-framework",
3
- "version": "3.0.110",
3
+ "version": "3.0.112",
4
4
  "readme": "WebdriverIO Integration",
5
5
  "description": "WebdriverIO and BrowserStack App Automate",
6
6
  "license": "MIT",