Encountering an issue when attempting to add a global variable in the onPrepare method within the Protractor config. Typescript throws an error "Cannot find name '____'" when trying to use it in a test file.
Here is how I define the global variable in my Protractor config:
protractorConfig.js
onPrepare: function () {
global.logger = log4js.getLogger( 'log' );
},
And here is how I am using the global variable:
homepageTests.js
it( '1@tests homepage', function () {
logger.info( 'password for application: ' + pswd );
} );
According to a Stack Overflow post, setting global variables in the onPrepare method is a valid approach in Protractor.