ember-table
ember-table copied to clipboard
Acceptance tests don't always wait for column sort
I have a number of acceptance tests for my application that await a click on an ember-table header cell to activate column sorting and then assert against the table contents to ensure that the table is sorted correctly. This helps me make sure that my custom sorting logic is being reflected properly by the output of the table.
Since the 2.2.2 release of ember-table, these tests have started failing at random times (and not consistently on the same sort). I'm not sure if this might be related to the refactor in https://github.com/Addepar/ember-table/pull/802 or not, but the await click is resolving before ember-table finished sorting the table contents.
For now, I've added a short (100ms) timeout after clicking a table header before I assert on the table contents. This seems to work around the issue for now, but it would be better if we could track down the root cause so await click would block until sorting is complete.
We noticed a similar problem not just while sorting, but while initially rendering the table.
The settled state from the ember test helpers does not seem to wait for the table to be completely up-to-date.
Note that I have found this issue to be resolved when using the ember-raf-scheduler test waiter mentioned in https://github.com/Addepar/ember-table/issues/956
I'll close this for now since that test waiter has fixed this issue for us (and the linked issue suggests better documenting this).
Still doesn't work for me on ember-table v5.0.0
@rreckonerr Are you using setupEmberTableForTest() before each test? It configures the test waiter necessary to make this work. See the README: https://github.com/Addepar/ember-table#writing-tests-for-ember-table-in-your-application