question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`waitFor` with nested `expect` timeout in v9

See original GitHub issue

Describe the bug

Hey guys, I’ve been banging my head for hours following a migration to v9. I had some timeout issues with a waitFor and I thought it was related to the timers thingy, but in fact in seems related to a nested expect in my waitFor it looks like it could be related to timers.

This works:

await screen.findByA11yRole('progressbar', { interval: 10 }); // Need more aggressive interval to catch the spinner before it is removed
waitForElementToBeRemoved(() => screen.getByA11yRole('progressbar'));

This doesn’t and acts weird:

await screen.findByA11yRole('progressbar', { interval: 10 }); // Need more aggressive interval to catch the spinner before it is removed
await waitFor(() => {
  expect(screen.queryByA11yRole('progressbar')).toBeFalsy();
});

When debugging the waitFor it appears to ignore interval or even timeout settings and is executed only twice, once right away and once when the default timeout hits.

Expected behavior

To work

Steps to Reproduce

Feels like this should be easily reproducible. I’ll look into it if not.

Screenshots

Versions

    @testing-library/react-native: ^9.0.0 => 9.0.0 
    react: 17.0.2 => 17.0.2 
    react-native: 0.65.1 => 0.65.1 
    react-test-renderer: ^17.0.2 => 17.0.2 ```

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
florian-milkycommented, Sep 30, 2022

Sorry didn’t have time to really follow up on that. I will test again with the latest version and report at least

1reaction
mdjastrzebskicommented, Sep 30, 2022

Closing as stale.

@florian-milky If the issue still occurs on the latest version of RNTL, please provide a minimal repro repository, hopefully based on examples/basic folder from our repo, so that we can better understand the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jest react testing: Check state after delay - Stack Overflow
For example this code will wait for 2 seconds: await new Promise((r) => setTimeout(r ... 30000 will make sure to not timeout for...
Read more >
Configuring timeouts in Spring reactive WebClient
This article is about configuring the read and connect timeout values when using Spring WebClient. It explains the difference between reactive signal ...
Read more >
How to time out Jenkins Pipeline stage and keep the pipeline ...
Now it works just as we expect. The A stage gets executed, and it is acceptable to timeout. The pipeline continues in such...
Read more >
Troubleshoot CloudFormation stacks that are stuck in progress
In most situations, you must wait for your CloudFormation stack to time out. The timeout length varies, and is based on the individual ......
Read more >
How to Fix a Lock Wait Timeout Exceeded Error in MySQL
The above simply means the transaction has reached the innodb_lock_wait_timeout ; After T2 was successfully committed, one would expect to get ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found