Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Cypress] Tests fail on reportAllureCypressSpecMessages task during screenshots copying #1133

Open
M-Burzynski opened this issue Sep 6, 2024 · 0 comments

Comments

@M-Burzynski
Copy link

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:

  1. Set up the cypress-plugin-snapshots and allure-cypress plugin in the repository
  2. Run the test script in which a screenshot comparison would fail
  3. 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

image

Desktop (please complete the following information):

  • OS: [Ubuntu]
  • Browser [chrome]
  • allure-cypress Version [v3.0.0-beta.11]
  • Cypress version [13.14.1]
@M-Burzynski M-Burzynski changed the title [Cypress] Tests fails on reportAllureCypressSpecMessages task [Cypress] Tests fail on reportAllureCypressSpecMessages task during screenshots copying Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant