Protractor - goatandsheep/goatandsheep.github.com GitHub Wiki

An end-to-end tester that uses Chrome

Tips

  • Protractor is very tightly knitted with Jasmine. Highly recommended that you look into that first
  • Make sure your version of chrome on the browser is the same as that of protractor:
    • ./node_modules/.bin/webdriver-manager update

Installation

npm install -g protractor

Configuration

setup a conf.js file

Selenium

Protractor doesn't come with Selenium out of the box so you have a choice of using a separate, local server or a remote server.

Local

  1. Make sure you have seleniumAddress: 'http://localhost:4444/wd/hub', in your conf.js.
  2. Run webdriver-manager start
  3. Run protractor conf.js

Remote

Remove seleniumAddress: 'http://localhost:4444/wd/hub', from your conf.js. You now use a remote Selenium server.

Test Specifications

Each test is outlined in a separate specifications file, generally named something like spec.js file. I actually like to use *.e2e.test.js

To select all elements with a given class, use element.all(by.css('.classname'))