Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
browserstack-local
Advanced tools
The browserstack-local npm package allows you to establish a secure connection between your local machine and the BrowserStack cloud. This enables you to test your web applications hosted on your local server or behind a firewall using BrowserStack's real device cloud.
Start Local Testing
This feature allows you to start a local testing connection with BrowserStack. You need to provide your BrowserStack access key to establish the connection. Once the connection is established, you can run your tests and then stop the connection.
const browserstack = require('browserstack-local');
const bs_local = new browserstack.Local();
const bs_local_args = { 'key': 'YOUR_ACCESS_KEY' };
bs_local.start(bs_local_args, function(error) {
if (error) return console.log(error);
console.log('Started BrowserStackLocal');
// Your test code here
bs_local.stop(function() {
console.log('Stopped BrowserStackLocal');
});
});
Stop Local Testing
This feature allows you to stop the local testing connection. It is important to stop the connection after your tests are completed to ensure that no unnecessary resources are being used.
bs_local.stop(function() {
console.log('Stopped BrowserStackLocal');
});
Check Local Testing Status
This feature allows you to check if the local testing connection is currently running. It returns a boolean value indicating the status of the connection.
console.log(bs_local.isRunning());
ngrok exposes local servers behind NATs and firewalls to the public internet over secure tunnels. It is similar to browserstack-local in that it allows you to test local applications, but it does not provide the same level of integration with a cloud-based testing platform like BrowserStack.
localtunnel allows you to easily share a web service on your local development machine without messing with DNS and firewall settings. It is similar to browserstack-local in that it provides a way to expose local servers, but it lacks the specific integration with BrowserStack's testing infrastructure.
serveo is an alternative to ngrok that allows you to expose local servers to the internet. It is similar to browserstack-local in that it provides a way to expose local servers, but it does not offer the same level of integration with a cloud-based testing platform like BrowserStack.
Nodejs bindings for BrowserStack Local.
npm install browserstack-local
var browserstack = require('browserstack-local');
//creates an instance of Local
var bs_local = new browserstack.Local();
// replace <browserstack-accesskey> with your key. You can also set an environment variable - "BROWSERSTACK_ACCESS_KEY".
var bs_local_args = { 'key': '<browserstack-accesskey>' };
// starts the Local instance with the required arguments
bs_local.start(bs_local_args, function() {
console.log("Started BrowserStackLocal");
// check if BrowserStack local instance is running
console.log(bs_local.isRunning());
// stop the Local instance
bs_local.stop(function() {
console.log("Stopped BrowserStackLocal");
});
});
Apart from the key, all other BrowserStack Local modifiers are optional. For the full list of modifiers, refer BrowserStack Local modifiers. For examples, refer below -
To enable verbose logging -
bs_local_args = { 'key': '<browserstack-accesskey>', 'verbose': 'true' }
Note - Possible values for 'verbose' modifier are '1', '2', '3' and 'true'
To test local folder rather internal server, provide path to folder as value of this option -
bs_local_args = { 'key': '<browserstack-accesskey>', 'f': '/my/awesome/folder' }
To kill other running Browserstack Local instances -
bs_local_args = { 'key': '<browserstack-accesskey>', 'force': 'true' }
To disable local testing for Live and Screenshots, and enable only Automate -
bs_local_args = { 'key': '<browserstack-accesskey>', 'onlyAutomate': 'true' }
To route all traffic via local(your) machine -
bs_local_args = { 'key': '<browserstack-accesskey>', 'forceLocal': 'true' }
To use a proxy for local testing -
bs_local_args = { 'key': '<browserstack-accesskey>', 'proxyHost': '127.0.0.1', 'proxyPort': '8000', 'proxyUser': 'user', 'proxyPass': 'password', 'useCaCertificate': '/Users/test/cert.pem' }
To use local proxy in local testing -
bs_local_args = { 'key': '<browserstack-accesskey>', 'localProxyHost': '127.0.0.1', 'localProxyPort': '8000', 'localProxyUser': 'user', 'localProxyPass': 'password' }
To use PAC (Proxy Auto-Configuration) in local testing -
bs_local_args = { 'key': '<browserstack-accesskey>', 'pac-file': '<pac_file_abs_path>' }
If doing simultaneous multiple local testing connections, set this uniquely for different processes -
bs_local_args = { 'key': '<browserstack-accesskey>', 'localIdentifier': 'randomstring' }
By default, BrowserStack local wrappers try downloading and executing the latest version of BrowserStack binary in ~/.browserstack or the present working directory or the tmp folder by order. But you can override these by passing the -binarypath argument. Path to specify local Binary path -
bs_local_args = { 'key': '<browserstack-accesskey>', 'binarypath': '/browserstack/BrowserStackLocal' }
To save the logs to the file while running with the '-v' argument, you can specify the path of the file. By default the logs are saved in the local.log file in the present woring directory. To specify the path to file where the logs will be saved -
bs_local_args = { 'key': '<browserstack-accesskey>', 'verbose': 'true', 'logFile': '/browserstack/logs.txt' }
To run the test suite run, npm test
.
You can submit bug reports either in the Github issue tracker.
Before submitting an issue please check if there is already an existing issue. If there is, please add any additional information give it a "+1" in the comments.
When submitting an issue please describe the issue clearly, including how to reproduce the bug, which situations it appears in, what you expect to happen, what actually happens, and what platform (operating system and version) you are using.
We love pull requests! We are very happy to work with you to get your changes merged in, however, please keep the following in mind.
FAQs
Nodejs bindings for BrowserStack Local
The npm package browserstack-local receives a total of 198,177 weekly downloads. As such, browserstack-local popularity was classified as popular.
We found that browserstack-local demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.