protractorjs testing declare global variable

  • 1 Replies
  • 1456 Views
protractorjs testing declare global variable
« on: August 14, 2016, 19:34:07 pm »
I get error 'item is not defined'

I tried:

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

What am i doing wrong ?

*

Oren

  • **
  • 59
Re: protractorjs testing declare global variable
« Reply #1 on: August 16, 2016, 19:25:03 pm »
You need to use the params property like so:

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

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

 

Sitemap 1 2 3 4 5 6 7 8