protractor-styleguide
protractor-styleguide copied to clipboard
set global variables in a file - not in conf file
currently global variables are being set in onPrepare: function () { global.myFirstVar = 1; },
I have about 30 variables, and the conf file it's starting to get a bit messy. It would be a bit more organised if we could link the global variables directly in a file.
Is this a proposal for a new rule in the style guide?
Yes, it is. I am storing global variables as arrays, found a slightly better approach, but in my opinion it would result in a much clearer conf file.
Currently, I am storing value like this:
onPrepare: function () { global.priceA = { "price1": 11 }, global.priceB = { "price1": 71 };
And I have about 60 global variables, so far. My suggestion is to save all the global variables to a different file. For example, reference it.
http://stackoverflow.com/questions/31532276/protractor-how-to-make-the-configuration-file-more-flexible reference as example