Test is not recognizing element on page even though it's there


#1

This is my test I have so far:

test('add a new contract', function(assert) {
  visit('/contracts');

  andThen(function() {
    click('a.add-popup');
    });
  });
});

However, it’s not seeing the a.add-popup element. There is an a tag with a class of add-popup on the page. Does anybody know why it isn’t being recognized?

Thank you for any help.


#2

It’s possible that the app looks different in your testing environment vs visiting the URL directly.

You might want to try to using the pauseTest helper inside that andThen callback. That’ll let you interact with the application inside the teeny window in qUnit so you can validate there wether that a.add-popup element is present.


#3

That gives me an error pauseTest is not defined… I’m using Ember 1.13 so I’m not sure if that helper is not defined in this version or if it is part of the newest release of Ember.

Thank you for your reply and help! :slight_smile: It’s much appreciated.


#4

I suspect something else might be going on as pauseTest should have been available since 1.9 (per the Ember API Docs). Weird!


#5

Does anybody else know how to do this so I can test my application better? I upgraded my entire Ember to 2.0 and still can’t get this to work.