Showing posts with label Protractor. Show all posts
Showing posts with label Protractor. Show all posts

Monday, May 30, 2016

Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.

TL;DR

Your test/spec, a single it block, spends a too damn long time to finish.
Increase the value of jasmineNodeOpts.defaultTimeoutInterval in protractor.conf.js
Or give it an additional arguments to specifically set timeout.

Wednesday, March 9, 2016

Thursday, February 25, 2016

The black hole in localStorage.setItem()

TL;DR

To fake some local storage data in Protractor E2E test, care about 2 things:
  • localStorage can not store Object directly, so you have to JSON.stringify it and then JSON.parse to get it back.
  • browser.executeScript actually returns a Promise, so you should JSON.parse the data received by its then function.

How to mock $httpBackend in protractor

Some say this is not a good idea since end-to-end test should be genuinely END-TO-END, not END-TO-itself, ......whatever, I just need it.

My solution is based on this post, but I got 2 problems which screwed me good.

Tuesday, January 5, 2016

E2E Test - Protractor - Redirect to non-angular page

This one happens when I try to redirect browser to a non-angular web page in my e2e-test.
I got the following error message:

 Failed: Error while waiting for Protractor to sync with the page: "window.angular is undefined. This could be either because this is a non-angular page or because your test involves client-side navigation, which can interfere with Protractor's bootstrapping. See http://git.io/v4gXM for details"  


Wednesday, December 30, 2015

E2E Test - Protractor - Wait for google map markers to present

The problem is that in my e2e-test I expect markers to present on map too early before google maps api actually rendering them.

This is, or should be, an easy one, nevertheless it pained my ass because I'm a stinky newbie to Protractor.