TestProject Forum

General => General Questions => Topic started by: DavidM on August 14, 2016, 19:34:07 pm

Title: protractorjs testing declare global variable
Post by: DavidM 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 ?
Title: Re: protractorjs testing declare global variable
Post by: Oren 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