froth-webdriverio-framework 3.0.37 → 3.0.39
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.
package/api/getsuiteDetails.js
CHANGED
|
@@ -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.
|
|
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.
|
|
29
|
-
obj[item.
|
|
30
|
-
BUFFER.setItem(item.
|
|
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;
|
|
@@ -70,19 +70,7 @@ async function setExecutionDetails() {
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
|
|
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,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;
|