Skip to content

Unify waitForElement to Testing Library signature #318

Closed
@mdjastrzebski

Description

@mdjastrzebski

Describe the Feature

Current signature for waitForElement is:

function waitForElement<T>(
  expectation: () => T,
  timeout: number = 4500,
  interval: number = 50
): Promise<T> {

Testing Library, has a similar signature

function waitFor<T>(
  callback: () => void,
  options?: {
    timeout?: number
    interval?: number
  }
): Promise<T>

where timeout and interval are moved into optional options object. Benefits of options object vs positional arguments are:

  1. better usage readability: named options { timeout: 1000 } vs positional argument (..., 1000))
  2. options arguments is open for extension of adding more options.

Also we should rename waitForElement as waitFor for Testing Library compatibility. In TL waitForElement is deprecated with info to use waitFor & findBy instead.

Possible Implementations

Change signature for waitForElement to use options optional argument.

Related Issues

#158

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions