mercredi 1 juillet 2015

Wait for foundation modal dialog in acceptance test

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.




Aucun commentaire:

Enregistrer un commentaire