testcafe-browserstack
v0.1.4
Published
Add remote workers from the BrowserStack web service to the TestCafe.
Downloads
11
Maintainers
Readme
Add remote workers from the BrowserStack web service to the TestCafe
This module allows to enrich the TestCafe browsers list by adding remote workers from the BrowserStack web site that provides a large list of browsers for testing.
The module contains a set of functions that help to initialise, create and remove a remote worker.
Installation
npm install testcafe-browserstack
init ( config, callback )
Module initialization
config
: Configuration that is required for the module initializationTestCafe
: TestCafe Configurationhostname
: The hostname of your computercontrolPanelPort
: The port number where you can access TestCafe Control PanelservicePort1
: The number of the first port used to perform testingservicePort2
: The number of the second port used to perform testing
BrowserStack
: BrowserStack Configurationusername
: Your BrowserStack usernamepassword
: Your BrowserStack passwordaccessKey
: Your BrowserStack access keylocalTesting
:true
if your TestCafe is installed in the local PC, otherwisefalse
callback
(function()
): Invokes when the initialization is completed
createWorkers( browsers, callback )
Creates new BrowserStack workers and returns an array of workers ids.
browsers
: An array of browsers objects from the BrowserStack servicebrowserObject
os
: The operation systemos_version
: The operation system versionbrowser
: The browser namebrowser_version
: The browser versiondevice
: The device nameworker_name
: The worker name that will be used by TestCafe to identify the browser for test execution
callback
(function( workerIds )
): Invoked when workers are createdworkerIds
: An array of workers id
removeWorkers( workerIds, callback )
Delete the specified BrowserStack workers.
workerIds
: An array of workers idcallback
(function()
): Invokes when the specified workers are deleted
removeAllWorkers ( callback )
Delete all BrowserStack workers.
callback
(function()
): Invokes when all workers are deleted
Example
This example demonstrates how to create a new worker for running tests in Chrome with the OS X Snow Leopard operating system. The worker is created in a local TestCafe instance.
var testCafeBrowserStack = require('testcafe-browserstack');
testCafeBrowserStack.init({
TestCafe: {
hostname: '127.0.0.1',
controlPanelPort: 1337,
servicePort1: 1338,
servicePort2: 1339
},
BrowserStack: {
username: 'username',
password: 'password',
accessKey: 'accessKey',
localTesting: true
}
}, function(err) {
if (!err) {
testCafeBrowserStack.createWorkers([{
os: 'OS X',
os_version: 'Snow Leopard',
browser: 'chrome',
browser_version: 'latest',
device: null
}], function(workerIds, err) {
if (err)
console.error(err);
else
console.log('All workers are created!')
});
} else
console.error(err);
});
Check if a required browser is supported by BrowserStack: a list of supported browsers.
https://www.browserstack.com/list-of-browsers-and-platforms?product=live