TestProject Forum
Powered by leading experts in the test automation community

Protractorjs testing declare global variable

I get error ‘item is not defined’

I tried:

exports.config = {
  onPrepare: function () {
      global.item = 'hello world';
  }
};

What am i doing wrong ?

You need to use the params property like so:

exports.config = {
    params: {
        item: 'hello world'
    }
};

Then you can retrieve it with ‘browser.params.item’
Hope this helps