You can run and debug tests with Protractor right in PhpStorm. 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.
You can install Protractor locally, in your project, or globally. Global installation is preferable.
- Open the built-in PhpStorm 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.
- 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, PhpStorm detects all these paths and displays them in the corresponding fields.
- 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 PhpStorm, 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 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.
- 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.