Acceptance tests and Travis CI

I have started to write acceptance tests for my web project (with ember-cli-mirage). As they were working correctly, I have setup Travis. And I find an issue that I can’t understand.

Let’s assume that in my test, I will fill the form and new record appears on the page with the link to the detail page.

  await fillIn(formFields[0], 'hugo');
  await fillIn(formFields[1], 'description of hugo');
  await click(find('form button'));

  assert.ok(find('table tr td a')[0].href.endsWith('/cluster/my/acl/role/hugo'));

After the record is sent to the backend (without ID), we receive valid server-generated ID and link appears. But this does not work on Travis/github. So I have changed relevant part to the:

andThen(function() {
    assert.ok(...);
});

This should be better as andThen() should wait until RunLoop is empty. But even this is not enough. My final code looks like:

andThen(function() {
  Ember.run.later(function() {
    assert.ok(...);
  }, 1000);
});

This works on both Travis and my local machines (ember test --server). Why I have to add run.later() to my code? And what can I do remove that wait time and just wait until everything is ready?

Thanks a lot.