Reputation: 13
I have set multiCapabilities to run cross browser test. I need a Global variable to be initialized before launching multiple parallel instances of one test that can be single describe() or single it() function. And then I want to use same initialized Global variable inside test cases when test is running. Please, provide a way to do this in Protractor. As we can do same thing in Testng easily using @BeforeTest or @BeforeClass and @AfterTest or @AfterClass. But in protractor I can't find anything related to them. And BeforeAll of protractor is not working as it is being run multiple times as the number of browsers we have provided in multiCapabilities, creating multiple variables instead of one Global variable for all the instances.
Upvotes: 0
Views: 396
Reputation: 8978
Start protractor with environment variable like this
MY_VAR=Dev protractor tmp/config.js
And then it will be available in your config
console.log(process.env.MY_VAR)
Upvotes: 0