1

I'm using Protractor in Webstorm and in order to use parameters in the terminal I can do protractor --params.url=http://www.google.com/ Is there a way to specify params in this configuration so I don't have to type it every time? In a similar way to the screen below enter image description here

LazioTibijczyk
  • 1,701
  • 21
  • 48
  • I'm not familiar with webstorm but you should be able to change the values in the `params` object in the config to use environment variables instead of hardcoded values. Example `url: "${LAUNCH_URL}"` or even `url: process.env.LAUNCH_URL`. As long as the names match the env variables you have set it should work. – tehbeardedone Apr 20 '18 at 16:01

2 Answers2

2

Protractor run configuration doesn't currently support passing command line options to protractor, please vote for WEB-25165 to be notified on any progress with this feature.

However, just as @tehbeardedone has mentioned, params can be specified in protractor config - see How can I use command line arguments in Angularjs Protractor?

lena
  • 90,154
  • 11
  • 145
  • 150
0

Here is the configuration that worked for me

  • Open WebStorm
  • Click ‘Run’ tab
  • Select ‘Edit Configurations…’
  • Click ‘+’ button on the top left corner of the newly opened window
  • Select ‘Node.js’ configuration from the list

Set parameters (following examples were used on windows machine)

  • Name: ‘Protractor’
  • Node interpreter: ‘C:\Program Files\nodejs\node.exe’
  • Node parameters: ‘’
  • Working directory:
  • JavaScript file: ‘~\AppData\Roaming\npm\node_modules\protractor\built\cli.js’
  • Application parameters, this is where you specify path to your conf, relatively to working directory^ and then parameters like this: ‘e2e/settings/configs/protractor.custom.conf.js --baseUrl="https://stage.mysite.com" --params.login="testuser" --params.password="test_USER00"’
  • Environment variables: ‘’

This config works great in my project, where we solely rely on async/await syntax

Sergey Pleshakov
  • 7,964
  • 2
  • 17
  • 40