0

i have 2 projects:

  • project 1: in this project i am trying to run project 2
  • project 2: this is a proctractor project - in my config file i have params like: "param1, param2"

In project 1 I am trying to run protractor from project 2.

const Launcher = require("project1/protractor/built/launcher");
Launcher.init('path/to/project1/conf');

How can i add some arguments like: "--params.param1=test" ?

NewTester
  • 23
  • 5

2 Answers2

0

Add the below code in your config file

  params: {
        login: {
          username: "user007",
          password: "user007"
        }
      }

Now you update the username from cmd as below.

npm  run --params.login.username = 'user008' --params.login.password=`user008` //This will overwrite the `user007`

Hope it helps you

Madhan Raj
  • 1,404
  • 1
  • 7
  • 13
0

Referring your code -

const Launcher = require("project1/protractor/built/launcher");
Launcher.init('path/to/project1/conf');

If you are using init then it takes two parameters

init(configFile: string, additionalConfig: Config)

You can import already created config file from the project1 like const config = require('./config'); or whatever path you have.

Once it is imported then update params and pass entire config object to init function.

config.params.param1=test123456'
Launcher.init('path/to/project1/conf', config);
Nitin Sahu
  • 611
  • 6
  • 12