Search code examples
typescripttestingautomationcypressallure

Cypress Allure Report Created but allure-results Folder Not Generated


I'm trying to integrate Allure reports with Cypress in my project. The Allure report is being created, but the allure-results folder is not being generated. Below are the steps I've taken and the configuration I've set up. Pre-requisites

  • Node.js (>= v18.16.0)
  • npm (>= 9.5.1)
  • Cypress (>= 13.x)
  • Cypress package version: 13.13.1
  • Cypress binary version: 13.13.1
  • Electron version: 27.3.10
  • Bundled Node version: 18.17.1
  • Typescript (>=v5.5.3)

cypress.config.ts

import { defineConfig } from "cypress";
import allureWriter from "@shelex/cypress-allure-plugin/writer"

export default defineConfig({
  e2e: {
    setupNodeEvents(on, config) {
    allureWriter(on, config);
    //require('@shelex/cypress-allure-plugin/writer')(on, config);
      return config;
    },
    baseUrl: "http://localhost:3000",
    specPattern: "cypress/e2e/**/*.cy.ts",
    supportFile: 'cypress/support/index.ts',
    reporter: 'cypress-mochawesome-reporter',
    reporterOptions: {
      reportDir: 'cypress/reports',
      overwrite: false,
      html: false,
      json: true,
    },
    env: {
      allureReuseAfterSpec: true
    },
  },
});

cypress/support/index.ts

import '.'; 

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

My test file sample, cypress/e2e/sample_test.cy.ts

describe('Sample Test', () => {
    it('should pass', () => {
      expect(true).to.equal(true);
    });
  });

package.json

    "@shelex/cypress-allure-plugin": "^2.40.2",
    "allure-commandline": "^2.29.0",
    "cypress": "^13.13.1",
    "cypress-mochawesome-reporter": "^3.8.2"  
 },   "dependencies": {
    "typescript": "^5.5.4"  
 }

Run Cypress tests using: npx cypress run

or npx cypress run --env allure=true --spec cypress/e2e/test/sample_test.cy.ts --browser electron --headed

Issues:

  • The Allure report is created, but the allure-results folder is not generated.
  • There are no specific error messages indicating why the folder is not being created.

Troubleshooting Steps Taken:

  • Verified Plugin Integration:
  • Ensured the Allure plugin is properly integrated into cypress.config.ts and imported in cypress/support/index.ts.
  • Re-checked Configuration Files:
  • Confirmed the setup is correct as shown above.
  • Manually Created Allure Results Directory: I tried creating the allure-results folder manually, but it remains empty.

NOTE:

  • Once, I observed the allure-result folder created, and the files where in. XML format, for the next run.
  • I manually deleted the folder from my project.

Any help would be greatly appreciated!


Solution

  • The @shelex/cypress-allure-plugin supports only Cypress versions before v12.14.0.

    For newer versions of Cypress, please consider switching to the official Allure Cypress module: allure-cypress.

    The documentation can be found on the Allure Report website: https://allurereport.org/docs/cypress/