0

I'm newcomer with protractor and now my work needs is to create testing project for angularjs application. I've started with guidelines and faced with error on start:

Error: Uncaught Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!
Watchers fired in the last 5 iterations: []
http://errors.angularjs.org/1.4.0/$rootScope/infdig?p0=10&p1=%5B%5D
http://localhost/main-f3fbd0c72e8415cd0a449214b66bdacc-cached.js:2140
    at window.onerror (http://localhost/main-f3fbd0c72e8415cd0a449214b66bdacc-cached.js:1277:52)

Configuration file

  exports.config = {
    directConnect: true,

    seleniumAddress: 'http://localhost:4444/wd/hub',

    capabilities: {
       'browserName': 'chrome'
    },
    specs: ['specs/spec.js'],

    jasmineNodeOpts: {
       showColors: true,
       defaultTimeoutInterval: 30000
    }
};

Test file:

    "use strict";

    describe('WEB test project', function() {

    var wl5StartPage = require('../pages/startPage.js');
      it('Its start login page', function() {
        wl5StartPage.get();  
        wl5StartPage.wl5Login();
    });
  });

startPage.js:

var WL5LoginPage = function() {

    this.userName = element(by.model('loginInfo.userId'));
    this.loginButton = element(by.css('[ng-click="login()"]'));

    this.get = function() {
        browser.get('http://localhost/login');
    };

    this.wl5Login = function() {    
        this.userName.sendKeys("user1");
        this.loginButton.click();
    };
}

module.exports = new WL5LoginPage();

Its very simple test, but unfortunatelly it crashed when I entered username and clicked "Login". Is there some way to ignore such browser errors? Or some way to fix problem?

Thank you in advance.

1 Answers1

1

Basically there is nothing wrong with protractorJS code. Reason why you are seeing this - it is because your angular application throws this error. Protractor is trying to wait for angular on the page - but can't . Seems like your error is similar to this one - Error: 10 $digest() iterations reached. Aborting! with dynamic sortby predicate

I would suggest only as a temporary solution to disable protractor's waitForAngular just to debug your test:

browser.waitForAngularEnabled(false)

http://www.protractortest.org/#/api?view=ProtractorBrowser.prototype.waitForAngularEnabled

But i am 99% sure that this is something that must be fixed on frontend side to allow smooth test automation with automatic waiting for angular.

UPDATE: Also you might try to turn on this property in your protractor config - https://github.com/angular/protractor/blob/master/lib/config.ts#L485

Community
  • 1
  • 1
Xotabu4
  • 3,063
  • 17
  • 29