I have a variable in protractor.conf.js
which is exported within onPrepare()
function as: global.myVariable = myVariable
, and in spec file I'am trying to use/call it, but it seems that it can't be accessible and isn't available for the spec file.
Error:
E/launcher - Error: Error: Cannot find module 'myVariable'
It's being treated as it would be an npm module and can't be found in npm_modules which is correct.
myVariable
is actually an object build by a constructor function within protractor.conf.js
How can make it accessible from the spec
file?
mailListener
library and its initialization is being done inprotractor.config.js
as:var MailListener = require("mail-listener2"); var mailListener = new MailListener({....})
. Therefor I have to pass a variableglobal.mailListener = mailListener
to*.spec.ts
file and then invoke a method on it.