LironEr / cypress-mochawesome-reporter

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

Not compatible with cypress 12.17.3 (breaks enhancing reports with failing tests) #157

Closed thousandeyes-fwieland closed 8 months ago

thousandeyes-fwieland commented 1 year ago

Environment

- OS: macOS 13.3.1, Linux
- Node: 20
- cypress-mochawesome-reporter: 3.1.0 (but looking at the code it will be present in 3.6.0-rc too)
- cypress: 12.17.3

What happened?

This is the offending snippet:

https://github.com/LironEr/cypress-mochawesome-reporter/blob/master/lib/enhanceReport.js#L123-L125

function createScreenshotsContextList(screenshots, titleSuffix, mochawesomeOptions, screenshotsDir) {
  return screenshots.map((screenshotPath) => {
    const screenshotTitle = screenshotPath.includes('(failed)')

The issue is that at some point between 12.6 and 12.17.3, the screenshots parameter changed from string[] to { title: string; value: string }[]. This is from the logs when I drop a console.log into the function:

createScreenshotsContextList screenshotPath = {
  title: 'Failed screenshot',
  value: '/tests/views/redacted.cy.ts/redacted (failed).png'
}

Config file

export default defineConfig<OurPluginConfigOptions>({
    projectId: 'redacted',
    experimentalMemoryManagement: true,
    numTestsKeptInMemory: 10,
    defaultCommandTimeout: 10000,
    env: redacted,
    experimentalStudio: true,
    reporterOptions: {
        cypressMochawesomeReporterReporterOptions: {
            reportPageTitle: 'Redacted E2E Tests',
        },
    },
    retries: {
        runMode: 1,
        openMode: 0,
    },
    e2e: {
        baseUrl: 'https://redacted.com/',
        setupNodeEvents(on, config) {
            config.chromeWebSecurity = config.env.BRANCH_NAME !== 'dev';
            return ourPlugin(on, config, ourPluginConfig); // <- installs cypress-mochawesome-reporter's afterRunHook on after:run
        },
        slowTestThreshold: 20000,
        specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}',
    },
});

Relevant log output

No response

Anything else?

No response

LironEr commented 11 months ago

I just upgraded to the latest cypress version and everything worked as expected, If you still encounter this issue after upgrading please create a repo with the problem and steps to reproduce the issue so I can have a look.

Thanks.

ricardo17coelho commented 11 months ago

Hi Maybe related with:

For my the also doesn't work on the CI because cypress detects this plugin as 3rd party.

stale[bot] commented 9 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.