使用量角器测试AngularJS应用时禁用动画

luc*_*ssp 6 angularjs jquery-animate protractor

我在AngularJS应用中的一些代码,显示/隐藏动画使用像一些div: $(el).fadeOut().

如何使用量角器进行测试时禁用动画:http://api.jquery.com/jQuery.fx.off?我可以直接从量角器以某种方式在浏览器中运行那小块代码吗?

luc*_*ssp 8

找到了:

var ptor = protractor.getInstance();
ptor.get("http://localhost:9000/");
ptor.driver.executeScript("$.fx.off = true;");
Run Code Online (Sandbox Code Playgroud)

  • 发布后一段时间,语法发生了变化.它现在是browser.executeScript('$.fx.off = true'):也有这样的方式:http://gitelephant.cypresslab.net/angular-js/commit/82213efff23a71ca37e1a99c11ef6bc49b1af1eb,效果很好. (2认同)