运行visit()
时,Ember过渡正确:
Transitioned into 'auth'
,
然而,PhantomJs不加载:
[D] ["phantomjs","onLoadFinished","fail"]
如何解决这个问题,为什么visit()
不起作用?
在使用yo ember
生成的项目中,我有以下测试规范:
var assert = chai.assert;
var expect = chai.expect;
var should = chai.should();
App.rootElement = '#main';
App.setupForTesting();
App.injectTestHelpers();
(function () {
'use strict';
beforeEach(function() {
Ember.run(function() {
App.reset();
});
Ember.testing = true;
});
afterEach(function() {
Ember.testing = false;
});
describe('Basic', function () {
describe('Smoke test', function() {
visit('/auth');
it('Should contain a header', function() {
expect($('.main').length).to.equal(1);
});
});
});
})();
当我运行grunt test --debug
时,我得到以下输出:
[D] ["phantomjs","console","generated -> controller:application [object Object]"]
generated -> controller:application [object Object]
[D] ["phantomjs","console","Rendering application with default view <(subclass of Ember.View):ember650> [object Object]"]
Rendering application with default view <(subclass of Ember.View):ember650> [object Object]
[D] ["phantomjs","console","Rendering auth with <App.AuthView:ember664> [object Object]"]
Rendering auth with <App.AuthView:ember664> [object Object]
[D] ["phantomjs","console","Transitioned into 'auth'"]
Transitioned into 'auth'
[D] ["phantomjs","onLoadFinished","fail"]
[D] ["phantomjs","fail.load","http://localhost:9001/index.html"]
...ERROR
Warning: PhantomJS unable to load "http://localhost:9001/index.html" URI. Use --force to continue.
Aborted due to warnings.