Allure report getting NaN% when integrated with cypress

Viewed 1683

I am using allure reporting in my cypress , but after the execution I could see only the allure report folder getting generated but the allure results folder is not generated.

Configuration made in my code as below:

plugins/index.js

/// <reference types="@shelex/cypress-allure-plugin" />


const allureWriter = require("@shelex/cypress-allure-plugin/writer");

module.exports = (on, config) => {
allureWriter(on, config);
return config;
};

support/index.js

import '@shelex/cypress-allure-plugin';

in package.json

"allure:report": "allure generate allure-results --clean -o allure-report",
"allure:clear_results":"(if exist allure-results (rmdir /S /Q allure-results))",
"allure:clear_report":"  (if exist allure-report (rmdir  /S /Q allure-report))",
"precy-run": "yarn run allure:clear_results && yarn run allure:clear_report",
"cy-run": "cypress run --env allure=true",
"postcy-run": "yarn run allure:report",

output in terminal

$ allure generate allure-results --clean -o allure-report
allure-results does not exist
 Report successfully generated to allure-report

I tried viewing the report in live server in VS code

enter image description here

3 Answers

It works for me, just I placed the result path in the root, looks like allure report look for the result in the root file if you change it, it doesn't work

"env": { 
    "allureResultsPath": "allure-results",
  },

Make sure to add "--env allure=true --reporter mocha-allure-reporter" while working with Allure Report integration with Cypress.

My script in package.json:

{
  "cypress:run:loginModule": "npx cypress run --browser chrome --headless --spec 'cypress/integration/Auth/*.js' **--env allure=true --reporter mocha-allure-reporter",
  "report:login:allure": "allure generate allure-results --clean -o allure-report && allure open allure-report",
  "test-loginModule:allure": "npm run cypress:run:loginModule && npm run report:login:allure"
}

It works for me!!!

From the output

allure-results does not exist

refers to the folder named "allure-results".

The clean-up script removes the folder with rmdir but does not recreate it.

"allure:clear_results":"(if exist allure-results (rmdir /S /Q allure-results))",

Change the script to

"allure:clear_results":"(if exist allure-results (rmdir /S /Q allure-results && mkdir allure-results))",
Related