Skip to content

Instantly share code, notes, and snippets.

@ariel-symphony
Created November 17, 2015 23:34
Show Gist options
  • Save ariel-symphony/4acfc04813c89d60e7a4 to your computer and use it in GitHub Desktop.
Save ariel-symphony/4acfc04813c89d60e7a4 to your computer and use it in GitHub Desktop.
Disable animations for Protractor testing
onPrepare: function() {
var disableNgAnimate = function() {
angular
.module('disableNgAnimate', [])
.run(['$animate', function($animate) {
$animate.enabled(false);
}]);
};
var disableCssAnimate = function() {
angular
.module('disableCssAnimate', [])
.run(function() {
var style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = '* {' +
'-webkit-transition: none !important;' +
'-moz-transition: none !important' +
'-o-transition: none !important' +
'-ms-transition: none !important' +
'transition: none !important' +
'}';
document.getElementsByTagName('head')[0].appendChild(style);
});
};
browser.addMockModule('disableNgAnimate', disableNgAnimate);
browser.addMockModule('disableCssAnimate', disableCssAnimate);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment