Testing JavaScript with Protractor
PhpStorm supports integration with the Protractor test framework. This support includes generation of the protractor.conf.js
configuration file and starting the Selenium Server.
On this page:
- Before you start
- Installing Protractor
- Creating a Protractor run/debug configuration
- Launching tests through a run/debug configuration
Before you start
- Make sure the Node.js runtime environment is installed on your computer.
- Make sure the NodeJS repository plugin is installed and enabled. The plugin is not bundled with PhpStorm, but it can be installed from the JetBrains plugin repository as described in Installing, Updating and Uninstalling Repository Plugins and Enabling and Disabling Plugins.
Installing Protractor
- Install Protractor globally: open the built-in PhpStorm Terminal (press Alt+F12 or choose on the main menu) and type
npm install -g protractor
at the command line prompt.
You can also install thejest
package on the Node.js and NPM page of the Settings dialog box as described in Node Package Manager (npm). - To download the necessary binaries, type
webdriver-manager update
.
Creating a Protractor run/debug configuration
- Open the Run/Debug Configuration dialog box by doing one of the following:
- Click the Add button on the toolbar and select the Protractor configuration type.
- In the dialog box that opens, specify the Node interpreter to use, the location of the
protractor
package, and the path to theprotractor.conf.js
configuration file. If you followed the standard installation, PhpStorm detects all these paths and displays them in the corresponding fields. Apply the changes, if any, anf close the dialog box.
Launching tests through a run/debug configuration
- To launch the tests according to a run configuration, select the Protractor run/debug configuration from the list on the main toolbar and click the Run button 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.
See Also
Reference:
Last modified: 19 July 2017