[go: up one dir, main page]

Skip to content
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]: The executeAsync method from shim.js does not get the timeout from it hook, which is causing the tests with custom timeout to throw a Timeout error. #13342

Open
3 tasks done
MonaDotasara opened this issue Aug 8, 2024 · 3 comments
Labels
Bug 🐛 help wanted Issues that are free to take by anyone interested

Comments

@MonaDotasara
Copy link

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

8.39.0

Node.js Version

20.16.0

Mode

WDIO Testrunner

Which capabilities are you using?

No response

What happened?

I have timeout defined for tests in the it hook (spec) which is greater than jasmineOpts.defaultTimeoutInterval specified in the wdio configuration. But during the execution, the timeout defined for the spec is neglected and a Timeout error is thrown as soon as the defaultTimeoutInterval is complete.

While debugging I found that the executeAsync method defined in the node_modules/@wdio/utils/build/shim.js file is trying to set the timeout and it is neglecting the custom timeout defined in spec and setting it to defaultTimeoutInterval as the this?.runnable?._timeout is always shown as undefined from below code when this method is called.

const _timeout = (this?.runnable?._timeout || globalThis.jasmine?.DEFAULT_TIMEOUT_INTERVAL || timeout) - TIME_BUFFER;

Note: I am using jasmine framework with WDIO.

What is your expected behavior?

The test should continue the execution for the time defined in the spec and should pass.

How to reproduce the bug.

  1. Set the jasmineOpts.defaultTimeoutInterval to 10 seconds in wdio.conf.ts file.
  2. Create a simple .ts file with a timeout of 15 seconds with below code:

describe('Debug Suite', () => {
it('Debugging Test', async () => {
console.log('Wait for 12 seconds');
await new Promise(r => setTimeout(r, 12000));
console.log('12 secs wait is complete');
}, 15000);
});

  1. Run the test.

Relevant log output

[chrome 127.0.6533.89 windows #0-0] Running: chrome (v127.0.6533.89) on windows
[chrome 127.0.6533.89 windows #0-0] Session ID: a27b6029777683101c340acb2b093af3
[chrome 127.0.6533.89 windows #0-0]
[chrome 127.0.6533.89 windows #0-0] » file:///C:/Automation/sirenum/e2e-tests/specs/debug.spec.ts
[chrome 127.0.6533.89 windows #0-0] Debug Suite
[chrome 127.0.6533.89 windows #0-0]     Debugging Test
[chrome 127.0.6533.89 windows #0-0]
[chrome 127.0.6533.89 windows #0-0] 1 failing (10.1s)
[chrome 127.0.6533.89 windows #0-0]
[chrome 127.0.6533.89 windows #0-0] 1) Debug Suite Debugging Test
[chrome 127.0.6533.89 windows #0-0] Error: Timeout
[chrome 127.0.6533.89 windows #0-0]     at listOnTimeout (node:internal/timers:581:17)
[chrome 127.0.6533.89 windows #0-0]     at processTimers (node:internal/timers:519:7)

Spec Files:      0 passed, 1 failed, 1 total (100% completed) in 00:00:14

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues
@MonaDotasara MonaDotasara added Bug 🐛 Needs Triaging ⏳ No one has looked into the issue yet labels Aug 8, 2024
@christian-bromann christian-bromann added Reproducible Example Missing and removed Needs Triaging ⏳ No one has looked into the issue yet labels Aug 9, 2024
@wdio-bot
Copy link
Contributor
wdio-bot commented Aug 9, 2024

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.

@MonaDotasara
Copy link
Author

@christian-bromann Please find the below link for the repository created for the issue reproduction:
https://github.com/MonaDotasara/WDIO-Jasmine

Steps:

  1. Clone the repository:

git clone https://github.com/MonaDotasara/WDIO-Jasmine.git

  1. Run the command npm install to install the dependencies.
  2. Run the command npm run test to execute the tests.

@christian-bromann christian-bromann added help wanted Issues that are free to take by anyone interested and removed Reproducible Example Missing labels Aug 14, 2024
@wdio-bot
Copy link
Contributor

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🐛 help wanted Issues that are free to take by anyone interested
Projects
None yet
Development

No branches or pull requests

3 participants