在花了一天半的代码争夺之后,我意识到e2e测试被绞死了,因为我已经手动启动而不使用ng-app指令
首先,仅供参考。
第二,任何想法为什么?如何解决?感谢
利奥尔
- 编辑:这是两个显示它的蠢事,使用phone-cat教程示例:
适用于浏览器和e2e: http://plnkr.co/edit/AfLsug1LRi0euKf7TWJa
在浏览器中以交互方式工作,在e2e runner中不起作用: http://plnkr.co/edit/20OeZ5eV2ZbzgS1qDYfr
答案 0 :(得分:4)
Scenario runner似乎需要获得ng-app(对于$ injector)。我改编了the fix identified here by Vojta Jína,它对我有用。
$(function() {
var myApp = $('#appId'); // Use whatever selector is appropriate here.
angular.bootstrap(myApp, [modules]); // modules is optional - see http://docs.angularjs.org/api/angular.bootstrap
myApp.addClass('ng-app'); // Adds the required ng-app
});
此外,您可能需要在pause
中添加wait
或beforeAll
,以便有足够的时间完成手动自举,例如
beforeEach(function() {
browser().navigateTo('../../index.html');
pause();
});
这个解决方案有效,但它不是那么令人满意的imho。有没有办法摆脱暂停/等待?