PhpStorm 2017.1 Help

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

  1. Make sure the Node.js runtime environment is installed on your computer.
  2. 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

  1. Install Protractor globally: open the built-in PhpStorm Terminal (press Alt+F12 or choose View | Tool Windows | Terminal on the main menu) and type npm install -g protractor at the command line prompt.
    You can also install the jest package on the Node.js and NPM page of the Settings dialog box as described in Node Package Manager (npm).
  2. To download the necessary binaries, type webdriver-manager update.

Creating a Protractor run/debug configuration

  1. Open the Run/Debug Configuration dialog box by doing one of the following:
    • On the main menu, choose Run | Edit Configurations.
    • Open the test file in the editor, and then choose Create <file name> on the context menu.
    • Select the test file in the Project tool window, and then choose Create <file name> on the context menu of the selection.
  2. Click the Add button /help/img/idea/2017.1/new.png on the toolbar and select the Protractor configuration type.
  3. In the dialog box that opens, specify the Node interpreter to use, the location of the protractor package, and the path to the protractor.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

  1. 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 /help/img/idea/2017.1/run.png to the right of the list.
    ws_select_run_configuration.png
    The Selenium Server starts automatically without any steps from your side.
  2. View and analyze messages from the server in the <current_run_configuration_name> tab of the Run tool window.

See Also

Last modified: 19 July 2017