Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.Before(function (scenario, callback) {
world = this;
var task_id = parseInt(process.env.TASK_ID || 0);
var caps = config.capabilities[task_id];
caps['browserstack.user'] = username;
caps['browserstack.key'] = accessKey;
// Make the broswer name available to scripts (easily)
globals.browser_name = caps['browserName'];
if(caps["browserstack.local"]){
// Code to start browserstack local before start of test and stop browserstack local after end of test
bs_local = new browserstack.Local();
bs_local.start({'key': accessKey }, function(error) {
if (error) return console.log(error.red);
world.driver = createBrowserStackSession(config, caps);
callback();
});
}
else {
world.driver = createBrowserStackSession(config, caps);
callback();
}
});
import {Capability, Browser} from 'selenium-webdriver';
const capabilities = {
[Capability.PLATFORM]: 'WINDOWS',
[Capability.BROWSER_NAME]: Browser.CHROME,
[Capability.VERSION]: 73,
};
// browserstack specific capabilities - https://www.browserstack.com/automate/capabilities
if (process.env.CI) {
capabilities['browserstack.local'] = true;
capabilities['browserstack.localIdentifier'] = process.env.BROWSERSTACK_LOCAL_IDENTIFIER || process.env.TRAVIS_JOB_NUMBER;
capabilities['browserstack.networkLogs'] = true;
capabilities.os = 'WINDOWS';
capabilities.os_version = '10';
capabilities.browser = Browser.CHROME;
capabilities.browser_version = '73';
}
export default capabilities;
this.Before(function (scenario, callback) {
var world = this;
var task_id = parseInt(process.env.TASK_ID || 0);
var caps = config.capabilities[task_id];
caps['browserstack.user'] = username;
caps['browserstack.key'] = accessKey;
if(caps["browserstack.local"]){
// Code to start browserstack local before start of test and stop browserstack local after end of test
bs_local = new browserstack.Local();
bs_local.start({'key': accessKey }, function(error) {
if (error) return console.log(error.red);
world.driver = createBrowserStackSession(config, caps);
callback();
});
}
else {
world.driver = createBrowserStackSession(config, caps);
callback();
}
});
function createCapabilities (capabilities, tags) {
capabilities['browserstack.user'] = env.BROWSERSTACK_USER || env.BS_USERNAME;
capabilities['browserstack.key'] = env.BROWSERSTACK_KEY || env.BS_AUTHKEY;
capabilities['browserstack.local'] = true;
// Selenium 3.4.0 does not work great with IE11
if (capabilities.browserName !== 'internet explorer') {
capabilities['browserstack.selenium_version'] = '3.4.0';
}
capabilities.project = pkg.name;
capabilities.build = env.BROWSERSTACK_BUILD || pkg.version;
capabilities.cucumberOpts = {
format: 'json:./test/reports/' + composeReportName(capabilities) + '.json'
};
if (tags) {
capabilities.cucumberOpts.tags = tags;
}
const { argv } = require('yargs');
const { browserConf } = require('./browser-config');
const { constants } = require('../constants');
const wdioMaster = require('./wdio.conf.js');
const selectedBrowser = argv.browser
? browserConf[argv.browser]
: browserConf['chrome'];
// Enable When browserstack support Selenium 3.13.0
// const seleniumSettings = require('./selenium-config');
const username = process.env.MANAGER_USER;
const password = process.env.MANAGER_PASS;
if (argv.local) {
selectedBrowser['browserstack.local'] = true;
} else {
selectedBrowser['browserstack.local'] = false;
}
// Enable When browserstack support Selenium 3.13.0
//selectedBrowser['browserstack.selenium_version'] = seleniumSettings.version;
selectedBrowser['browserstack.selenium_version'] = '3.11.0';
exports.config = merge(wdioMaster.config, {
host: 'hub.browserstack.com',
services: ['browserstack'],
capabilities: [selectedBrowser],
user: process.env.BROWSERSTACK_USERNAME,
key: process.env.BROWSERSTACK_ACCESS_KEY,
browserstackLocal: argv.local ? true : false,
browserstackLocalForcedStop: true,
edge: {
browser: 'Edge',
browserVersion: '16.0',
},
},
};
// Copy seleniumhost/port into test settings
Object.values(config.test_settings).forEach((setting) => {
setting.selenium_host = config.selenium.host;
setting.selenium_port = config.selenium.port;
});
if (process.env.LOCAL_TEST) {
config.test_settings.default.desiredCapabilities['browserstack.local'] = true;
}
module.exports = config;
function (capabilities) {
capabilities['browserstack.user'] = BROWSERSTACK_USER;
capabilities['browserstack.key'] = BROWSERSTACK_KEY;
capabilities['browserstack.local'] = true;
// Selenium 3.6.0 does not work great with IE11
if (capabilities.browserName !== 'internet explorer') {
capabilities['browserstack.selenium_version'] = '3.4.0';
}
capabilities.project = pkg.name;
capabilities.build = env.BROWSERSTACK_BUILD || pkg.version;
if (capabilities.browserName === 'internet explorer') {
capabilities.ignoreProtectedModeSettings = true;
}
return capabilities;
}
);
export function configProtractor() {
var browserstack = extend(true /* Deep copy. */, {}, protractorUtils.platform.browserstack);
var protractorBaseConfig = {
specs: __dirname + '/../../tests/e2e/*.js'
};
// browserstack.capabilities['browserstack.user'] = process.env.BROWSERSTACK_USER;
browserstack.capabilities['browserstack.user'] = process.env.bs_user;
// browserstack.capabilities['browserstack.key'] = process.env.BROWSERSTACK_KEY;
browserstack.capabilities['browserstack.key'] = process.env.bs_key;
browserstack.capabilities['browserstack.local'] = 'true';
return {
configList: [
/* OS X / Chrome. */
protractorUtils.mergeConfig({
configList: [
protractorBaseConfig,
browserstack,
protractorUtils.os.osx,
protractorUtils.browser.chrome
]
}),
// /* OS X / Safari. */
// protractorUtils.mergeConfig({
// configList: [
// protractorBaseConfig,
baseUrl: env.baseUrl + '/ng1/',
jasmineNodeOpts: {
isVerbose: true,
realtimeFailure: true
},
params: {
login: {
user: 'Jane',
password: '1234'
}
}
};
exports.config.capabilities['browserstack.local'] = true;
capList.forEach(function (cap) {
cap["browserstack.user"] = "winjsproject";
cap["browserstack.key"] = "scb8Tm2t5saetT1KzPBd";
cap["browserstack.local"] = true;
});