Closed rodolforodriguess closed 3 years ago
Hi @rodolforodriguess Thank you for opening an issue.
Why it is not automatically attached:
afterEach
mocha hook is fired when test itself is finished, and because of that there is no logger for test available in allure at that time and it is trying to add screenshot to current executable, which is afterEach hook logger, and then this hook is attached to suite logger with no screenshot available as allure does not support showing it. Solution for such issue could be done in terms of #17 with weird idea to handle hooks as steps for test, as order of mocha events not allow to do that natively.
Why it cannot be processed in test:after:run
:
The issue is that cypress internal test:after:run
event has no relation to mocha runner as according to documentation test:after:run fires after the test and all afterEach and after hooks run. While allure reporter writer itself is an afterEach
hook, it basically cannot access what is going on in test:after:run
.
Addressed in v1.10.0
Hey guys,
My aim is to see screenshots for each test. Well, my code takes the screenshot in a afterEach hook and then I could see the .png added to the allure-results folder as shown in the image below.
The allure report opens nicely but the screenshot is not displayed although there is a kind of a section left to that. See below an image of the report:
So I tried a workaround by using attachment method of Allure API in order to add it programatically. However, I didn't have any success.
So, to summarize, it's seems attachment method of Allure API is not working properly.
I added the exact name of the screenshot generated by cypress as cypress documentation: https://docs.cypress.io/api/commands/screenshot.html#Notes which worked in a mochawesome report.
Here is the code which I put in index.js under support folder.
In my test I just have a afterEach calling cy.screenshot()
My OS is a Linux Mint 20 Ulyana and allure is in its most recent version I believe which is 2.13.6.