Skip to content
angelozerr edited this page Jan 22, 2016 · 7 revisions

Protractor

AngularJS Eclipse provides a support for Protractor:

  • completion, hyperlink, validation, hover for protractor inside the JavaScript Editor (see Tern Protractor support):

Protractor Completion

  • run/debug a JavaScript protractor configuration file:

Run As Protractor

Prerequisite

webdrider

Before using Run/Debug Protractor, I suggest you to read Protractor Tutorial

The server-setup explains that protractor can be used with:

  • a selenium server.
exports.config = {
  seleniumAddress: 'http://localhost:4444/wd/hub',
  specs: ['todo-spec.js']
};
  • uses directly web browser.
exports.config = {
  directConnect: true,  
  specs: ['todo-spec.js']
};

When Run/Debug Protractor is done, it doesn't start the selenium server. If you need this feature, please create an issue to see if it's possible (how to check that selenium server is already started?).

protractor

To run/debug protractor configuration file, you need to install protractor with npm like explained here. The protractor node module which contains the lib/cli.js must be hosted inside the Eclipse Workspace:

  • you can do npm install protractor in your Eclipse project location and Run/Debug Protractor will use the $YOUR_ECLIPSE_PROJECT/node_modules/protractor/lib/cli.js to start protractor.
  • or you can do npm install -g protractor and create an Eclipse Project protractor where location is the folder path of installed protractor.

Preferences

When Run/Debug Protractor is done, it searches the lib/cli.js from protractor node module to execute your protractor configuration file:

  • from your project inside node_modules/protractor/lib/cli.js
  • from the preferences (global configuration).

If you wish to run/debug your protractor configuration file with global configuration, you must configure Window / Preferences / AngularJS / Protractor default cli file to use:

Protractor Preferences

Launch

You can run/debug your protractor configuration file. At first you must convert your project to AngularJS Project in order to Run/Debug Protractor appears in the contextual menu.

Run

You can do Run As / Protractor:

Run As Protractor

The result of protractor is displayed in the Eclipse Console.

Debug

To debug a protractor configuration file, you must choose your JavaScript debugger and:

  • install a Tern Debugger from the AngularJS update site which uses the chosen JavaScript Debugger.

Install Tern Debuggers

Protractor debugger

After that you can do Debug As / Protractor:

Debug As Protractor

and you can debug your protractor configuration file in your JavaScript editor:

Debug editor

Launch Configuration

You can retrieve or create Protractor Launch configuration by opening Run/Debug Configurations dialog:

Open Run/Debug Configuration dialog

You can select or create a Protractor launch:

  • the Main tab of the Protractor launch gives the capability to select the Protractor configuration file to start:

Main tab

  • the Protractor tab of the Protractor launch gives the capability to configure the protractor lib/cli.js the debugger and the node install to use:

Protractor tab