How to use the browserstack.createAutomateClient function in browserstack

To help you get started, we’ve selected a few browserstack examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fossasia / susper.com / node_modules / protractor / built / driverProviders / browserStack.js View on Github external
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;
    }
}
github angular / protractor / lib / driverProviders / browserStack.ts View on Github external
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}`);
  }
}
github Financial-Times / polyfill-library / test / polyfills / updatebrowserstacklist.js View on Github external
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()
		})
	);
});
github Financial-Times / polyfill-service / packages / polyfill-service / tasks / node / updatebrowserstacklist.js View on Github external
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)
	);
});