6

I have some code in my AngularJS app which displays/hides some divs using animations like: $(el).fadeOut().

How can I disable the animations when testing with protractor using: http://api.jquery.com/jQuery.fx.off ? Can I somehow run that small piece o code in the browser directly from protractor?

lucassp
  • 4,133
  • 3
  • 27
  • 36

1 Answers1

8

Found it:

var ptor = protractor.getInstance();
ptor.get("http://localhost:9000/");
ptor.driver.executeScript("$.fx.off = true;");
lucassp
  • 4,133
  • 3
  • 27
  • 36
  • 2
    Some time after this was posted the syntax changed. It is now browser.executeScript('$.fx.off = true'): There is also this way: http://gitelephant.cypresslab.net/angular-js/commit/82213efff23a71ca37e1a99c11ef6bc49b1af1eb which works pretty well. – MBielski Aug 27 '14 at 21:02
  • @MBielski That link is dead. Can you post what was on the other end as another answer to this question? – Mattie Dec 14 '17 at 19:22
  • Looks like this might be useful, but it may be specific to Angular: https://stackoverflow.com/questions/26584451/how-to-disable-animations-in-protractor-for-angular-js-application – MBielski Dec 15 '17 at 16:23