Allure report integration with Cypress

puneet vashisth
2 min readMar 18, 2023

--

If you want to integrate allure reports in your cypress project, here are few easy and minimum steps required to add in your project.

In order to install allure report , we need to install few dependencies in the project —

Step 1 — npm install — save-dev mocha-allure-reporter

Step 2 — npm install — save-dev mocha-allure-reporter allure-commandline

Step 3 —npm i -D @shelex/cupress-allure-plugin OR

yarn add -D @shelex/cypress-allure-plugin

After running these above commands you can see the above dependencies added in your package.json file.

Next we need to add below code in the respective files.

In cypress/plugin/index.js file -

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

module.exports = (on, config) =>

allureWriter(on, config);

return config;

};

In Cypress/support/index.js file -

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

import ‘@shelex/cypress-allure-plugin’;

Add execution scripts inside package.json -

“test-allure”:”npx cypress run — spec ./**js — reporter mocha-allure-reporter — env allure=true”,

“allure:report”:”allure generate allure-results — clean -o allure-report && allure open allure-report”

“execute:report” :“npm run test-allure && npm run allure:report”

NOTE — You can add particular test cases also here in place of— spec ./**js.

Now you need to run command npm run execute:report in the terminal which will run the mentioned test cases and generate beautiful allure report for you.

--

--

puneet vashisth

Sound experience in automation tool | Cypress JS based automation tool | Karate API automation | Selenium | Javascript | Typescript | Cucumber | BDD approach |