Skip to content

waitFor does not return the callback's returned value. #73

Description

@Izhaki

The waitFor exported by this library does not seem to be complaint with the testing-library API, where it should return the callback's return value.

In the following code, x will have a value, but y wouldn't:

  const y = await waitFor(async () => {
    const $container = await getContainer();
    const x = await queries.findByRole($container, ...parameters);
    console.log(x);
    return x;
  });
  console.log(y);

We have a case where a user action opens a new tab, so we need to retry getting the page itself, not just the dom query.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions