froth-webdriverio-framework 5.0.8 → 5.0.9

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.
Files changed (47) hide show
  1. package/allure-report/app.js +2 -0
  2. package/allure-report/data/attachments/5a44d93eb6bbc152.json +3 -0
  3. package/allure-report/data/attachments/8b4b70d43c5ef509.json +1 -0
  4. package/allure-report/data/attachments/f8f260f9d290c8dc.json +3 -0
  5. package/allure-report/data/behaviors.csv +2 -0
  6. package/allure-report/data/behaviors.json +1 -0
  7. package/allure-report/data/categories.csv +2 -0
  8. package/allure-report/data/categories.json +1 -0
  9. package/allure-report/data/packages.json +1 -0
  10. package/allure-report/data/suites.csv +2 -0
  11. package/allure-report/data/suites.json +1 -0
  12. package/allure-report/data/test-cases/eae527eca53ea9fc.json +1 -0
  13. package/allure-report/data/timeline.json +1 -0
  14. package/allure-report/export/influxDbData.txt +14 -0
  15. package/allure-report/export/mail.html +10 -0
  16. package/allure-report/export/prometheusData.txt +14 -0
  17. package/allure-report/favicon.ico +0 -0
  18. package/allure-report/history/categories-trend.json +1 -0
  19. package/allure-report/history/duration-trend.json +1 -0
  20. package/allure-report/history/history-trend.json +1 -0
  21. package/allure-report/history/history.json +1 -0
  22. package/allure-report/history/retry-trend.json +1 -0
  23. package/allure-report/index.html +34 -0
  24. package/allure-report/plugin/behaviors/index.js +276 -0
  25. package/allure-report/plugin/packages/index.js +160 -0
  26. package/allure-report/plugin/screen-diff/index.js +200 -0
  27. package/allure-report/plugin/screen-diff/styles.css +30 -0
  28. package/allure-report/styles.css +5 -0
  29. package/allure-report/widgets/behaviors.json +1 -0
  30. package/allure-report/widgets/categories-trend.json +1 -0
  31. package/allure-report/widgets/categories.json +1 -0
  32. package/allure-report/widgets/duration-trend.json +1 -0
  33. package/allure-report/widgets/duration.json +1 -0
  34. package/allure-report/widgets/environment.json +1 -0
  35. package/allure-report/widgets/executors.json +1 -0
  36. package/allure-report/widgets/history-trend.json +1 -0
  37. package/allure-report/widgets/launch.json +1 -0
  38. package/allure-report/widgets/retry-trend.json +1 -0
  39. package/allure-report/widgets/severity.json +1 -0
  40. package/allure-report/widgets/status-chart.json +1 -0
  41. package/allure-report/widgets/suites.json +1 -0
  42. package/allure-report/widgets/summary.json +1 -0
  43. package/froth_api_calls/getexecutionDetails.js +5 -2
  44. package/froth_common_actions/logData.js +7 -11
  45. package/froth_configs/commonconfig.js +52 -3
  46. package/froth_configs/wdio.common.conf.js +26 -11
  47. package/package.json +5 -2
@@ -0,0 +1 @@
1
+ {"total":1,"items":[]}
@@ -0,0 +1 @@
1
+ [{"data":{"Test defects":1}}]
@@ -0,0 +1 @@
1
+ {"total":1,"items":[{"uid":"bdbf199525818fae7a8651db9eafe741","name":"Test defects","statistic":{"failed":0,"broken":1,"skipped":0,"passed":0,"unknown":0,"total":1}}]}
@@ -0,0 +1 @@
1
+ [{"data":{"duration":104296}}]
@@ -0,0 +1 @@
1
+ [{"uid":"eae527eca53ea9fc","name":"tests login testops","time":{"start":1760354649871,"stop":1760354754167,"duration":104296},"status":"broken","severity":"normal"}]
@@ -0,0 +1 @@
1
+ []
@@ -0,0 +1 @@
1
+ []
@@ -0,0 +1 @@
1
+ [{"data":{"failed":0,"broken":1,"skipped":0,"passed":0,"unknown":0,"total":1}}]
@@ -0,0 +1 @@
1
+ []
@@ -0,0 +1 @@
1
+ [{"data":{"run":1,"retry":0}}]
@@ -0,0 +1 @@
1
+ [{"uid":"eae527eca53ea9fc","name":"tests login testops","time":{"start":1760354649871,"stop":1760354754167,"duration":104296},"status":"broken","severity":"normal"}]
@@ -0,0 +1 @@
1
+ [{"uid":"eae527eca53ea9fc","name":"tests login testops","time":{"start":1760354649871,"stop":1760354754167,"duration":104296},"status":"broken","severity":"normal"}]
@@ -0,0 +1 @@
1
+ {"total":1,"items":[{"uid":"ad6e8c27e8a1b970e8e4080890e75484","name":"login testops","statistic":{"failed":0,"broken":1,"skipped":0,"passed":0,"unknown":0,"total":1}}]}
@@ -0,0 +1 @@
1
+ {"reportName":"Allure Report","testRuns":[],"statistic":{"failed":0,"broken":1,"skipped":0,"passed":0,"unknown":0,"total":1},"time":{"start":1760354649871,"stop":1760354754167,"duration":104296,"minDuration":104296,"maxDuration":104296,"sumDuration":104296}}
@@ -34,7 +34,7 @@ async function getExecuitonDetails(frothUrl, token, id) {
34
34
 
35
35
  return jsondata;
36
36
  } else if (response.status === 401) { // Unauthorized, token expired
37
-
37
+
38
38
  console.error("Unauthorized, token expired" + response.status);
39
39
 
40
40
  } else {
@@ -107,7 +107,10 @@ async function update_CICDRUNID_ReportUrl(frothUrl, token, id) {
107
107
 
108
108
  // formData.append('id', BUFFER.getItem("FROTH_EXECUTION_ID"))
109
109
  formData.append('updated_through_bot', true)
110
- formData.append('run_id', process.env.CICD_RUN_ID)
110
+ if (process.env.CICD_RUN_ID === null)
111
+ console.log("CICD_RUN_ID is null")
112
+ else
113
+ formData.append('run_id', process.env.CICD_RUN_ID)
111
114
 
112
115
 
113
116
  if (BUFFER.getItem("REPORT_URL") === null)
@@ -56,19 +56,15 @@ module.exports = {
56
56
  // async function main() {
57
57
  // try {
58
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
- // ];
59
+ // const pageTimes = "[{ name: 'Homepage', time: 120 },{ name: 'Service Account Page', time: 250 },{ name: 'Search Results', time: 180 }]";
64
60
 
65
61
  // 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");
62
+ // // const data = [
63
+ // // { id: 1, score: 95.5, passed: true },
64
+ // // { id: 2, score: 67.2, passed: false },
65
+ // // { id: 3, score: null, passed: "N/A" }
66
+ // // ];
67
+ // // await logJsonData2Table(data, "info");
72
68
  // } catch (error) {
73
69
  // console.error('Error in main function:', error);
74
70
  // }
@@ -5,9 +5,11 @@ const { LocalStorage } = require('node-localstorage');
5
5
  global.BUFFER = new LocalStorage('./storage');
6
6
  const setAllDetails = require("./setallDatailinBuffer")
7
7
  const exeDetails = require("../froth_api_calls/getexecutionDetails")
8
- const getBSSessionDetails = require("../froth_api_calls/browsersatckSessionInfo").getBSSessionDetails;
8
+ //const getBSSessionDetails = require("../froth_api_calls/browsersatckSessionInfo").getBSSessionDetails;
9
9
  const { fail } = require("assert");
10
10
  const { error } = require('console');
11
+ const HTMLReportGenerator = require('wdio-json-html-reporter').HTMLReportGenerator;
12
+
11
13
  //const isBrowserStackEnabled = process.env.BROWSERSTACK;
12
14
  let starttime;
13
15
  let endtime;
@@ -31,7 +33,6 @@ const commonconfig = {
31
33
  await setAllDetails.setSuiteDetails();
32
34
  await setAllDetails.setTestDataDetails();
33
35
  console.log("on prepare:", JSON.stringify(capabilities))
34
-
35
36
  // console.log("ALL JSON DATA in env variable :" + JSON.stringify(process.env));
36
37
  } catch (e) {
37
38
  console.log("====> Error in onPrepare:", e);
@@ -135,7 +136,14 @@ const commonconfig = {
135
136
 
136
137
  if (process.env.PLATFORM === 'browserstack')
137
138
  await getBSSessionDetails(process.env.BS_SESSION_TYPE, process.env.BROWSERSTACK_USERNAME, process.env.BROWSERSTACK_ACCESS_KEY);
139
+ else
140
+ {
141
+ console.log("Local execution - no BrowserStack session details to fetch.");
142
+ // BUFFER.setItem("SESSION_ID", "local-session");
143
+ BUFFER.setItem("REPORT_URL", `./reports/${process.env.EXECUTION_ID}/test-report.html`);
144
+ //BUFFER.setItem("FROTH_TOTAL_DURATION", 0);
138
145
 
146
+ }
139
147
 
140
148
  // const resultdetails = {};
141
149
  await exeDetails.update_CICDRUNID_ReportUrl(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), BUFFER.getItem("FROTH_EXECUTION_ID"))
@@ -339,7 +347,48 @@ const commonconfig = {
339
347
  console.log('Exit Code:', exitCode);
340
348
 
341
349
  console.log('==== ALL TESTS ARE COMPLETED ====');
342
- return exitCode;
350
+
351
+ const outputFilePath = `./reports/${process.env.EXECUTION_ID}/test-report.html`;
352
+ const jsonFolder = `./reports/${process.env.EXECUTION_ID}/`; // Directory where JSON reports are saved
353
+ // Find latest JSON file (if multiple exist)
354
+ // const jsonFiles = fs
355
+ // .readdirSync(jsonFolder)
356
+ // .filter(file => file.endsWith('.json'))
357
+ // .map(file => ({
358
+ // name: file,
359
+ // time: fs.statSync(path.join(jsonFolder, file)).mtime.getTime(),
360
+ // }))
361
+ // .sort((a, b) => b.time - a.time);
362
+
363
+ // if (jsonFiles.length === 0) {
364
+ // console.warn('⚠️ No JSON file found, HTML not generated.');
365
+ // return;
366
+ // }
367
+
368
+ // const latestJson = path.join(jsonFolder, jsonFiles[0].name);
369
+ //console.log(`🧩 Using JSON report: ${latestJson}`);
370
+
371
+ // const reportGenerator = new HTMLReportGenerator(outputFilePath, jsonFolder);
372
+
373
+ // Call your method (you can rename "generate" to whatever method your class exposes)
374
+ // reportGenerator.generate({
375
+ // jsonFile: latestJson,
376
+ // reportPath: jsonFolder,
377
+ // reportName: `Execution Report - ${process.env.EXECUTION_ID}`,
378
+ // outputFile: outputFilePath,
379
+ // });
380
+
381
+
382
+ console.log(`✅ HTML report generated: ${outputFilePath}`);
383
+ // If you want to include historical data, specify the history JSON file path here.
384
+ const historyFile = `./reports/${process.env.EXECUTION_ID}/history.json`; // Optional
385
+
386
+ // Optionally, generate aggregated history data before generating the HTML report.
387
+ // JSONReporter.generateAggregateHistory({ reportPaths: jsonFolder, historyPath: historyFile });
388
+
389
+ const reportGenerator = new HTMLReportGenerator(outputFilePath, historyFile);
390
+ await reportGenerator.convertJSONFolderToHTML(jsonFolder);
391
+ // return exitCode;
343
392
  }
344
393
 
345
394
  };
@@ -4,13 +4,14 @@ const yaml = require('js-yaml');
4
4
  const path = require('path');
5
5
  const commonconfig = require('./commonconfig');
6
6
  console.log('=====wdios common config===== ');
7
+ const { JSONReporter, HTMLReportGenerator } = require('wdio-json-html-reporter');
7
8
 
8
9
  // Select platform at runtime
9
10
  const PLATFORM = process.env.PLATFORM || 'browserstack';
10
11
  console.log('====>PLATFORM:', PLATFORM);
11
12
 
12
13
  const configFile = process.env.YML_NAME;
13
-
14
+ const timestamp = new Date().toISOString().replace(/[-:.TZ]/g, '').slice(0, 14); // e.g., 20251014_121532
14
15
  const resultdetails = {
15
16
  comments: [],
16
17
  excution_status: null, // Pass/Fail
@@ -25,7 +26,7 @@ let capabilities;
25
26
  try {
26
27
  capabilities = yaml.load(fs.readFileSync(path.join(path.resolve(process.cwd(), configFile)), 'utf8'));
27
28
  // Merge chrome-specific options if applicable
28
-
29
+
29
30
  } catch (e) {
30
31
  const errorMsg = `The capability file does not exist in the currently configured repository at path: ${path.resolve(process.cwd(), configFile)}: ${e.message},Please update the Capability by editing the file`;
31
32
  console.error(errorMsg);
@@ -92,27 +93,37 @@ function setupPrerequisites() {
92
93
  process.env.BS_SESSION_TYPE = capabilities.platformName === 'android' || capabilities.platformName === 'ios' ? 'app-automate' : 'automate';
93
94
  capabilities.buildName = process.env.FROTH_TESTOPS_BUILD_NAME;
94
95
 
96
+ } else {
97
+ console.log("inside this fuction for local setup ");
98
+ console.log('capabilities.platformName:', capabilities.platformName ?? 'web');
99
+ capabilities.buildName = process.env.FROTH_TESTOPS_BUILD_NAME;
100
+
95
101
  }
96
102
 
97
103
  }
98
104
 
99
105
  const specificConfig = setupPrerequisites();
100
106
 
107
+ // Create per-execution report folder
108
+ const reportDir = path.resolve(process.cwd(), `./reports/${process.env.EXECUTION_ID}`);
109
+ if (!fs.existsSync(reportDir)) {
110
+ fs.mkdirSync(reportDir, { recursive: true });
111
+ }
101
112
 
102
113
  exports.config = deepmerge(commonconfig,
103
114
 
104
115
  {
105
- user: process.env.BROWSERSTACK_USERNAME,
106
- key: process.env.BROWSERSTACK_ACCESS_KEY,
116
+ // user: process.env.BROWSERSTACK_USERNAME,
117
+ // key: process.env.BROWSERSTACK_ACCESS_KEY,
107
118
  // debug: true,
108
119
  // execArgv: ['--inspect-brk'],
109
- services: PLATFORM === 'browserstack'
110
- ? ['browserstack']
111
- : PLATFORM === 'saucelabs'
112
- ? ['sauce']
113
- : [],
120
+ // services: PLATFORM === 'browserstack'
121
+ // ? ['browserstack']
122
+ // : PLATFORM === 'saucelabs'
123
+ // ? ['sauce']
124
+ // : [''],
114
125
 
115
- //runner: 'local',
126
+ runner: 'local',
116
127
  specs: require(SUITE_FILE).tests,
117
128
 
118
129
  maxInstances: 1,
@@ -128,11 +139,15 @@ exports.config = deepmerge(commonconfig,
128
139
  connectionRetryCount: 3,
129
140
 
130
141
  framework: 'mocha',
131
- reporters: ['spec'],
142
+ reporters: ['spec',
143
+ [JSONReporter, { outputDir: reportDir,outputFile: `./reports/${process.env.EXECUTION_ID}/test-results-${timestamp}.json`, screenshotOption: 'OnFailure' }],
144
+ ],
145
+
132
146
  maxInstances: 10,
133
147
  updateJob: false,
134
148
  mochaOpts: {
135
149
  ui: 'bdd',
136
150
  timeout: 300000
137
151
  }
152
+
138
153
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "froth-webdriverio-framework",
3
- "version": "5.0.8",
3
+ "version": "5.0.9",
4
4
  "readme": "WebdriverIO Integration",
5
5
  "description": "WebdriverIO and BrowserStack App Automate",
6
6
  "license": "MIT",
@@ -25,6 +25,8 @@
25
25
  "appium"
26
26
  ],
27
27
  "dependencies": {
28
+ "@wdio/allure-reporter": "^9.20.0",
29
+ "allure-commandline": "^2.34.1",
28
30
  "@wdio/appium-service": "^9.0.9",
29
31
  "@wdio/browserstack-service": "^9.0.9",
30
32
  "@wdio/cli": "^9.0.9",
@@ -48,6 +50,7 @@
48
50
  "node-localstorage": "^3.0.5",
49
51
  "randexp": "^0.5.3",
50
52
  "ts-node": "^10.9.2",
51
- "typescript": "^5.4.5"
53
+ "typescript": "^5.4.5",
54
+ "wdio-json-html-reporter": "^1.5.14"
52
55
  }
53
56
  }