javascriptcypressallure

Generate allure-reports for Cypress under target folder


I am trying to generate "allure-reports" under a target folder called "cypress" in my cypress automation framework

I have configured the following version of allure-reports, the latest dependencies:

"devDependencies": {
    "allure-commandline": "^2.29.0",
    "allure-cypress": "^2.15.1",
    "cypress": "^13.9.0",
}

Referance: https://allurereport.org/docs/cypress/

My current folder structure:

.
└── CypressAutomationFramework/
    ├── allure-reports
    ├── cypress/
    │   ├── allure-results
    │   ├── e2e
    │   ├── fixtures
    │   ├── pages
    │   ├── support
    │   ├── screenshots
    │   └── videos
    ├── node_modules
    ├── cypress.config.js
    ├── jsconfig.json
    ├── package-lock.json
    └── package.json

I have used the following code snippet to generate the "allure-results" under "cypress" folder"

  e2e: {
    setupNodeEvents(on, config) {
      //Allure Reports
      allureCypress(on, {
        resultsDir: "./cypress/allure-results",
      });
    },
  },

I am unable to generate or do the same for "allure-reports" folder, so my folder looks like the following:

.
└── CypressAutomationFramework/
    ├── allure-reports
    ├── cypress/
    │   ├── allure-results
    │   ├── e2e
    │   ├── fixtures
    │   ├── pages
    │   ├── support
    │   ├── screenshots
    │   └── videos
    ├── node_modules
    ├── cypress.config.js
    ├── jsconfig.json
    ├── package-lock.json
    └── package.json

The below command is used to generate the "allure-reports":

npx allure generate ./cypress/allure-results --clean -o allure-report

My desired folder structure:

.
└── CypressAutomationFramework/
    ├── cypress/
    │   ├── allure-reports
    │   ├── allure-results
    │   ├── e2e
    │   ├── fixtures
    │   ├── pages
    │   ├── support
    │   ├── screenshots
    │   └── videos
    ├── node_modules
    ├── cypress.config.js
    ├── jsconfig.json
    ├── package-lock.json
    └── package.json

Please let me know if, I need to make any configuration changes or add the reports directory, I am quite clueless here, as I am not able to find a resolution.


Solution

  • To generate to the specific path /cypress/allure-reports specify that path on the command line

    npx allure generate ./cypress/allure-results --clean -o ./cypress/allure-reports