Open SOLariss opened 6 months ago
Thanks for reporting!
We greatly appreciate any contributions that help resolve the bug. While we understand that active contributors have their own priorities, we kindly request your assistance if you rely on this bug being fixed. We encourage you to take a look at our contribution guidelines or join our friendly Discord development server, where you can ask any questions you may have. Thank you for your support, and cheers!
I am also facing this issue in my project and I have some information to add. I found out that this started happening with version 8.5.0
, with the migration to allure-js-commons
v2 (https://github.com/webdriverio/webdriverio/pull/9704). So, as a workaround, I'm using the version 8.4.0
of @wdio/allure-reporter
.
I hope this helps who's facing this issue too and investigating the source of the bug.
@christian-bromann Could you please try to prioritize this issue, as this is a blocker for bumping the @wdio/allure-reporter
package? The feature of taking a screenshot on the afterTest
is really important to help debugging why a test failed.
@silvaj8 let me set the expectations clear: if you are blocked on an error, please get involved and help resolve this. We expense contributions to the project too.
I understand that, and I already tried to resolve the issue, but to no avail. I don't think I'm the right person to tackle this issue, given the knowledge I have about this package and the free time I have right now, but I will still give it a try (not officially though, so if anyone wants to come forward go ahead ๐ ), and if in the meantime I find something relevant I will share here.
I was hoping that you would know about some contributor that could be more indicated to solve this issue, and you could tag them, for example, the author of the PR I identified above (https://github.com/webdriverio/webdriverio/pull/9704). But I understand that may not be the way things work here, thank you for setting the expectations ๐
Have you read the Contributing Guidelines on issues?
WebdriverIO Version
8.32.2
Node.js Version
20.9.0
Mode
Standalone Mode
Which capabilities are you using?
What happened?
If the last mocha test fails with a timeout, browser.takeScreenshot() from the wdio afterTest hook is unable to take screenshot (save the file).
We are using wdio, mocha and allure for making reports. "@wdio/allure-reporter": "^8.32.2", "@wdio/cli": "^8.32.2", "@wdio/local-runner": "^8.32.2", "@wdio/mocha-framework": "^8.32.2", "@wdio/spec-reporter": "^8.32.2",
Sometimes tests may fail due to a timeout. In case if the failing test is the last in the suit, an error is thrown and screenshot is not saved. From a limited investigation it seems to happen because there is not enough time between triggering wdio timeout error and mocha failing with its timeout. According to this code the difference between mocha and wdio timeouts will always be 3ms, that is not enough in our case. The problem is that there is no way to adjust this buffer time. So what happens on timeout is:
async afterTest(test, context, { passed }) { if (!passed) { await browser.takeScreenshot(); } },
In general, this issue is quite similar to the https://github.com/webdriverio/webdriverio/issues/5545 but the fix seems to be not comprehensive enough.
It seems, that the most obvious solution to the issue would be to make TIME_BUFFER from shim.ts configurable through the wdio config file. Alternatively, one could try to properly synchronize all the hooks and callback executions for the timeout conditions, but this seems to be much more complicated endeavor.
What is your expected behavior?
Screenshot of webpage is created and added to the last step of an allure report
How to reproduce the bug.
Full code can be found here
config file:
test:
Relevant log output
Code of Conduct
Is there an existing issue for this?