如何在角度 js 应用程序的量角器中禁用动画 [英] How to disable animations in protractor for angular js application
本文介绍了如何在角度 js 应用程序的量角器中禁用动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
谁能建议我在执行量角器测试时如何在 angular js 应用程序中禁用动画.我在量角器配置文件中添加了以下代码,但这对我没有帮助:
Can anyone suggest me how to disable animations in angular js application while executing protractor tests. I have added below code in my protractor config file but that does not help me:
var disableNgAnimate = function() {
angular.module('disableNgAnimate', []).run(function($animate) {
$animate.enabled(false);
});
};
browser.addMockModule('disableNgAnimate', disableNgAnimate);
推荐答案
你可以查看 angular 的量角器配置:https://github.com/angular/angular.js/blob/master/protractor-shared-conf.js
You can check out the angular's protractor configuration: https://github.com/angular/angular.js/blob/master/protractor-shared-conf.js
您应该将其添加到 onPrepare 块下:
You should add it under onPrepare block:
onPrepare: function() {
/* global angular: false, browser: false, jasmine: false */
// Disable animations so e2e tests run more quickly
var disableNgAnimate = function() {
angular.module('disableNgAnimate', []).run(['$animate', function($animate) {
$animate.enabled(false);
}]);
};
browser.addMockModule('disableNgAnimate', disableNgAnimate);
这篇关于如何在角度 js 应用程序的量角器中禁用动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文