简体   繁体   中英

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 ?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM