Skip to content

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

Open
@Izhaki

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.

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