froth-webdriverio-framework 5.0.7 → 5.0.8
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/froth_api_calls/browsersatckSessionInfo.js +6 -3
- package/froth_common_actions/Utils.js +4 -1
- package/froth_common_actions/logData.js +77 -0
- package/froth_configs/commonconfig.js +1 -1
- package/froth_configs/setallDatailinBuffer.js +1 -1
- package/package.json +1 -1
- package/config/commonconfig.js +0 -0
|
@@ -106,7 +106,7 @@ async function amend2Browserstack(annotationMessage, level) {
|
|
|
106
106
|
try {
|
|
107
107
|
|
|
108
108
|
console.log("Annotation message inside amend2Browserstack:" + annotationMessage)
|
|
109
|
-
if (process.env.PLATFORM === 'browserstack')
|
|
109
|
+
if (process.env.PLATFORM === 'browserstack')
|
|
110
110
|
await driver.execute('browserstack_executor: {"action": "annotate", "arguments": {"data":"' + annotationMessage + '","level": "' + level + '"}}');
|
|
111
111
|
|
|
112
112
|
} catch (error) {
|
|
@@ -115,6 +115,9 @@ async function amend2Browserstack(annotationMessage, level) {
|
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
118
121
|
// Execute the main function
|
|
119
122
|
|
|
120
123
|
// Main function to execute the API call
|
|
@@ -125,7 +128,7 @@ async function amend2Browserstack(annotationMessage, level) {
|
|
|
125
128
|
// const landing=0.30;
|
|
126
129
|
// const home=0.30;
|
|
127
130
|
// const payment=0.30;
|
|
128
|
-
|
|
131
|
+
|
|
129
132
|
|
|
130
133
|
// await amend2Browserstack("\n Page load time for login page:"+login+"\n Page load time for landing page:"+landing+"\n Page load time for home page:"+home+"\n Page load time for payment page:"+payment, "info");
|
|
131
134
|
// } catch (error) {
|
|
@@ -137,6 +140,6 @@ async function amend2Browserstack(annotationMessage, level) {
|
|
|
137
140
|
module.exports = {
|
|
138
141
|
getBSSessionDetails,
|
|
139
142
|
getBSBuildDetails,
|
|
140
|
-
amend2Browserstack
|
|
143
|
+
amend2Browserstack,
|
|
141
144
|
};
|
|
142
145
|
|
|
@@ -53,6 +53,7 @@ let switchToWindowByIndex = null;
|
|
|
53
53
|
|
|
54
54
|
let captureLoadNavigation = null;
|
|
55
55
|
let amendBrowserStackLog = null;
|
|
56
|
+
let logJsonDataToTable = null;
|
|
56
57
|
|
|
57
58
|
if (process.env.LOCATION == null || process.env.LOCATION == 'local') {
|
|
58
59
|
basepath = ".";
|
|
@@ -112,6 +113,7 @@ generateJWT = require(basepath + '/jwt').generateJWTToken;
|
|
|
112
113
|
captureLoadNavigation= require(basepath + '/captureNavigationTime').captureLoadNavigationTime;
|
|
113
114
|
|
|
114
115
|
amendBrowserStackLog= require(basepath + '/../froth_api_calls/browsersatckSessionInfo').amend2Browserstack;
|
|
116
|
+
logJsonDataToTable= require(basepath + '/logData').logJsonData2Table;
|
|
115
117
|
//export the variabels
|
|
116
118
|
module.exports = {
|
|
117
119
|
scrollToEnd,
|
|
@@ -155,5 +157,6 @@ module.exports = {
|
|
|
155
157
|
switchToWindowByTitle,
|
|
156
158
|
switchToWindowByIndex,
|
|
157
159
|
captureLoadNavigation,
|
|
158
|
-
amendBrowserStackLog
|
|
160
|
+
amendBrowserStackLog,
|
|
161
|
+
logJsonDataToTable
|
|
159
162
|
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
const amendToBrowserstack = require("../froth_api_calls/browsersatckSessionInfo").amend2Browserstack;
|
|
2
|
+
|
|
3
|
+
async function logJsonData2Table(jsonData) {
|
|
4
|
+
try {
|
|
5
|
+
console.log("Logging JSON data to table format in BrowserStack:");
|
|
6
|
+
console.log(JSON.stringify(jsonData, null, 2));
|
|
7
|
+
|
|
8
|
+
if (!Array.isArray(jsonData) || jsonData.length === 0) {
|
|
9
|
+
await amendToBrowserstack("No data to log", "info");
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// --- Extract keys dynamically (columns) ---
|
|
14
|
+
const keys = Object.keys(jsonData[0]);
|
|
15
|
+
|
|
16
|
+
// --- Calculate max width for each column ---
|
|
17
|
+
const colWidths = {};
|
|
18
|
+
keys.forEach(key => {
|
|
19
|
+
colWidths[key] = Math.max(
|
|
20
|
+
key.length,
|
|
21
|
+
...jsonData.map(row => String(row[key] ?? "").length)
|
|
22
|
+
) + 2;
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// --- Build line separator ---
|
|
26
|
+
const line = "-".repeat(
|
|
27
|
+
keys.reduce((sum, key) => sum + colWidths[key], 0) + keys.length + 1
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
// --- Build header ---
|
|
31
|
+
let table = line + "\n";
|
|
32
|
+
table += "|" + keys.map(key => ` ${key.padEnd(colWidths[key])}`).join("|") + "|\n";
|
|
33
|
+
table += line + "\n";
|
|
34
|
+
|
|
35
|
+
// --- Build rows ---
|
|
36
|
+
jsonData.forEach(row => {
|
|
37
|
+
table += "|" + keys.map(key => ` ${String(row[key] ?? "").padEnd(colWidths[key])}`).join("|") + "|\n";
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
table += line;
|
|
41
|
+
console.log(table);
|
|
42
|
+
// --- Send to BrowserStack ---
|
|
43
|
+
await amendToBrowserstack(table, "info");
|
|
44
|
+
|
|
45
|
+
} catch (error) {
|
|
46
|
+
console.error('Error occurred while logging JSON data to table:', error);
|
|
47
|
+
// let annotationMessage = `Error occurred while logging JSON data to table: ${error.message}.`;
|
|
48
|
+
// await amendToBrowserstack(annotationMessage, "error");
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
module.exports = {
|
|
52
|
+
logJsonData2Table
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
// // Main function to execute the API call
|
|
56
|
+
// async function main() {
|
|
57
|
+
// try {
|
|
58
|
+
// /// BUFFER.setItem("EXECUTION_SESSIONID","297666e2fd4195de98d7da3b359669072ff41a2a");
|
|
59
|
+
// const pageTimes = [
|
|
60
|
+
// { name: "Homepage", time: 120 },
|
|
61
|
+
// { name: "Service Account Page", time: 250 },
|
|
62
|
+
// { name: "Search Results", time: 180 }
|
|
63
|
+
// ];
|
|
64
|
+
|
|
65
|
+
// await logJsonData2Table(pageTimes, "info");
|
|
66
|
+
// const data = [
|
|
67
|
+
// { id: 1, score: 95.5, passed: true },
|
|
68
|
+
// { id: 2, score: 67.2, passed: false },
|
|
69
|
+
// { id: 3, score: null, passed: "N/A" }
|
|
70
|
+
// ];
|
|
71
|
+
// await logJsonData2Table(data, "info");
|
|
72
|
+
// } catch (error) {
|
|
73
|
+
// console.error('Error in main function:', error);
|
|
74
|
+
// }
|
|
75
|
+
// }
|
|
76
|
+
|
|
77
|
+
// main();
|
|
@@ -139,7 +139,7 @@ const commonconfig = {
|
|
|
139
139
|
|
|
140
140
|
// const resultdetails = {};
|
|
141
141
|
await exeDetails.update_CICDRUNID_ReportUrl(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), BUFFER.getItem("FROTH_EXECUTION_ID"))
|
|
142
|
-
BUFFER.setItem("UPDATE_EXECUTION", 'FALSE')
|
|
142
|
+
BUFFER.setItem("UPDATE_EXECUTION", 'FALSE') //i need to recall
|
|
143
143
|
|
|
144
144
|
} catch (e) {
|
|
145
145
|
console.log("Error in beforeSuite:", e);
|
|
@@ -39,7 +39,7 @@ async function setEnvVariables() {
|
|
|
39
39
|
generateBuildNumber();
|
|
40
40
|
BUFFER.setItem("FROTH_TOTAL_DURATION", 0);
|
|
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
44
|
BUFFER.setItem("FROTH_LOGIN_TOKEN", process.env.API_TOKEN)
|
|
45
45
|
console.log("api token in set evn variable :" + BUFFER.getItem("FROTH_LOGIN_TOKEN"))
|
package/package.json
CHANGED
package/config/commonconfig.js
DELETED
|
File without changes
|