[Cypress] Tests fail on `reportAllureCypressSpecMessages` task during screenshots copying
Describe the bug
When using the allure-cypress with the cypress-plugin-snapshots for visual regression tests, when a test fails on a screenshot comparison, then the after hook fails with an error:
CypressError: cy.task('reportAllureCypressSpecMessages') fails with the following error:
> ENOENT: no such file or directory, copyfile '/var/lib/jenkins/workspace/project-name/cypress/screenshots/spec_name.cy.js/screenshot_name #0.png' -> 'cypress/reports/allure-results/81429aaa-74cf-49ff-8c2c-447d718fa405-attachment.png'
https://on.cypress.io/api/task
Because this error occurred during a `after each` hook we are skipping all of the remaining tests.
at <unknown> (http://localhost:4173/__cypress/runner/cypress_runner.js:135481:70)
at tryCatcher (http://localhost:4173/__cypress/runner/cypress_runner.js:1807:23)
at Promise._settlePromiseFromHandler (http://localhost:4173/__cypress/runner/cypress_runner.js:1519:31)
at Promise._settlePromise (http://localhost:4173/__cypress/runner/cypress_runner.js:1576:18)
at Promise._settlePromise0 (http://localhost:4173/__cypress/runner/cypress_runner.js:1621:10)
at Promise._settlePromises (http://localhost:4173/__cypress/runner/cypress_runner.js:1697:18)
at _drainQueueStep (http://localhost:4173/__cypress/runner/cypress_runner.js:2407:12)
at _drainQueue (http://localhost:4173/__cypress/runner/cypress_runner.js:2400:9)
at Async._drainQueues (http://localhost:4173/__cypress/runner/cypress_runner.js:2416:5)
at Async.drainQueues (http://localhost:4173/__cypress/runner/cypress_runner.js:2286:14)
From Your Spec Code:
at $.flushAllureMessagesToTask (webpack:///../../node_modules/allure-cypress/dist/cjs/index.js:1:12072)
at [Context.ee](http://context.ee/) (webpack:///../../node_modules/allure-cypress/dist/cjs/index.js:1:14228)
As cypress-plugin-snapshots stores visual regresion screenshots inside a folder e2e/spec_name but the allure-cypress plugin tries to copy all the screenshots taken during test run and assumes they all are saved inside screenshots folder, so it tries to copy screenshots from the path which is not correct.
Is there any way to configure which screenshots should be copied and which not? Or any other way to avoid this problem and ignore the fail in after hook?
Currently the whole tests suite stops when this error occurs.
To Reproduce Steps to reproduce the behavior:
- Set up the
cypress-plugin-snapshotsandallure-cypressplugin in the repository - Run the test script in which a screenshot comparison would fail
- See error described at the beginning
Expected behavior
allure-cypress plugin shouldn't try to copy attatchments from non existing paths or it should be possible to configure which attatchments should be copied to the report.
Screenshots
Desktop (please complete the following information):
- OS: [Ubuntu]
- Browser [chrome]
- allure-cypress Version [v3.0.0-beta.11]
- Cypress version [13.14.1]
Facing the same error. Please let know how to resolve
When using the allure-cypress integrating with the other plugins, the tests doesn't execute at all. Did try to install cypress-on-fix
Facing similar issue with version
allure-cypress Version ,"^3.0.5" and "^3.0.6"
Cypress version [13.13]
Browser [chrome]
OS: [Mac]
Try with this config on your cypress.config.js
env: { preserveOriginalScreenshot: true, },
@baev could you take a look at this issue and provide some feedback? Is it planned to fix this issue or is there any workaround? Currently this issue is a blocker for me in using allure-cypress in my project
@M-Burzynski, could you please specify the versions of cypress, allure-cypress and cypress-plugin-snapshots?
@M-Burzynski, could you please specify the versions of
cypress,allure-cypressandcypress-plugin-snapshots?
@baev Today I checked it on the newest versions and issue still exists:
cypress 14.0.0
allure-cypress 3.0.9
cypress-plugin-snapshots 1.4.4
Thanks, we'll take a look shortly.
Is there any updates on this issue?
I have the same error.
cypress 13.17.0
node 14.21.3
allure-cypress 3.0.6
If i will use the node 16 then the report will be generated successfully.
@baev
Support for Node versions < 18 has been dropped since release 3.0.0.
Allure Cypress is tested against Node.js 18 and higher. Older versions may work, but we can't guarantee that.
https://allurereport.org/docs/cypress/
There are no plans to support earlier versions. We usually follow the official Node release schedule, dropping support for unmaintained versions, see: https://nodejs.org/en/about/previous-releases