
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
browserstack-runner-fix
Advanced tools
A command line interface to run browser tests over BrowserStack
A command line interface to run browser tests over BrowserStack.
Install globally:
npm -g install browserstack-runner
Then, after setting up the configuration, run tests with:
browserstack-runner
You can also install locally and run the local binary:
npm install browserstack-runner
node_modules/.bin/browserstack-runner
If you're getting an error EACCES open ... BrowserStackLocal
, configure npm to install modules using something other than the default "nobody" user:
npm -g config set user [user]
Where [user]
is replaced with a local user with enough permissions.
browserstack-runner
can also be used as a module. To run your tests, inside your project do -
var browserstackRunner = require('browserstack-runner');
var config = require('./browserstack.json');
browserstackRunner.run(config, function(error, report) {
if(error) {
console.log("Error:" + error);
return;
}
console.log(JSON.stringify(report, null, 2));
console.log("Test Finished");
});
The callback to browserstackRunner.run
is called with two params -
error
: This parameter is either null
or an Error
object (if test execution failed) with message as the reason of why executing the tests on BrowserStack
failed.report
: This is an array which can be used to keep track of the executed tests and suites in a run. Each object in the array has the following keys -
The structure of the report
object is as follows -
[
{
"browser": "Windows 7, Firefox 47.0",
"tests": [
{
"name": "isOdd()",
"suiteName": "Odd Tests",
"fullName": [
"Odd Tests",
"isOdd()"
],
"status": "passed",
"runtime": 2,
"errors": [],
"assertions": [
{
"passed": true,
"actual": true,
"expected": true,
"message": "One is an odd number"
},
{
"passed": true,
"actual": true,
"expected": true,
"message": "Three is an odd number"
},
{
"passed": true,
"actual": true,
"expected": true,
"message": "Zero is not odd number"
}
]
}
],
"suites": {
"fullName": [],
"childSuites": [
{
"name": "Odd Tests",
"fullName": [
"Odd Tests"
],
"childSuites": [],
"tests": [
{
"name": "isOdd()",
"suiteName": "Odd Tests",
"fullName": [
"Odd Tests",
"isOdd()"
],
"status": "passed",
"runtime": 2,
"errors": [],
"assertions": [
{
"passed": true,
"actual": true,
"expected": true,
"message": "One is an odd number"
},
{
"passed": true,
"actual": true,
"expected": true,
"message": "Three is an odd number"
},
{
"passed": true,
"actual": true,
"expected": true,
"message": "Zero is not odd number"
}
]
}
],
"status": "passed",
"testCounts": {
"passed": 1,
"failed": 0,
"skipped": 0,
"total": 1
},
"runtime": 2
}
],
"tests": [],
"status": "passed",
"testCounts": {
"passed": 1,
"failed": 0,
"skipped": 0,
"total": 1
},
"runtime": 2
}
}
]
To run browser tests on BrowserStack infrastructure, you need to create a browserstack.json
file in project's root directory (the directory from which tests are run), by running this command:
browserstack-runner init
browserstack.json
username
: BrowserStack username (Or BROWSERSTACK_USERNAME
environment variable)key
: BrowserStack access key (Or BROWSERSTACK_KEY
environment variable)test_path
: Path to the test page which will run the tests when opened in a browser.test_framework
: Specify test framework which will run the tests. Currently supporting qunit, jasmine, jasmine2 and mocha.timeout
: Specify worker timeout with BrowserStack.browsers
: A list of browsers on which tests are to be run. Find a list of all supported browsers and platforms on browerstack.com.build
: A string to identify your test run in Browserstack. In TRAVIS
setup TRAVIS_COMMIT
will be the default identifier.proxy
: Specify a proxy to use for the local tunnel. Object with host
, port
, username
and password
properties.A sample configuration file:
{
"username": "<username>",
"key": "<access key>",
"test_framework": "qunit|jasmine|jasmine2|mocha",
"test_path": ["relative/path/to/test/page1", "relative/path/to/test/page2"],
"browsers": [
{
"browser": "ie",
"browser_version": "10.0",
"device": null,
"os": "Windows",
"os_version": "8"
},
{
"os": "android",
"os_version": "4.0",
"device": "Samsung Galaxy Nexus"
},
{
"os": "ios",
"os_version": "7.0",
"device": "iPhone 5S"
}
]
}
browsers
parameterbrowsers
parameter is a list of objects, where each object contains the details of the browsers on which you want to run your tests. This object differs for browsers on desktop platforms and browsers on mobile platforms. Browsers on desktop platform should contain browser
, browser_version
, os
, os_version
parameters set as required.
Example:
{
"browser": "ie",
"browser_version": "10.0",
"os": "Windows",
"os_version": "8"
}
For mobile platforms, os
, os_version
and device
parameters are required.
Example:
[{
"os": "ios",
"os_version": "8.3",
"device": "iPhone 6 Plus"
},
{
"os": "android",
"os_version": "4.0",
"device": "Google Nexus"
}
]
For a full list of supported browsers, platforms and other details, visit the BrowserStack site.
browsers
configurationWhen os
and os_version
granularity is not desired, following configuration can be used:
[browser]_current
or browser_latest: will assign the latest version of the browser.[browser]_previous
: will assign the previous version of the browser.[browser]_[version]
: will assign the version specified of the browser. Minor versions can be concatenated with underscores.This can also be mixed with fine-grained configuration.
Example:
{
"browsers": [
"chrome_previous",
"chrome_latest",
"firefox_previous",
"firefox_latest",
"ie_6",
"ie_11",
"opera_12_1",
"safari_5_1",
{
"browser": "ie",
"browser_version": "10.0",
"device": null,
"os": "Windows",
"os_version": "8"
}
]
}
Note: These shortcuts work only for browsers on desktop platforms supported by BrowserStack.
Add the following in browserstack.json
{
"proxy": {
"host": "localhost",
"port": 3128,
"username": "foo",
"password": "bar"
}
}
To avoid duplication of system or user specific information across several configuration files, use these environment variables:
BROWSERSTACK_USERNAME
: BrowserStack user name.BROWSERSTACK_KEY
: BrowserStack key.TUNNEL_ID
: Identifier for the current instance of the tunnel process. In TRAVIS
setup TRAVIS_JOB_ID
will be the default identifier.BROWSERSTACK_JSON
: Path to the browserstack.json file. If null, browserstack.json
in the root directory will be used.To avoid checking in the BrowserStack username
and key
in your source control system, the corresponding environment variables can be used.
These can also be provided by a build server, for example using secure environment variables on Travis CI.
Check out code sample [here]. [here]:https://github.com/browserstack/browserstack-runner-sample
BrowserStack Runner is currently tested by running test cases defined in QUnit, Mocha, and Spine repositories.
To run tests:
npm test
To run a larger suite of tests ensuring compatibility with older versions of QUnit, etc.:
npm run test-ci
Tests are also run for every pull request, courtesy Travis CI.
FAQs
A command line interface to run browser tests over BrowserStack
The npm package browserstack-runner-fix receives a total of 1 weekly downloads. As such, browserstack-runner-fix popularity was classified as not popular.
We found that browserstack-runner-fix 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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.