When adding a global variable in the onPrepare method within the Protractor config, Typescript provides error "Cannot find name '____'" when attempt to utilize in test file.
Below is how I am defining the global variable in my Protractor config.
protractorConfig.js
onPrepare: function () {
global.logger = log4js.getLogger( 'log' );
},
Below is how I am utilizing the global variable.
homepageTests.js
it( '1@tests homepage', function () {
logger.info( 'password for application: ' + pswd );
} );
In reference to the following SO post, setting global variables in the onPrepare method is how Protractor library does this, so it should be valid. Protractor set global variables