Stevik
Stevik

Reputation: 1152

AngularJS & Protractor & Jasmine - global variable for all specs

My config.js looks like this

exports.config = {
  seleniumAddress: 'http://localhost:4444/wd/hub',
  specs: ['test1.js', 'test2.js'],
  framework: 'jasmine2'
};

As you can see I have 2 test files, what I want to do is to use a single variable across all the specs.

How can I achieve it ?

Upvotes: 0

Views: 185

Answers (1)

Sergey Teplyakov
Sergey Teplyakov

Reputation: 610

exports.config = {
    seleniumAddress: 'http://localhost:4444/wd/hub',
    framework: 'jasmine2',

    specs: [
        'spec1.js',
        'specs2.js'
    ],
    params: {
        screenWidth: 1920,
        screenHeight: 1080
    }
}

in order to access variable you should do smth like this in your specs:

browser.params.screenWidth

Upvotes: 1

Related Questions