sclavijosuero/wick-a11y

Incompatibility with Allure reporter

Valiantsin2021 opened this issue · 4 comments

Versions:
wick-a11y: 1.2.2
allure-cypress: 3.0.7
cypress: 13.16.1

Throws error in afterEach hook:
(Allure reporter can not find screenshot file that wick-a11y moved to generate its report)

Wick-a11y console output:

SUCCESSFULLY MOVED SCREENSHOT TO: cypress/accessibility/Accessibility Report --- accessibility-test-samples.cy.js --- Test Sample Page Accessibility - Default analysis (12-14-2024 12_06_19 AM)/Accessibility Issues Image.png

AfterEach console output:

Error:    CypressError: `cy.task('reportAllureCypressSpecMessages')` failed with the following error:

> ENOENT: no such file or directory, copyfile 'C:\testing_frameworks\node\Cypress\Cypress-Jenkins\cypress\screenshots\Accessibility Report --- accessibility-test-samples.cy.js --- Test Sample Page Accessibility - Default analysis (12-14-2024 12_00_13 AM) Accessibility Issues Image.png' -> 'C:\testing_frameworks\node\Cypress\Cypress-Jenkins\allure-results\2d51f0c0-82ee-4297-a51c-26a5851f2215-attachment.png'

Because this error occurred during a `after each` hook we are skipping all of the remaining tests.
    at <unknown> (http://localhost:8081/__cypress/runner/cypress_runner.js:134993:70)
    at tryCatcher (http://localhost:8081/__cypress/runner/cypress_runner.js:1830:23)
    at Promise._settlePromiseFromHandler (http://localhost:8081/__cypress/runner/cypress_runner.js:1542:31)
    at Promise._settlePromise (http://localhost:8081/__cypress/runner/cypress_runner.js:1599:18)
    at Promise._settlePromise0 (http://localhost:8081/__cypress/runner/cypress_runner.js:1644:10)
    at Promise._settlePromises (http://localhost:8081/__cypress/runner/cypress_runner.js:1720:18)
    at _drainQueueStep (http://localhost:8081/__cypress/runner/cypress_runner.js:2430:12)
From previous event:
    at Promise.longStackTracesCaptureStackTrace [as _captureStackTrace] (http://localhost:8081/__cypress/runner/cypress_runner.js:3509:19)
    at Promise._then (http://localhost:8081/__cypress/runner/cypress_runner.js:1262:17)
    at Promise._passThrough (http://localhost:8081/__cypress/runner/cypress_runner.js:4133:17)
    at Promise.lastly.Promise.finally (http://localhost:8081/__cypress/runner/cypress_runner.js:4142:17)
    at Object.onRunnableRun (http://localhost:8081/__cypress/runner/cypress_runner.js:162742:53)
    at $Cypress.action (http://localhost:8081/__cypress/runner/cypress_runner.js:41484:28)
    at Runnable.run (http://localhost:8081/__cypress/runner/cypress_runner.js:145330:13)
    at next (http://localhost:8081/__cypress/runner/cypress_runner.js:155115:10)
    at <unknown> (http://localhost:8081/__cypress/runner/cypress_runner.js:155159:5)
    at timeslice (http://localhost:8081/__cypress/runner/cypress_runner.js:145670:27)
From Your Spec Code:
    at Context.eval (webpack://jenkinsqa_js_2024_fall/./node_modules/cypress-axe/dist/index.js:100:0)

From Node.js Internals:
  Error: ENOENT: no such file or directory, copyfile 'C:\testing_frameworks\node\Cypress\Cypress-Jenkins\cypress\screenshots\Accessibility Report --- accessibility-test-samples.cy.js --- Test Sample Page Accessibility - Default analysis (12-14-2024 12_00_13 AM) Accessibility Issues Image.png' -> 'C:\testing_frameworks\node\Cypress\Cypress-Jenkins\allure-results\2d51f0c0-82ee-4297-a51c-26a5851f2215-attachment.png'
      at copyFileSync (node:fs:3001:11)
      at FileSystemWriter.writeAttachmentFromPath (C:\testing_frameworks\node\Cypress\Cypress-Jenkins\node_modules\allure-js-commons\src\sdk\reporter\writer\FileSystemWriter.ts:24:17)
      at ReporterRuntime.writeAttachment (C:\testing_frameworks\node\Cypress\Cypress-Jenkins\node_modules\allure-js-commons\src\sdk\reporter\ReporterRuntime.ts:379:19)
      at ReporterRuntime.call (C:\testing_frameworks\node\Cypress\Cypress-Jenkins\node_modules\allure-js-commons\src\sdk\reporter\ReporterRuntime.ts:592:10)
      at forEach (C:\testing_frameworks\node\Cypress\Cypress-Jenkins\node_modules\allure-js-commons\src\sdk\reporter\ReporterRuntime.ts:450:44)
  at Array.forEach (<anonymous>)
      at ReporterRuntime.applyRuntimeMessages (C:\testing_frameworks\node\Cypress\Cypress-Jenkins\node_modules\allure-js-commons\src\sdk\reporter\ReporterRuntime.ts:432:14)
      at AllureCypress.call (C:\testing_frameworks\node\Cypress\Cypress-Jenkins\node_modules\allure-cypress\src\reporter.ts:459:26)
      at forEach (C:\testing_frameworks\node\Cypress\Cypress-Jenkins\node_modules\allure-cypress\src\reporter.ts:211:40)
  at Array.forEach (<anonymous>)
      at AllureCypress.call (C:\testing_frameworks\node\Cypress\Cypress-Jenkins\node_modules\allure-cypress\src\reporter.ts:159:14)
      at reportAllureCypressSpecMessages (C:\testing_frameworks\node\Cypress\Cypress-Jenkins\node_modules\allure-cypress\src\reporter.ts:58:41)
      at invoke (C:\Users\Valentin\AppData\Local\Cypress\Cache\13.16.0\Cypress\resources\app\node_modules\@packages\server\lib\plugins\child\run_plugins.js:248:16)
      at <unknown> (C:\Users\Valentin\AppData\Local\Cypress\Cache\13.16.0\Cypress\resources\app\node_modules\@packages\server\lib\plugins\util.js:59:14)
      at tryCatcher (C:\Users\Valentin\AppData\Local\Cypress\Cache\13.16.0\Cypress\resources\app\node_modules\bluebird\js\release\util.js:16:23)
      at Function.Promise.attempt.Promise.try (C:\Users\Valentin\AppData\Local\Cypress\Cache\13.16.0\Cypress\resources\app\node_modules\bluebird\js\release\method.js:39:29)
      at Object.wrapChildPromise (C:\Users\Valentin\AppData\Local\Cypress\Cache\13.16.0\Cypress\resources\app\node_modules\@packages\server\lib\plugins\util.js:58:23)
      at RunPlugins.taskExecute (C:\Users\Valentin\AppData\Local\Cypress\Cache\13.16.0\Cypress\resources\app\node_modules\@packages\server\lib\plugins\child\run_plugins.js:254:10)
      at RunPlugins.execute (C:\Users\Valentin\AppData\Local\Cypress\Cache\13.16.0\Cypress\resources\app\node_modules\@packages\server\lib\plugins\child\run_plugins.js:166:21)
      at EventEmitter.<anonymous> (C:\Users\Valentin\AppData\Local\Cypress\Cache\13.16.0\Cypress\resources\app\node_modules\@packages\server\lib\plugins\child\run_plugins.js:56:12)
      at EventEmitter.emit (node:events:520:28)
      at EventEmitter.emit (node:domain:488:12)
      at process.<anonymous> (C:\Users\Valentin\AppData\Local\Cypress\Cache\13.16.0\Cypress\resources\app\node_modules\@packages\server\lib\plugins\util.js:33:22)
      at process.emit (node:events:520:28)
      at process.emit (node:domain:488:12)
      at process.emit.sharedData.processEmitHook.installedValue [as emit] (C:\Users\Valentin\AppData\Local\Cypress\Cache\13.16.0\Cypress\resources\app\node_modules\@cspotcode\source-map-support\source-map-support.js:745:40)
      at emit (node:internal/child_process:951:14)
      at processTicksAndRejections (node:internal/process/task_queues:83:21)`

it would be nice to have them work together if possible :) Otherwise it is Excommunicado...

Let's not have it excommunicado! That's no bueno. :)
As we discussed in DMs, please fork develop branch and create a feature branch with the change and submit the PR.

I'm using cypress-image-diff plugin and I guess it is the same issue:
CypressError: cy.task('moveScreenshotToFolder') failed with the following error:

ENOENT: no such file or directory, lstat 'C:\myProject\cypress\screenshots\accessibility.cy.ts\Accessibility Report --- accessibility.cy.ts --- Check accessibility (20-12-2024 16_47_39) Accessibility Issues Image.png'

Resolved in release https://github.com/sclavijosuero/wick-a11y/releases/tag/v1.4.0 with new option parameter onlyWarnImpacts.