Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug angular protractor tests in WebStorm

There is a way to run and debug protractor web-tests in WebStorm. I just want to share this answer here

like image 886
Sergei Panfilov Avatar asked Nov 22 '13 04:11

Sergei Panfilov


People also ask

How do you debug a Protractor test?

Add “debugger” keyword to the test case that we want to debug. The test will start and pause at the beginning. We can click F8 (resume script execution), and the test will pause at the first line that has our “debugger” keyword. We can then add breakpoints and debug tests.

How do I debug a test in WebStorm?

Debugging tests With WebStorm, you can quickly start debugging a single Jest test right from the editor or create a run/debug configuration to debug some or all of your tests. in the gutter and select Debug <test_name> from the list. to the right of the list.

How do I run multiple tests in Protractor?

When you want to run protractor scripts by opening a browser instance for each test, you should add two capabilities shardTestFiles and maxInstances in the Capabilities block of the conf. js file. This will help to execute your scripts on same browser with multiple instances.


1 Answers

  1. Get the node path (Type which node in your terminal)
  2. In the WebStorm: Click on "Edit configurations" - the dropdown to the left of the "Run" button (green arrow like a "play" button)
  3. Click on the "Add button" (green +) to add a new Node configuration. Select "Node.js"
  4. Fill the params:

Node interpreter: Full path to Node.js (from step 1)

Working directory: home directory for the protractor tests.

Javascript file: Full path to node_modules/protractor/lib/cli.js

Application parameters: Full path to protractor-conf.js

Now you be able to run and debug tests by clicking on "Run" or "Debug" buttons on the top of IDE

like image 123
Sergei Panfilov Avatar answered Sep 24 '22 16:09

Sergei Panfilov