javascript - Protractor - How to handle site that is heavily animated? -
i have write tests website angular application , has ton of animations. has "mini" window slides in top , goes in center , contents sldie in right till go in , on.
this breaks tests, lot. protractor sees elements since shown cant click on them because moving , throws error saying other element receive click. happens , not know how handle (except using browser.sleep(xxxx)).
is there solution except using sleep function? if have no other option have use every on 2nd row...
**i have tried browser.manage().timeouts().implicitlywait(30000);
, did not help.
p.s. have cases protractor tries click on element before visible.
i can make short video show animations if needed.
test.describe('profile tests: ', function(){ this.timeout(0); test.before(function(){ browser.get('......'); }); test.it('change username', function() { var newusername = 'sumuser'; welcome.continuelink.click(); bonus.takebonus.isdisplayed().then(function() { bonus.takebonus.click(); }); entrance.openentrance.click(); browser.sleep(300); loginbasic.opennormallogin.isdisplayed().then(function() { loginbasic.opennormallogin.click(); }); browser.sleep(300); login.usernamefield.isdisplayed().then(function() { login.usernamefield.sendkeys(username); }); login.passwordfield.sendkeys(password); login.loginbutton.click(); infobar.avatar.click(); browser.sleep(1000); myprofile.editprofilebutton.click(); browser.sleep(1000); username.field.clear(); username.field.sendkeys(newusername); editprofilebuttons.savechanges.click(); browser.sleep(1000); myprofile.username.gettext().then(function (text){ expect(text).to.equal(newusername); }); }); });
i have tried adding following in config file disable animations:
onprepare: function() { var disablenganimate = function() { angular.module('disablenganimate', []).run(['$animate', function($animate) { $animate.enabled(false); }]); }; browser.addmockmodule('disablenganimate', disablenganimate); }
explicit waits browser.wait()
might make tests more reliable.
for instance, wait element become clickable:
var ec = protractor.expectedconditions; var elm = element(by.css(".myclass")); browser.wait(ec.elementtobeclickable(elm), 5000);
you can entirely turn off angular animations, see:
Comments
Post a Comment