From 7b32c67f38a5e485228504553f5a9515a5f94c09 Mon Sep 17 00:00:00 2001 From: bpvstaty366 Date: Fri, 31 May 2024 10:24:33 +0300 Subject: [PATCH 01/13] add customFooter --- cypress/fixtures/customFooter.json | 4 ++++ cypress/plugins/index.js | 3 +++ 2 files changed, 7 insertions(+) create mode 100644 cypress/fixtures/customFooter.json diff --git a/cypress/fixtures/customFooter.json b/cypress/fixtures/customFooter.json new file mode 100644 index 000000000..e0b93d1d5 --- /dev/null +++ b/cypress/fixtures/customFooter.json @@ -0,0 +1,4 @@ +{ + "Account": "

Custom footer for Account pages

", + "Device": "

Custom footer for Device pages

" +} diff --git a/cypress/plugins/index.js b/cypress/plugins/index.js index 73d50bf94..ea8e4a333 100644 --- a/cypress/plugins/index.js +++ b/cypress/plugins/index.js @@ -298,7 +298,10 @@ module.exports = async (on, config) => { jsonReport = readDataFromFile(filePath + fileName); } const reportProperties = {}; + const customFooter = require("../fixtures/customFooter.json"); reportProperties.isCombinedTestRun = process.env.CYPRESS_isCombinedTestRun; + reportProperties.customFooter = customFooter; + // Add the report to the reportObj if (reportType === CONSTANTS.CUCUMBER) { reportObj.cucumberReport = jsonReport; From f6f6c1c71abc20e14bd67bb11314c42b93db1e92 Mon Sep 17 00:00:00 2001 From: bpvstaty366 Date: Mon, 3 Jun 2024 10:12:09 +0300 Subject: [PATCH 02/13] Update PageFooter --- cypress/fixtures/customFooter.json | 1 + cypress/plugins/index.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/cypress/fixtures/customFooter.json b/cypress/fixtures/customFooter.json index e0b93d1d5..2f848d988 100644 --- a/cypress/fixtures/customFooter.json +++ b/cypress/fixtures/customFooter.json @@ -1,4 +1,5 @@ { + "PageFooter": "

The following module exclusions apply:

  • Discovery.launch (Due to launch crashes in Ripple 1 gateway with launcher builds)
  • Federated Data (Not currently supported as a rippleRPC only method)
  • Secure Storage( Test cases which involves passing empty string for key comes under distributorCertification and not under fireboltCertification)
  • Any test case which requires thunder events (denoted by @thunderproxy tag)
  • Any test case which requires a test step that is not possible with the methods we have available (denoted by @notSupported tag)
  • Lifecycle Visibility state validation fix : Add the expected value in configModule file ( cypress.config.js) in the format "visibilityState" : { "state" : "expectedValue"}

", "Account": "

Custom footer for Account pages

", "Device": "

Custom footer for Device pages

" } diff --git a/cypress/plugins/index.js b/cypress/plugins/index.js index ea8e4a333..04a421af3 100644 --- a/cypress/plugins/index.js +++ b/cypress/plugins/index.js @@ -298,7 +298,7 @@ module.exports = async (on, config) => { jsonReport = readDataFromFile(filePath + fileName); } const reportProperties = {}; - const customFooter = require("../fixtures/customFooter.json"); + const customFooter = require('../fixtures/customFooter.json'); reportProperties.isCombinedTestRun = process.env.CYPRESS_isCombinedTestRun; reportProperties.customFooter = customFooter; From 1667d452721aa9bca334c4b7e829acf1d074eb2c Mon Sep 17 00:00:00 2001 From: bpvstaty366 Date: Fri, 7 Jun 2024 13:05:38 +0300 Subject: [PATCH 03/13] add custom metadata --- cypress/fixtures/customFooter.json | 5 -- cypress/fixtures/customReportData.json | 23 ++++++++ cypress/plugins/index.js | 5 +- cypress/plugins/localReportGenerator.js | 73 ++++++++++++++++++++++++- 4 files changed, 97 insertions(+), 9 deletions(-) delete mode 100644 cypress/fixtures/customFooter.json create mode 100644 cypress/fixtures/customReportData.json diff --git a/cypress/fixtures/customFooter.json b/cypress/fixtures/customFooter.json deleted file mode 100644 index 2f848d988..000000000 --- a/cypress/fixtures/customFooter.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "PageFooter": "

The following module exclusions apply:

  • Discovery.launch (Due to launch crashes in Ripple 1 gateway with launcher builds)
  • Federated Data (Not currently supported as a rippleRPC only method)
  • Secure Storage( Test cases which involves passing empty string for key comes under distributorCertification and not under fireboltCertification)
  • Any test case which requires thunder events (denoted by @thunderproxy tag)
  • Any test case which requires a test step that is not possible with the methods we have available (denoted by @notSupported tag)
  • Lifecycle Visibility state validation fix : Add the expected value in configModule file ( cypress.config.js) in the format "visibilityState" : { "state" : "expectedValue"}

", - "Account": "

Custom footer for Account pages

", - "Device": "

Custom footer for Device pages

" -} diff --git a/cypress/fixtures/customReportData.json b/cypress/fixtures/customReportData.json new file mode 100644 index 000000000..0c637a1e7 --- /dev/null +++ b/cypress/fixtures/customReportData.json @@ -0,0 +1,23 @@ +{ + "customFooter": { + "PageFooter": "

The following module exclusions apply:

  • Discovery.launch (Due to launch crashes in Ripple 1 gateway with launcher builds)
  • Federated Data (Not currently supported as a rippleRPC only method)
  • Secure Storage( Test cases which involves passing empty string for key comes under distributorCertification and not under fireboltCertification)
  • Any test case which requires thunder events (denoted by @thunderproxy tag)
  • Any test case which requires a test step that is not possible with the methods we have available (denoted by @notSupported tag)
  • Lifecycle Visibility state validation fix : Add the expected value in configModule file ( cypress.config.js) in the format "visibilityState" : { "state" : "expectedValue"}

", + "Account": "

Custom footer for Account pages

", + "Device": "

Custom footer for Device pages

" + }, + "customMetadata": { + "Account": { + "Setup": { + "PreReq1": "SetupAccount1", + "PreReq2": "SetupAccount2", + "PreReq3": "SetupAccount3" + } + }, + "Device": { + "Setup": { + "PreReq1": "SetupDevice1", + "PreReq2": "SetupDevice2", + "PreReq3": "SetupDevice3" + } + } + } +} diff --git a/cypress/plugins/index.js b/cypress/plugins/index.js index 04a421af3..769dcbc80 100644 --- a/cypress/plugins/index.js +++ b/cypress/plugins/index.js @@ -298,10 +298,9 @@ module.exports = async (on, config) => { jsonReport = readDataFromFile(filePath + fileName); } const reportProperties = {}; - const customFooter = require('../fixtures/customFooter.json'); + const customReportData = require('../fixtures/customReportData.json'); reportProperties.isCombinedTestRun = process.env.CYPRESS_isCombinedTestRun; - reportProperties.customFooter = customFooter; - + reportProperties.customReportData = customReportData; // Add the report to the reportObj if (reportType === CONSTANTS.CUCUMBER) { reportObj.cucumberReport = jsonReport; diff --git a/cypress/plugins/localReportGenerator.js b/cypress/plugins/localReportGenerator.js index 8ddbbe18b..03b624ae3 100644 --- a/cypress/plugins/localReportGenerator.js +++ b/cypress/plugins/localReportGenerator.js @@ -28,6 +28,8 @@ const logger = require('../support/Logger')('localReportGenerator.js'); const rename = util.promisify(fs.rename); const readdir = util.promisify(fs.readdir); const mkdir = util.promisify(fs.mkdir); +const readFileAsync = util.promisify(fs.readFile); +const writeFileAsync = util.promisify(fs.writeFile); /** * Generates local reports for Mochawesome and Cucumber based on the provided report data. @@ -70,16 +72,23 @@ async function generateLocalReport(reportObj, jobId) { if (reportObj.cucumberReport && reportObj.cucumberReportFilePath) { // Move cucumber json to a separate directory and get the path const cucumberDir = await filterCucumberJson(reportObj.cucumberReportFilePath); - + const customReportData = require('../fixtures/customReportData.json'); // Configure cucumber report options reportEnv.jsonDir = cucumberDir; reportEnv.reportPath = `./reports/${jobId}/cucumber-html-report`; + const featuresDir = `./reports/${jobId}/cucumber-html-report/features`; + if (customReportData.customFooter) + reportEnv.pageFooter = customReportData.customFooter.PageFooter; // Generate the cucumber report await cucumberReportGenerator.generate(reportEnv); // Remove tags from the generated cucumber report removeTagsFromCukeHtml(reportEnv.reportPath + '/index.html'); + if (customReportData.customFooter) + await processFeaturesFiles(featuresDir, customReportData.customFooter, 'customFooter'); + if (customReportData.customMetadata) + await processFeaturesFiles(featuresDir, customReportData.customMetadata, 'customMetadata'); logger.info( `A local report has been generated and can be accessed at ./reports/${jobId}/cucumber-html-report/index.html`, @@ -165,4 +174,66 @@ function removeTagsFromCukeHtml(htmlReportPath) { } } +async function updateCustomData(filePath, newCustomData, flag) { + const data = await readFileAsync(filePath, 'utf8'); + let updatedData; + if (flag.includes('customFooter')) { + const regex = /