Skip to content

waitForElement has been deprecated message showing even when not used #468

Closed
@stevenfitzpatrick

Description

@stevenfitzpatrick
  • @testing-library/react version: ^10.0.0-beta.2
  • react version: 16.13.0
  • node version: 12
  • npm (or yarn) version: 1.12.2

Relevant code or config:

  it.only('should not submit with empty fields', async () => {
    const { username } = renderLogin();

    user.type(username, variables.username);
    user.click(screen.getByText(/Login/i));
    await screen.findByText('Password is required');
    screen.debug();
  });

What you did:

Run above test with latest beta version

What happened:

Test passes however in my console I get a deprecation warning for API I didn't use

 console.warn node_modules/@testing-library/dom/dist/wait-for-element.js:17
    `waitForElement` has been deprecated. Use a `find*` query (preferred: https://testing-library.com/docs/dom-testing-library/api-queries#findby) or use `wait` instead (it's the same API, so you can find/replace): https://testing-library.com/docs/dom-testing-library/api-async#wait

Suggested solution:

Only show above warning if waitForElement is used

image

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