Function

import { registerWaiter } from '@ember/test';
context
Object
(optional)
callback
Function

This allows ember-testing to play nicely with other asynchronous events, such as an application that is waiting for a CSS3 transition or an IndexDB transaction. The waiter runs periodically after each async helper (i.e. click, andThen, visit, etc) has executed, until the returning result is truthy. After the waiters finish, the next async helper is executed and the process repeats.

For example:

1
2
3
4
5
import { registerWaiter } from '@ember/test';

registerWaiter(function() {
  return myPendingTransactions() === 0;
});

The context argument allows you to optionally specify the this with which your callback will be invoked.

For example:

1
2
3
import { registerWaiter } from '@ember/test';

registerWaiter(MyDB, MyDB.hasPendingTransactions);