froth-webdriverio-framework 1.0.13 → 1.0.15
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/readTestdata.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
const login = require('./loginapi.js');
|
|
2
1
|
|
|
3
2
|
// Function to get data from the API using the Bearer token
|
|
4
3
|
async function getDataById(frothUrl, token, id) {
|
|
@@ -7,7 +6,7 @@ async function getDataById(frothUrl, token, id) {
|
|
|
7
6
|
const url = `https://${frothUrl}/api/testdata-retrieve/${id}/`;
|
|
8
7
|
|
|
9
8
|
try {
|
|
10
|
-
|
|
9
|
+
console.log("inside detdataby id ")
|
|
11
10
|
const response = await fetch(url, {
|
|
12
11
|
method: 'GET',
|
|
13
12
|
headers: {
|
|
@@ -15,6 +14,7 @@ async function getDataById(frothUrl, token, id) {
|
|
|
15
14
|
'Content-Type': 'application/json'
|
|
16
15
|
}
|
|
17
16
|
});
|
|
17
|
+
console.log("reponse ok ")
|
|
18
18
|
|
|
19
19
|
if (response.ok) {
|
|
20
20
|
const data = await response.json();
|
|
@@ -23,7 +23,7 @@ async function getDataById(frothUrl, token, id) {
|
|
|
23
23
|
// Convert the array into an object with keys as property names
|
|
24
24
|
const buffer = jsonData.reduce((obj, item) => {
|
|
25
25
|
obj[item.key] = item.value;
|
|
26
|
-
BUFFER.setItem(item.key,item.value);
|
|
26
|
+
BUFFER.setItem(item.key, item.value);
|
|
27
27
|
return obj;
|
|
28
28
|
}, {});
|
|
29
29
|
// Set the buffer as an environment variable
|
|
@@ -17,15 +17,7 @@ async function setEnvVariables() {
|
|
|
17
17
|
BUFFER.setItem("SERVICE_USER", "frothbot@roboticodigital.com");
|
|
18
18
|
BUFFER.setItem("SERVICE_PASSWORD", "RnJvdGh0ZXN0b3BzQDU1NQ==");
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
// const bufferContents = {};
|
|
22
|
-
// const data = global.BUFFER
|
|
23
|
-
// for (let i = 0; i < data.length; i++) {
|
|
24
|
-
// const key = data.key(i);
|
|
25
|
-
// bufferContents[key] = data.getItem(key);
|
|
26
|
-
// }
|
|
27
|
-
|
|
28
|
-
// console.log("BUFFER contents:", bufferContents);
|
|
20
|
+
|
|
29
21
|
}
|
|
30
22
|
|
|
31
23
|
async function setLoginToken() {
|
|
@@ -79,6 +71,7 @@ async function setSuiteDetails() {
|
|
|
79
71
|
process.env.BROWSERSTACK_APP_PATH = getSuiteDetail.browser_stack_urls;
|
|
80
72
|
console.log("BROWSERSTACK_APP_PATH" + process.env.BROWSERSTACK_APP_PATH)
|
|
81
73
|
process.env.TESTDATA_ID = getSuiteDetail.test_data_id;
|
|
74
|
+
console.log("ALL JSON DATA:" + JSON.stringify(BUFFER));
|
|
82
75
|
|
|
83
76
|
} catch (error) {
|
|
84
77
|
// console.error('Error in main function:', error);
|
|
@@ -86,14 +79,15 @@ async function setSuiteDetails() {
|
|
|
86
79
|
}
|
|
87
80
|
async function setTestDataDetails() {
|
|
88
81
|
try {
|
|
82
|
+
console.log("setTestDataDetails" );
|
|
89
83
|
const jsonobject = await getDataById(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("LOGIN_TOKEN"), BUFFER.getItem("TESTDATA_ID"));
|
|
90
|
-
if (jsonobject == null) {
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
|
|
84
|
+
// if (jsonobject == null) {
|
|
85
|
+
// console.log("Test data is not available");
|
|
86
|
+
// }
|
|
87
|
+
// else {
|
|
88
|
+
// BUFFER.setItem("BUFFER", JSON.stringify(jsonobject))
|
|
95
89
|
|
|
96
|
-
}
|
|
90
|
+
// }
|
|
97
91
|
} catch (error) {
|
|
98
92
|
// console.error('Error in main function:', error);
|
|
99
93
|
}
|