You can run and debug tests with Protractor right in WebStorm. 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.
- Make sure the NodeJS plugin is enabled.
You can install Protractor locally, in your project, or globally. Global installation is preferable.
To install Protractor globally
- Open the built-in WebStorm 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
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).
- 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 the
protractor.conf.jsconfiguration file. If you followed the standard installation, WebStorm 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.
With WebStorm, 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.
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. The test file opens in the editor with the cursor placed at the test definition.
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.