Skip to content Skip to sidebar Skip to footer

"window.angular Is Undefined." When Using Protractor For Automated Testing?

I seem to have an error when using the example conf.js provided with protractor. I am running my tests with grunt-protractor-runner but it errors even when using the example config

Solution 1:

Exclaimer!!: This doesn't answer your question as such but provides a hack to solve it.

Protractor requires the Angular page to finish synchronization before it runs it's expectations. Therefore, in order to work around this issue you can use:

browser.ignoreSynchronization = true;
browser.waitForAngular();
browser.sleep(500); 

This tells the browser that protractor opens to not wait for the Angular to synchronize (ignoreSynchronization), then it waits for angular to finish everything else it's doing, then it adds a 500 millisecond wait to give protractor a chance to find addButton.click(). When the wait finishes, it forces protractor to move onto the next line of code which contains your expect, before this, it was stopping at the addButton.click() line and waiting for the sync (which wasn't happening), before it moved on.

(I think...)

Solution 2:

I have exactly the same problem (Protractor 3.1.0 with Jasmine2). It seems to me that the browser.get() in your beforeEach() call is the culprit. Copying that to each test could be a workaround.

Solution 3:

i faced same issue and it resolved for me :-

1. downgrade protractor to 3.0.0
2. add jasmine2 in conf.js 

Post a Comment for ""window.angular Is Undefined." When Using Protractor For Automated Testing?"