Tengo la siguiente configuración en mi corredor de prueba y trato de fusionar todo el archivo mochaweasome.html como un solo archivo mocha.
Corredor.js
async function testRunner(fixture) { return cypress.run({ config: { "reporter": "mochawesome", "reporterOptions": { "reportFilename": "sample" + `${fixture}`, "reportDir":"./cypress/reports/", "charts": true, "overwrite": false, "html": true, "json": true } }, env: { testcaseID: `${fixture}`, }, spec: './cypress/integration/' + `${param.getSpec()}` + ".spec.js", }); }TestRunner.js:
const testRunner = require("./Runner.js"); const options = { files: [ './cypress/reports/*.html', ], } async function generateReport(options) { return merge(options).then(report => marge.create(report, options)) } async function runner(dataSet) { for (let i = 0; i < dataSet.length; i += 1) { await setTimeout[Object.getOwnPropertySymbols(setTimeout)[0]](10000); try { await testRunner(dataSet[i]).then((result) => { console.log(JSON.stringify(result, null, " ")); generateReport(options); if (result.runs[0].stats.failures === 1) { retry.push(result.config.env.testcaseID); } }, error => { generateReport(options); console.error(error); process.exit(1); }); } catch (err) { process.exit(1); } } }El informe de prueba se crea como se muestra a continuación:
Pero no se fusiona como un solo informe según el código.
¿Puede alguien ayudarme a arreglar esto? Solo quiero un solo informe mochaweasome_final que contenga todos los resultados en un solo archivo .html.
Actualizado:
Usé cypress-mochawesome-reporter y seguí todos los pasos. Pero aún así el informe no se fusiona. ¿Cómo puedo fusionar todos los 5 archivos html en uno solo?
Producción:
Primero, debe instalar mocha reporter usando npm i cypress-mochawesome-reporter .
y luego tienes que poner esta importación en support/index.js
import 'cypress-mochawesome-reporter/register'; E importe esta línea en plugin/index.js
module.exports = (on, config) => { require('cypress-mochawesome-reporter/plugin')(on); }; Y luego en su archivo cypress.json
"reporter": "cypress-mochawesome-reporter", "reporterOptions": { "reportDir": "cypress/reports", "charts": true, "overwrite": false, "html": false, "json": true, "reportPageTitle": "My Test Suite", "embeddedScreenshots": true, "inlineAssets": trueReferencia: https://www.npmjs.com/package/cypress-mochawesome-reporter