froth-webdriverio-framework 1.0.16 → 1.0.18
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 +31 -24
- package/config/setallDatailinBuffer.js +4 -2
- package/package.json +1 -1
- package/storage/ADMIN_PASSWORD +1 -0
- package/storage/ADMIN_USER +1 -0
- package/storage/EMAIL +1 -0
- package/storage/PASSWORD +1 -0
package/api/readTestdata.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
|
|
2
|
+
const getLoginToken = require('../api/loginapi.js');
|
|
3
|
+
const { LocalStorage } = require('node-localstorage');
|
|
4
|
+
global.BUFFER = new LocalStorage('./storage');
|
|
5
|
+
|
|
2
6
|
// Function to get data from the API using the Bearer token
|
|
3
7
|
async function getDataById(frothUrl, token, id) {
|
|
4
8
|
|
|
@@ -21,7 +25,7 @@ async function getDataById(frothUrl, token, id) {
|
|
|
21
25
|
// Convert the key-value data to a JSON string
|
|
22
26
|
const jsonData = data.key_value_data;
|
|
23
27
|
// Convert the array into an object with keys as property names
|
|
24
|
-
const
|
|
28
|
+
const bufferdta = jsonData.reduce((obj, item) => {
|
|
25
29
|
obj[item.key] = item.value;
|
|
26
30
|
BUFFER.setItem(item.key, item.value);
|
|
27
31
|
return obj;
|
|
@@ -29,7 +33,7 @@ async function getDataById(frothUrl, token, id) {
|
|
|
29
33
|
// Set the buffer as an environment variable
|
|
30
34
|
// const stringData = JSON.stringify(buffer);
|
|
31
35
|
// console.log('JSON DATA : ', stringData);
|
|
32
|
-
return
|
|
36
|
+
return bufferdta;
|
|
33
37
|
}
|
|
34
38
|
else if (response.status === 401) { // Unauthorized, token expired
|
|
35
39
|
// Call login function to obtain a new token
|
|
@@ -57,27 +61,30 @@ async function getDataById(frothUrl, token, id) {
|
|
|
57
61
|
|
|
58
62
|
|
|
59
63
|
// Execute the main function
|
|
60
|
-
async function main() {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
|
|
64
|
+
// async function main() {
|
|
65
|
+
// try {
|
|
66
|
+
// const frothUrl = "devapi.frothtestops.com";
|
|
67
|
+
// const username = "subhra.subudhi@roboticodigital.com";
|
|
68
|
+
// const password = "V2VsY29tZUAxMjM=";
|
|
69
|
+
|
|
70
|
+
// const token = await getLoginToken(frothUrl, username, password);
|
|
71
|
+
|
|
72
|
+
// // const token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNzE4ODk2NjMzLCJpYXQiOjE3MTg4OTMwMzMsImp0aSI6ImM2NDJlODk3NDI5MjQ1YTliN2E1YmYyYWEzOTMwYjY4IiwidXNlcl9pZCI6MTk0fQ.Om2kXmuhquY1xooCXWacyArCezff2B4qu_joTStyhsA"
|
|
73
|
+
// if (!token) {
|
|
74
|
+
// throw new Error('Login failed, no token obtained');
|
|
75
|
+
// }
|
|
76
|
+
|
|
77
|
+
// const id = 94;
|
|
78
|
+
// // const data = await getExecuitonDetails(frothUrl, token, id);
|
|
79
|
+
// // console.log("Retrieved JSON Data:", data);
|
|
80
|
+
|
|
81
|
+
// const d= await getDataById(frothUrl, token, id);
|
|
82
|
+
// console.log(JSON.stringify(BUFFER))
|
|
83
|
+
// } catch (error) {
|
|
84
|
+
// console.error('Error in main function:', error);
|
|
85
|
+
// }
|
|
86
|
+
// }
|
|
87
|
+
|
|
88
|
+
// main();
|
|
82
89
|
|
|
83
90
|
module.exports = getDataById;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
const
|
|
1
|
+
const getLoginToken = require("../api/loginapi");
|
|
2
2
|
const exeDetails = require("../api/getexecutionDetails")
|
|
3
3
|
const getintegrationdetails = require("../api/getintegrationDetails");
|
|
4
|
-
const getLoginToken = require("../api/loginapi");
|
|
5
4
|
const getSuiteDetails = require("../api/getsuiteDetails");
|
|
5
|
+
const getDataById = require("../api/readTestdata");
|
|
6
|
+
|
|
7
|
+
|
|
6
8
|
|
|
7
9
|
|
|
8
10
|
|
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
QgCY72/szqZ@(ap&
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ytladmin
|
package/storage/EMAIL
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0184310814@YES.MY
|
package/storage/PASSWORD
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
password
|