Hi, we're implementing e2e tests with protractor and our basic test does 
run perfectly locally but once running on the server, it always complain 
that angular is not defined.
First I tought it was a problem running the tests within Jenkins but 
running the same grunt task from the command line it throws the exact same 
error.
Our application is manually bootstrapped since we use AngularAMD to load 
dependencies on demand. I've tried to use some examples on the web like 
defining timeouts but it doesn't seem to work.

onPrepare: function() {// implicit and page load timeouts
  browser.manage().timeouts().pageLoadTimeout(40000);
  browser.manage().timeouts().implicitlyWait(25000);
}

When I launch on the command line on the server, I do see the multiple 
pages opening as expected but protractor always return the same error:

     Error: Error while waiting for Protractor to sync with the page: 
{"message":"angular is not defined","stackTrace":[....

If I add to the onPrepare() function

 browser.ignoreSynchronization = true;

The first test pass and all the second doesn't. 

Here is an example of our small test

"use strict";
describe('POS default route', (function() {
  var route = 'pos/index.html#';
  beforeEach((function() {
    browser.get(route);
    browser.waitForAngular();
  }));
  it('change to #/login', (function() {
    expect(browser.getCurrentUrl()).to.eventually.be.equal(browser.baseUrl + 
route + "/login");
  }));
  it('validate login', (function() {
    var userField = element(by.id('loginUser'));
    var submitButton = element(by.id('submitButton'));
    expect(submitButton.isEnabled()).to.eventually.be.false;
    expect(userField.isPresent()).to.eventually.be.true;
    userField.sendKeys("admin");
    expect(submitButton.isEnabled()).to.eventually.be.true;
    submitButton.click();
    expect(browser.getCurrentUrl()).to.eventually.match(/#\/home$/);
  }));
}));

If I run the page on the server, it does switch correctly to /home so what 
am I doing wrong? Shouldn't the tests pass/fail in any machine they run as 
long they access access to the URL?
Is there any reason why I'm observing different results?

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to