You can run and debug tests with Protractor
right in IntelliJ IDEA.
You can see the test results in a treeview and easily navigate to the test source from there.
On this page:
Before you start
-
Make sure the Node.js
runtime environment
is installed on your computer.
- Install and enable the NodeJS repository plugin on the Plugins page as described in Installing, Updating and Uninstalling Repository Plugins and Enabling and Disabling Plugins.
Installing Protractor
You can install Protractor locally, in your project, or globally. Global installation is preferable.
To install Protractor globally
-
Open the built-in IntelliJ IDEA Terminal (press Alt+F12 or choose
on the main menu)
and type
npm install -g protractorat the command prompt.
-
To download the necessary binaries, type
webdriver-manager update.
.
You can also install the protractor package on the Node.js and NPM page
as described in NPM.
Running tests
Protractor tests are launched only through a run/debug configuration.
To create a Protractor run configuration
-
Open the Run/Debug Configuration dialog box
( on the main menu).
Alternatively, select a test file in the Project tool window and choose Create <file name> on the context menu.
-
Click
on the toolbar and select Protractor from the list.
The Run/Debug Configuration: Protractor dialog box opens.
-
Specify the Node interpreter to use, the location of the
protractorpackage, and the path to theprotractor.conf.jsconfiguration file. If you followed the standard installation, IntelliJ IDEA detects all these paths and displays them in the corresponding fields.
To run tests via a run configuration
-
Select the Protractor run/debug configuration from the list on the main toolbar
and click
to the right of the list.
The Selenium Server starts automatically without any steps from your side.
- View and analyze messages from the server in the <current_run_configuration_name> tab of the Run tool window.
Navigation
With IntelliJ IDEA, you can jump between a file and the related test file. Navigation from a test result in the Test Runner Tab to the test is also supported.
To jump between a file and the related test file
Open the file in the editor and choose or
on the context menu, or just press Ctrl+Shift+T.
The test file should follow popular naming conventions,
e.g. have a .test., .spec. or _spec. suffix and should be located either next to the source file or in a test folder.
To jump from a test result to the test
Select the test name in the Test Runner tab and choose Jump to Source on the context menu.

Debugging tests
A debugging session for Protractor tests is started only through a run/debug configuration.
To start debugging tests
- Create a Protractor run/debug configuration as described above.
-
Select the Protractor run/debug configuration from the list on the main toolbar
and click
to the right of the list.
- In the Debug tool window that opens, proceed as usual: step through the tests, stop and resume test execution, examine the test when suspended, etc.