I am using lot's of values for my test like username and password.
For this purpose I created a config file where I store just this data in JSON, it looks like:
{
"login": "test",
"password": "pass",
"number": "1234",
}
It works for me if I request it at start of each test file (one file for login, another for something else)
How can I load this config file for once and not in every single file. Example, how I do it now:
var configFile = require('./config.json');
Can somebody help me to setup this?
To follow the "DRY" principle, use your protractor config and globally available
browser
object:in your protractor config, "import" your configuration file and set it as a
params
value:in your tests, simply use
browser.params
, e.g.:In other words, this is "Import once - use everywhere" approach.