-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[🐛 Bug]: afterTest hook does not fetch retry attempts #7603
Comments
@user7699 thanks for filling the issue. The object you are accessing describes spec related retries, e.g. defined like this in Mocha: it('should rerun a test at least 3 times', function () {
// ...
}, 3) You are retrying whole spec files. I added a patch to make this differentiation a bit clearer. Thanks! |
@christian-bromann thank you for clearing that out. Is there any way for me the count the attempts when using the strategy shown above, i.e. specFileRetries: 2, I stumbled upon this ticket but the example is not working for me: #4722 "[...] we can use browser.config.specFileRetryAttempts instead example afterTest () { The command "browser.config.specFileRetryAttempts" doesn't return a usable value |
@user7699 you can store this in a file or somewhere else. I would not advice though to make test runs depending on some retry counts. |
@christian-bromann I have a visual testing suite that runs through browserstack which is a bit flaky. Appium have a tendency to crash and/or not being able to load a specific webside when a spec file runs for the first time. When that happen - I would like to have the possibility to only save images for a specific test on the second retry attempt. A test that fail due to one of the reasons previously mentioned will (almost) never fail for the same reason again. Therefore, retrying spec files is essential for me. But perhaps I can come up with a workaround for this problem. Instead of trying to count retries - I could instead use 'error' from the afterTest hook: ERROR: JestAssertionError: expect(received).toBeLessThanOrEqual(expected) That's the error that I'm expecting when images should be saved from the test. That would give me the possibility to ignore timeout errors. |
WebdriverIO Version
7.13.2
Node.js Version
v14.16.1
Mode
WDIO Testrunner
Which capabilities are you using?
What happened?
I should be able to fetch the amount of retry attemps in the afterTest hook. When a test is retried, the output is always { attempts: 0, limit: 0 }.
I'm using the following setup to retry a failing test:
What is your expected behavior?
In the afterTest hook, "retries" should log the amount of retry attempts.
How to reproduce the bug.
In your config file, add:
and the afterTest hook in the same config file
Run a spec file that always fail, e.g
Relevant log output
Code of Conduct
Is there an existing issue for this?
The text was updated successfully, but these errors were encountered: