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

Wait function not working as expected after testing-library-dom update #290

Open
davidmateoc opened this issue Jun 7, 2021 · 1 comment
Labels
help wanted Extra attention is needed STATE: Need response

Comments

@davidmateoc
Copy link

Description
New version of testing-library-dom is deprecating wait function for waitFor, breaking some existent tests using a previous version (“6.14.0”).

Could be due to this change:

Previously, wait was a wrapper around wait-for-expect and used polling instead of a MutationObserver to look for changes. It is now an alias to waitFor and will be removed in a future release.

This causes the following error when trying to use the wait/waitFor function for an element that needs to appear in the browser:

         92 |  if (typeof window === 'undefined') {
       > 93 |    throw new Error('Could not find default container'); 

Steps to reproduce:

  1. Use the wait/waitFor function for an element in the page
    Example:
    await waitFor(async () => t.expect(findByRole('table')).eql(vehiclesToBeDeleted.length))

Expected behavior
Behavior of wait function is not changed and still can be used to wait for browser elements.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: macOS 10.15.7
  • Browser: Chrome
  • Version 91.0.4472.77

Additional context
The same test passes if testing-library-dom (“6.14.0”) is used instead.

Error logs:

   1) Error: Could not find default container

      Browser: Chrome 91.0.4472.77 / macOS 10.15.7

         88 |exports.clearTimeout = clearTimeoutFn;
         89 |
         90 |function getDocument() {
         91 |  /* istanbul ignore if */
         92 |  if (typeof window === 'undefined') {
       > 93 |    throw new Error('Could not find default container');
         94 |  }
         95 |
         96 |  return window.document;
         97 |}
         98 |
@benmonro
Copy link
Member

benmonro commented Jun 9, 2022

would welcome a PR for this

@benmonro benmonro added the help wanted Extra attention is needed label Jun 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed STATE: Need response
Projects
None yet
Development

No branches or pull requests

2 participants