Why use protractor for e2e testing?

Information below valid as at 14/01/2014.
Pros:
  • Cutting edge technology
  • AngularJS developed
  • They are using it to replace ngScenario runner (ie – it will be supported in the future)
  • Protractor knows it’s an Angular App
  • Uses ng features like smart wait/sleeps for angular services (ie – Protractor watches the $http module and automatically adds in sleeps for you while your requests are pending and your page is rendering. So you no longer have to guess how long a request is going to take and then you don’t have to worry about your tests failing because a request took too long).
  • Uses ng features such for bindings, repeaters etc… (ie – bindings use partial match search, grab repeated elements by either row or column)
  • Uses patched versions of jasmine to negate the use of promises (ie – .then() and done() etc… exclusion of these leads to cleaner test code).
  • Protractor is a wrapper on WebDriverJS which allows you to perform live tests of your websites (A Web Driver or an E2E test can run a full integration test through a given URL on your website and can provide data on whether any JavaScript errors occurred).
  • Allows you to do native event firing – close to actual user simulation you can get.
Cons:
  • Currently has limited support for MOCHA
  • Requires Selenium Server (+ Webdriver & Chromedriver)
  • Currently requires patch for PhantomJS to work
See a video by Julie Ralph about Protractor: http://www.youtube.com/watch?v=BvAeabvZ61o (skip to 31:00)
View protractor’s syntax in the repo’s e2e tests: https://github.com/angular/protractor/blob/master/spec/basic/findelements_spec.js
More notes:
Sam is a passionate web developer, online entrepreneur and investor. In his spare time he enjoys coding, playing chess and reading.

6 thoughts on “Why use protractor for e2e testing?

    1. When I was using it a couple months ago you needed to patch in some code to get it work with Selenium server. I’m not sure if it’s been fixed or not yet. Sorry for the late reply.

        1. It does work really well mate once you get it going. I’ll draw up a testing post and some working code you can use soon as I’m needing it for a project I’m doing atm also.

Leave a Reply

Your email address will not be published. Required fields are marked *