I'm trying to do some basic acceptance tests in Ember, using Mirage. I'm using only fixtures at this point to populate the test environment, just to find my feet. When I run ember in the test environment (i.e., with -e test), I can see my app is populating with expected data. And the DOM has some buttons, etc. All is well.
However, when I run a test to visit a page and click a button, the test is telling me it can't find the button. In other words, running -e test and checking localhost shows the app seems to be fine. But then checking localhost/tests has a test failing saying it can't find a button that is definitely there in the -e test screen.
I've confirmed that the button exists in the -e test environment, using both inspector and just issuing a basic jquery select at the console line.
So I assume there's something wrong in the setup or somewhere in a configuration?
In particular:
module('Acceptance | basic tests', {
beforeEach: function() {
this.application = startApp();
},
afterEach: function() {
Ember.run(this.application, 'destroy');
}
});
test('visiting /orders', function(assert) {
visit('/orders');
andThen(function() {
assert.equal(currentURL(), '/orders');
});
});
test('visiting /basic', function(assert) {
visit('/orders');
click('top-row-orders-button'); //button.top-row-orders-button fails too
andThen(function() {
assert.equal(currentURL(), '/orders');
});
});
The first test (just visiting the url) passes. The second test is where it says it can't find the button. And again, when I serve -e test, and enter this at the console: $('.top-row-orders-button') it returns the button in question.
Happy to provide any more info anyone needs. Would appreciate any help. I've been banging my head on this for a few days now with no luck.
Aucun commentaire:
Enregistrer un commentaire