froth-webdriverio-framework 3.0.36 → 3.0.38

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.
@@ -19,15 +19,15 @@ async function getSuiteDetails(frothUrl, token, id) {
19
19
  if (response.ok) {
20
20
  const data = await response.json();
21
21
  // console.log(data)
22
- jsondata.automation_suite_id = data.id;
23
- jsondata.automation_suite_name = data.automation_suite_name;
24
- jsondata.test_data_id = data.test_data_id;
25
- jsondata.browser_stack_urls = data.browser_stack_urls;
26
- jsondata.automation_script_id=data.automation_script_id;
22
+ jsondata.automation_suite_id = data.id == null ? 0 : data.id;
23
+ jsondata.automation_suite_name = data.automation_suite_name == null ? "" : data.automation_suite_name;
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;
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.automation_script_id.reduce((obj, item) => {
29
- obj[item.automation_script_id] = item.automation_script_id;
30
- BUFFER.setItem(item.automation_script_name, item.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
31
  return obj;
32
32
  }, {});
33
33
  jsondata.test_sequence = data.test_sequence;
package/api/loginapi.js CHANGED
@@ -8,7 +8,7 @@ async function getLoginToken(frothUrl, email, password) {
8
8
  console.log("URL: " + url);
9
9
  const formData = new FormData();
10
10
  formData.append('email_or_username', email);
11
- formData.append('password', Buffer.from(password, 'base64').toString('utf-8'));
11
+ formData.append('password', password);
12
12
  formData.append('is_ad_user',false)
13
13
 
14
14
  const response = await fetch(url, {
@@ -43,7 +43,7 @@ async function setEnvVariables() {
43
43
  BUFFER.setItem("FROTH_INTEGRATION_ID", process.env.INTEGRATION_ID || 1);
44
44
  BUFFER.setItem("ORGANISATION_DOMAIN_URL", process.env.ORGANISATION_DOMAIN_URL || "https://devapi.frothtestops.com");
45
45
  BUFFER.setItem("SERVICE_USER", "frothbot@roboticodigital.com");
46
- BUFFER.setItem("SERVICE_PASSWORD", "RnJvdGh0ZXN0b3BzQDU1NQ==");
46
+ BUFFER.setItem("SERVICE_PASSWORD", "l5xa8AozQ2xldniR1hkkGm7z1ePl7SGy00GlAIdH9v7Bq3ENQKmGCdRTZgKbbTx+");
47
47
 
48
48
 
49
49
  }
@@ -70,19 +70,7 @@ async function setExecutionDetails() {
70
70
  }
71
71
  }
72
72
 
73
- async function setIntegrationsDetails() {
74
- try {
75
- const getIntegrationDetails = await getintegrationdetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), BUFFER.getItem("FROTH_INTEGRATION_ID"));
76
- if (getIntegrationDetails.product === "BrowserStack") {
77
- process.env.BROWSERSTACK_USERNAME = getIntegrationDetails.username;
78
- process.env.BROWSERSTACK_ACCESS_KEY = getIntegrationDetails.token;
79
- BUFFER.setItem("BROWSERSTACK_USERNAME", process.env.BROWSERSTACK_USERNAME);
80
- BUFFER.setItem("BROWSERSTACK_ACCESS_KEY", process.env.BROWSERSTACK_ACCESS_KEY);
81
- }
82
- } catch (error) {
83
- // console.error('Error in main function:', error);
84
- }
85
- }
73
+
86
74
  async function setSuiteDetails() {
87
75
  try {
88
76
  const getSuiteDetail = await getSuiteDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), BUFFER.getItem("AUTOMATION_SUITE_ID"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "froth-webdriverio-framework",
3
- "version": "3.0.36",
3
+ "version": "3.0.38",
4
4
  "readme": "WebdriverIO Integration",
5
5
  "description": "WebdriverIO and BrowserStack App Automate",
6
6
  "license": "MIT",
@@ -1,54 +0,0 @@
1
-
2
- // Function to get data from the API using the Bearer token
3
- async function getintegrationdetails(frothUrl, token, id) {
4
- let jsondata = {};
5
- if (id != 0 || id != null || id != undefined) {
6
- const url = `${frothUrl}/api/intergration-view/${id}/`;
7
-
8
- try {
9
- console.log("URL: " + url)
10
- const response = await fetch(url, {
11
- method: 'GET',
12
- headers: {
13
- 'Authorization': `Bearer ${token}`,
14
- 'Content-Type': 'application/json'
15
-
16
- }
17
- });
18
- if (response.ok) {
19
- const data = await response.json();
20
- console.log(data)
21
- jsondata.product = data.product;
22
- jsondata.username = data.username;
23
- jsondata.email = data.email;
24
- jsondata.token= data.token;
25
-
26
- console.log("json data :" + JSON.stringify(jsondata));
27
-
28
- return jsondata;
29
-
30
- } else if (response.status === 401) { // Unauthorized, token expired
31
- // Call login function to obtain a new token
32
- const newToken = await getLoginToken(BUFFER.getItem("SERVICE_USER"), BUFFER.getItem("SERVICE_PASSWORD")); // You need to implement the login function
33
- // Retry the request with the new token
34
- return getintegrationdetails(frothUrl, newToken, id);
35
- }
36
- else {
37
- const errorText = await response.text();
38
- console.error('Data fetch failed response in getintegrationdetails:', errorText);
39
- throw new Error(`HTTP error! status: ${response.status}`);
40
- }
41
-
42
-
43
-
44
- } catch (error) {
45
- console.error('Error fetching data:', error);
46
-
47
- }
48
- } else {
49
- console.error('Error fetching data: Invalid ID');
50
- }
51
-
52
- }
53
-
54
- module.exports = getintegrationdetails;