Closed NIBOSAP closed 8 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 do not believe this is a bug and it is working as intended. It's just not possible to change the timeout within a lambda function. It is a simple fix though. Just convert your it block into a non arrow function. Your it block should look like this:
it('Test timeout mocha', async function () { this.timeout(120000); // 2min //this.timeout is not necessary if declaring //this.timeout in non-lambda describe block //You can immediately start using larger timeout });
I don't remember if it is required that you make your describe block have a non-lambda function with an increased timeout too. It may not be required, but here's what it would look like anyway if you want to be safe (I'm replying on a phone so excuse any odd formatting):
describe('My description', function (){ this.timeout(120000);
it('Test timeout mocha', async function () { this.timeout(120000); // 2min });
});
Not a Bug. Read this: https://mochajs.org/#arrow-functions. As mentioned by @jhorvat7 try that without lamdas/arrow
@vinodreddy-bs good catch 👌
@jhorvat7 @vinodreddy-bs @christian-bromann Thanks a lot guys for your replies.
I made a mistake in my examples... I don't have arrow functions in my code but when I got the boiler webdriverIO-with-mochaBDD, I forgot to remove it. My bad...
For the issue, @jhorvat7, I tried this:
it('Test timeout mocha', async function () {
this.timeout(120000); // 2min
});
without adding this.timeout(120000);
in the describe, and the timeout is not taken in account.
And, when I tried what you supposed to do:
describe('My description', function (){
this.timeout(120000);
it('Test timeout mocha', async function () {
this.timeout(120000); // 2min
});
});
The timeout is set for all 'it' blocks. So it works also without the this.timeout(120000);
in the it:
describe('My description', function (){
this.timeout(120000);
it('Test timeout mocha', async function () {
});
});
I thought that we can set a specific timeout for a specific 'it' block, It's what I want to do. So, what to do you think? Should this be possible ? Many thanks.
I found another way to set the timeout for a specific 'it', and it works:
it('Test timeout mocha', async function () {
}).timeout(120000);
Thanks :)
@BorisOsipov @christian-bromann can you reopen the issue please.
I am facing exactly the same issue as described by @NIBOSAP in this post after upgrading from wdio 7 to wdio8. (Same code, per it timeouts ignored with wdio8).
Thank you
Thanks for raising this issue 🙏
Unfortunately we can't help you without a reproducible example in this matter. Please read our contributing guidelines on how to create a reproducible example. If you can't provide a reproducible example we will close this issue in 7 days.
If you have any questions please reach out to us on our Discord channel. We are happy to help you out there.
@talbss feel free to create a new issue with a reproducible example
Have you read the Contributing Guidelines on issues?
WebdriverIO Version
8.27.1
Node.js Version
18
Mode
WDIO Testrunner
Which capabilities are you using?
No response
What happened?
Local Timeout for step definitions doesn't work:
In the config:
If we want to set a specific timeout for a specific mocha step:
The timeout for the step (it) is not set to 2min. And the mocha timeout appears at 1min:
Seems to be the same that the one for cucumber: https://github.com/webdriverio/webdriverio/issues/11873
What is your expected behavior?
Timeout must be taken into account
How to reproduce the bug.
use repo - https://github.com/NIBOSAP/webdriverIO-with-mochaBDD
and run:
Relevant log output