emberjs / emberjs/ember-test-helpers
Test not waiting promises
- Dominant language
- JavaScript
- Stars
- 188
- Forks
- 254
- PR merge metrics
- No merged PRs in 30d
Description
### Problem
The test is not waiting the promise to return the data.
Ember version: 3.4
### Test scenario
I'm using `triggerKeyEvent` to trigger an action at a text input:
```js
await fillIn('[data-test-search-input]', 'Test');
await triggerKeyEvent('[data-test-search-input]', 'keydown', 13);
await settled();
```
The action goes on a server and gets some data:
```js
actions: {
onTriggerKey() {
return this.getDataFromServer().then(data => set(this, 'data', data));
}
}
```
But i'm facing some strange behaviours. Sometimes the `await settled()` wait the promise return the data and sometimes not. This is very hard to reproduce because the test pass in the most of the times.
Contributor guide
Assessment
This issue has not been assessed yet.