Mato.Duris
Mato.Duris

Reputation: 253

Protractor synchrozation - timeout

I am writing simple protractor test four our application:

When i want to write angularhs test - i got this error (following this installation) :

Timed out waiting for Protractor to synchronize with the page after 40002ms. Please see https://github.com/angular/protractor/blob/master/docs/faq.md

Config:

exports.config = {
  seleniumAddress: 'http://localhost:4444/wd/hub',
  specs: ['login-spec.js'],
  baseUrl: 'https:/xyz/',
  allScriptsTimeout: 40000,

  capabilities: {
    'browserName': 'firefox'
  }
}

And my spec:

describe('Login #1', function() {
  // BEFORE LOGIN
  it('should pass to next login step', function() {
    browser.driver.get('https://xyz/login');
    browser.driver.findElement(by.css(".factorFirst > [name='username']:first-child")).sendKeys('123456');

    .... other login stuff

  }, 90000);

  // AFTER LOGIN TEST
  it('Simple Angular Test', function() {
    browser.get('/page');

    element(by.model('payment.userSpecified.message')).sendKeys(1);

  }, 45000);


});

We don't have in our body element attribute ng-app. Can this be a problem?

Upvotes: 1

Views: 2468

Answers (1)

alecxe
alecxe

Reputation: 473763

You need to let protractor know that the login page is non-angular and it doesn't need to wait for angular to "settle down". Set the ignoreSynchronization to true before login and set it back to false after:

describe('Login #1', function() {

  afterEach(function () {
    browser.ignoreSynchronization = false;
  });

  it('should pass to next login step', function() {
    browser.ignoreSynchronization = true;

    browser.driver.get('https://xyz/login');
    browser.driver.findElement(by.css(".factorFirst > [name='username']:first-child")).sendKeys('123456');
  }, 90000);

  it('Simple Angular Test', function() {
    browser.get('/page');

    element(by.model('payment.userSpecified.message')).sendKeys(1);

  }, 45000);
});

Upvotes: 1

Related Questions