question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Screenshots/Videos do not upload when setting `allureWriter(on, config);` before `after:spec`

See original GitHub issue

Describe the bug Cypress screenshots and videos do not upload to the Allure test report when setting allureWriter(on, config); before on('after:spec', () in /cypress/plugins/index.ts.

  allureWriter(on, config);

  on('after:spec', (spec: { name: string }, results: { video: boolean; tests: number }) => {
    // Send test metrics to Datadog after:spec as after:run results in the final metric sometimes not getting sent
    if (process.env.BUILDKITE) {
      reportSpecTestMetrics(spec);
    }

    if (results && results.video) {
      // Do we have failures for any retry attempts?
      const failures = _.some(results.tests, (test: { attempts: number }) => {
        return _.some(test.attempts, { state: 'failed' });
      });
      if (!failures) {
        // Delete the video if the spec passed and no tests retried
        return del(results.video);
      }
    }
  });

To Reproduce Steps to reproduce the behavior:

  1. Set allureWriter(on, config); before on('after:spec', () in /cypress/plugins/index.ts

Expected behavior When allureWriter(on, config); is set after after:spec, the screenshots/videos get uploaded to the report. Placing it before after:spec does not upload screenshots/videos.

Environment (please complete the following information):

  • Cypress version: 9.0.0
  • OS: Mac

** Developer Tools Console Output **

Additional context Add any other context about the problem here.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
willischucommented, Feb 17, 2022

@Shelex the fix looks good!! thank you again.

0reactions
willischucommented, Feb 17, 2022

@Shelex, awesome - yes, will test it shortly. thank you

Read more comments on GitHub >

github_iconTop Results From Across the Web

Video gets uploaded to report with videoUploadOnPasses ...
To Reproduce Video is uploaded to report even with option ... Screenshots/Videos do not upload when setting allureWriter(on, config); before ...
Read more >
after:Spec not working as expected | Cypress - Stack Overflow
i can't seem to get the console.log to print out in this situation it can only be implemented if i remove allurewriter(on,config);.
Read more >
@shelex/cypress-allure-plugin - npm
There is no need to set this plugin as reporter in Cypress or use any ... preprocessors please set allure writer before returning...
Read more >
shelex/cypress-allure-plugin/README.md - UNPKG
Videos are attached for failed tests only from path specified in cypress config `videosFolder` and in case you have not passed video=false to...
Read more >
Allure Report Integration with Cypress - The Geveo Blog
There are lots of cool testing frameworks for different programming languages. Unfortunately, only a few of them can provide good ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found