ember-test-helpers: `click()` helper is not reliable
// in my new ember acceptance tests
await click('[data-test-username-button]');
assert.equal(currentURL(), '/izelnakri'); // this doesn't pass!
click helper doesnt wait for url transition. It could be either due to fact that ember click selector ignore attribute selectors [data-test-username-button] or its waiter is simply buggy.
Unfortunately I already removed a branch in my project where I was refactoring my application tests one by one to new ember application test/qunit modules. I succeeded with unit + integration tests but failed on application tests.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 17 (10 by maintainers)
I will add my two cents here, however, I believe this is more of a problem with
settled()than it is click.I have a
link-tocomponent which transitions routes, and theclick(settled) is returning control to the test between model and afterModel.I tried to create an ember-twiddle to show my problem, however, twiddle is not properly loading the visit function from @ember/test-helpers
templates/my-route.hbs
routes/failing-route/view.js
tests/acceptance/failing-route-test.js
If I change the model hook to return the model directly, or return Promise.resolve(model) the test passes. Otherwise, it fails.
You people still have this issue? @Turbo87 @rwjblue the Ember Twiddle posted by @raphaelns-developer reproduces the issue.
@viniciussbs the linked twiddle does not seem to reproduce it for me 🤔
@ggayowsky in your snippet you’re never resolving the returned promise
@allsince this appears to be solved with the most recent releases I’ll close this as solved. if you run into this issue, please make sure you don’t have@ember/test-helperslocked to an older version.