LironEr / cypress-mochawesome-reporter

Zero config Mochawesome reporter for Cypress with screenshots and videos
MIT License
158 stars 49 forks source link

Video included with wrong path with changed specPattern #160

Closed pathob closed 10 months ago

pathob commented 11 months ago

Environment

- OS: Docker image cypress/included:13.2.0
- Node: 20.6.1
- cypress-mochawesome-reporter: 3.6.0
- cypress: 13.2.0

What happened?

When I change the specPattern in the Cypress config to a path outside the ./cypress/ directory, the videos are not included with the right path in the generated report.

E.g. if I set specPattern: 'releases/**/tests/*-e2e.cy.js and have the following tests:

Then the report tries to include the generated videos using the following paths:

Even though the videos are actually located at:

All under cypress/reports/html of couse.

Config file

module.exports = defineConfig({
  e2e: {
    specPattern: 'releases/**/tests/*-e2e.cy.js',

    // enable extended mochawesome reports
    setupNodeEvents(on, config) {
      require('cypress-mochawesome-reporter/plugin')(on);
    },
  },

  // record video
  video: true,

  // ...
}

Relevant log output

No response

Anything else?

No response

joakim-sch commented 11 months ago

Hi @pathob Thanks for your feedback.

Could you set debug: true in the reporterOptions and share the debug log file? In particular, I am looking for the baseFolder logged parameter. Thanks!

joakim-sch commented 11 months ago

Actually, on second thought... Looking at the test case paths you listed, I assume it will say "releases/tests" which is wrong as base path in your example. It should be "releases".

Yeah, the problem is that the extrapolateBaseFolder method is bugged, it gets confused when there are several folders in common even though they are not right before/after one another.

I'm gonna try to rewrite it...