Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
setupDriverEnv() {
let deferred = q.defer();
this.config_.capabilities['browserstack.user'] = this.config_.browserstackUser;
this.config_.capabilities['browserstack.key'] = this.config_.browserstackKey;
this.config_.seleniumAddress = 'http://hub.browserstack.com/wd/hub';
this.browserstackClient = BrowserstackClient.createAutomateClient({
username: this.config_.browserstackUser,
password: this.config_.browserstackKey,
proxy: this.config_.browserstackProxy
});
// Append filename to capabilities.name so that it's easier to identify
// tests.
if (this.config_.capabilities.name && this.config_.capabilities.shardTestFiles) {
this.config_.capabilities.name +=
(':' + this.config_.specs.toString().replace(/^.*[\\\/]/, ''));
}
logger.info('Using BrowserStack selenium server at ' + this.config_.seleniumAddress);
deferred.resolve();
return deferred.promise;
}
}
protected async setupDriverEnv(): Promise {
this.config_.capabilities['browserstack.user'] = this.config_.browserstackUser;
this.config_.capabilities['browserstack.key'] = this.config_.browserstackKey;
this.config_.seleniumAddress = 'http://hub.browserstack.com/wd/hub';
this.browserstackClient = BrowserstackClient.createAutomateClient({
username: this.config_.browserstackUser,
password: this.config_.browserstackKey,
proxy: this.config_.browserstackProxy
});
// Append filename to capabilities.name so that it's easier to identify
// tests.
if (this.config_.capabilities.name && this.config_.capabilities.shardTestFiles) {
this.config_.capabilities.name +=
(':' + this.config_.specs.toString().replace(/^.*[\\\/]/, ''));
}
logger.info(`Using BrowserStack selenium server at ${this.config_.seleniumAddress}`);
}
}
const fs = require("fs");
const BrowserStack = require("browserstack");
const dotenv = require("dotenv");
dotenv.config({
path: path.join(__dirname, "../../.env")
});
const browserStackCredentials = {
username: process.env.BROWSER_STACK_USERNAME,
password: process.env.BROWSER_STACK_ACCESS_KEY
};
if (!process.env.BROWSER_STACK_USERNAME || !process.env.BROWSER_STACK_ACCESS_KEY) {
throw new Error("BROWSER_STACK_USERNAME and BROWSER_STACK_ACCESS_KEY must be set in the environment to run this script.");
}
const automateClient = BrowserStack.createAutomateClient(browserStackCredentials);
const TOML = require('@iarna/toml');
automateClient.getBrowsers(function(error, browsers) {
console.log("Updated the browser list for automated testing via BrowserStack.");
fs.writeFileSync(path.join(__dirname, "browserstackBrowsers.toml"), TOML.stringify({browsers}));
fs.writeFileSync(
path.join(__dirname, "browsers.toml"),
TOML.stringify({
browsers: Array.from(new Set(browsers.map(b => (b.browser_version ? `${b.browser}/${b.browser_version}` : `${b.os}/${b.os_version}`)))).sort()
})
);
});
const fs = require("fs");
const BrowserStack = require("browserstack");
const dotenv = require("dotenv");
dotenv.config({
path: path.join(__dirname, "../../.env")
});
const browserStackCredentials = {
username: process.env.BROWSERSTACK_USERNAME,
password: process.env.BROWSERSTACK_ACCESS_KEY
};
if (!process.env.BROWSERSTACK_USERNAME || !process.env.BROWSERSTACK_ACCESS_KEY) {
throw new Error("BROWSERSTACK_USERNAME and BROWSERSTACK_ACCESS_KEY must be set in the environment to run this script.");
}
const automateClient = BrowserStack.createAutomateClient(browserStackCredentials);
automateClient.getBrowsers(function(error, browsers) {
console.log("Updated the browser list for automated testing via BrowserStack.");
fs.writeFileSync(path.join(__dirname, "browserstackBrowsers.json"), JSON.stringify(browsers, null, 4));
fs.writeFileSync(
path.join(__dirname, "browsers.json"),
JSON.stringify(Array.from(new Set(browsers.map(b => (b.browser_version ? `${b.browser}/${b.browser_version}` : `${b.os}/${b.os_version}`)))).sort(), null, 4)
);
});