0

During acceptance test, in order to simulate user interaction, the button on the foundation modal dialog should be clicked:

test('sets correct country name after manual lookup', function(assert) {
  visit('/sign-in');
  click('#country-name');

  Ember.run(function() {
    fillIn('#country-name', 'state');
    click('li:contains("United States")');
  });

  andThen(function() {
    assert.equal(find('#country-name').text(), 'United States');
    assert.equal(find('#country-code').text(), 1);
  });
});

but that doesn't work because of dialog appears after the code is executed -

Also I tried to wrap clicking in the Ember.run.scheduleOnce('afterRender', this, function(){ ... }} - no success either.

lessless
  • 866
  • 10
  • 27
  • Can you post your code for how you implemented the dialog? – Christopher Milne Jul 01 '15 at 15:09
  • I do think the code you have inside the ember.run should be outside of it. The helpers you are using (fillIn, click etc) should wait for asynchronous code to resolve before running the assertions – Christopher Milne Jul 01 '15 at 15:11
  • here is a full blown foundation modal test w/ a custom waitFor helper https://github.com/toranb/ember-cli-test-helpers/blob/master/tests/acceptance/wait-for-test.js – Toran Billups Jul 02 '15 at 04:03
  • Christoper, here it is https://gist.github.com/lessless/c8ab7927e6708341c48f Toran, thank you, will give it a chance! btw ember-simple-validation is really cool! Gonna open an issue with proposal today. – lessless Jul 03 '15 at 03:50

0 Answers0