本文介绍了噶(AKA Testacular)依靠NG-应用指令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每天花费和code战役的一半之后,我意识到,端到端测试绞死,因为我已经手动而不是使用bootstraped NG-应用指令

After spending a day and a half of code battles, i've realized that the e2e tests hanged because i've bootstraped manually and not using ng-app directive

首先,仅供参考。

第二,任何想法,为什么?怎样才可以解决吗?

second, any idea why? How can it be fixed?

感谢

利奥尔

-
编辑:here're 2 plunks,显示它,使用电话的猫教程例如:

-- here're two plunks that show it, using phone-cat tutorial example:

工作在两个浏览器和E2E:

works in both browser and e2e:http://plnkr.co/edit/AfLsug1LRi0euKf7TWJa

交互工作在浏览器中,E2E亚军不工作:

works interactively in browser, doesnt work in e2e runner:http://plnkr.co/edit/20OeZ5eV2ZbzgS1qDYfr

推荐答案

情景亚军似乎需要得到NG-应用的保持(为$喷油器)。我适应这里确定的修复和它的工作了我的。

Scenario runner appears to need to get a hold of ng-app (for the $injector). I adapted the fix identified here by Vojta Jína and it worked for me.

$(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
});

此外,你可能需要把暂停 beforeAll ,以便有足够的时间进行手动引导来完成,例如,

In addition, you may need to put a pause or wait in your beforeAll to allow enough time for manual bootstrapping to complete, e.g.,

beforeEach(function() {
   browser().navigateTo('../../index.html');
   pause();
});

此修复工作,但它并不令人满意恕我直言。有什么办法摆脱暂停/等待?

This fix works but it's not that satisfactory imho. Is there any way to get rid of the pause/wait?

这篇关于噶(AKA Testacular)依靠NG-应用指令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 10:47