I'm new to protractor, so please bear with me.
I've seen this question asked many times, but none of the proposed solutions are suitable for me. My app under test starts on a non-angular login page. I set browser.ignoreSynchronization = true, log in, set it back to false, and reload the page. Then I try to interact with elements on the resulting page. There's no problem with the first element, but trying to find the second element throws a type error with the message
"Failed: Cannot assign to read only property 'stack' of Timed out waiting for Protractor to synchronize with the page after 11 seconds. Please see https://github.com/angular/protractor/blob/master/docs/faq.md While waiting for element with locator - Locator: [valid locator]"
I can get it to work by leaving ignoreSychronization set to true and using sleeps, but doesn't that defeat the entire purpose of using protractor?! I could just use java+selenium, at which I'm already proficient.
I'm certain that the page is loading, and that there are no outstanding http, timeouts, or other calls. Just to be sure, I set the timeout to 2 minutes, with the same result.
My test looks something like this:
describe('this does not work', function() {
beforeEach(function() {
// log in on non-angular page
// ignoreSynchronization because this isn't an angular page
browser.ignoreSynchronization = true;
var d = browser.driver;
d.get(g.url);
var username_field = d.findElement([valid locator]);
username_field.sendKeys(username);
var next_button = d.findElement([valid locator]);
next_button.click();
var password_field = d.findElement([valid locator]);
password_field.sendKeys(password);
var login_button = d.findElement([valid locator]);
login_button.click();
// done with non-angular page
browser.ignoreSynchronization = false;
browser.get(g.url);
});
it('does not work', function() {
// if you comment out this line, the next will execute successfully
// this succeeds, so page is loaded
expect(element([valid locator]).getText()).toBe('some string');
// otherwise, the exception is thrown trying to get this element
element([valid locator]).click();
element([valid locator]).click();
});
});
Any help/pointers/suggestions would be gratefully welcomed.
EDIT: I should have included my conf.js:
exports.config = {
framework: 'jasmine',
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['./specs/**/broken_spec.js'],
useAllAngular2AppRoots: true
}