I have to write tests for a website that is an Angular application and has a ton of Animations. Almost everything has a "mini" window that slides in from the top and goes in the center and then its contents sldie in from the right till they go in it and so on.
This breaks my tests, A LOT. Protractor sees the elements since they are shown but it cant click on them because they are moving and it throws an error saying that other element will receive the click. This happens very often and I do not know how to handle it (except using browser.sleep(xxxx)).
Is there any solution to this except using the sleep function? If I really have no other option I have to use it every on 2nd row...
**I have tried this browser.manage().timeouts().implicitlyWait(30000);
and it did not help.
P.S. I also have cases where Protractor tries to click on an element before it is visible.
I can make a short video to show what are the animations if its 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 also tried adding the following in my config file to disable animations:
onPrepare: function() {
var disableNgAnimate = function() {
angular.module('disableNgAnimate', []).run(['$animate', function($animate) {
$animate.enabled(false);
}]);
};
browser.addMockModule('disableNgAnimate', disableNgAnimate);
}