/testingbot-api

NodeJS module to communicate with the TestingBot API

Primary LanguageJavaScriptMIT LicenseMIT

npm version npm downloads Tests

testingbot-api

Wrapper around the TestingBot REST API for Node.js.

Install

npm install testingbot-api

Credentials

You can use environment variables TESTINGBOT_KEY and TESTINGBOT_SECRET to pass your TestingBot key and secret to the API client. The key and secret can be obtained from TestingBot

Using the wrapper

const TestingBot = require('testingbot-api');

const tb = new TestingBot({
  api_key: "your-tb-key",
  api_secret: "your-tb-secret"
});

getBrowsers

Gets a list of browsers you can test on

api.getBrowsers(function(error, browsers) {});

getDevices

Gets a list of physical mobile devices you can test on

api.getDevices(function(error, devices) {});

getAvailableDevices

Gets a list of available physical mobile devices for your account

api.getAvailableDevices(function(error, availableDevices) {});

getDevice

Gets details for a specific physical device

api.getDevice(deviceId, function(error, deviceDetails) {});

getUserInfo

Gets your user information

api.getUserInfo(function(error, userInfo) {});

updateUserInfo

Updates your user information

api.updateUserInfo(newUserdata, function(error, userInfo) {});

getTests

Gets list of your latest tests

api.getTests(function(error, tests) {}, offset, limit);

getTestDetails

Gets details for a single test, pass the WebDriver's SessionID

api.getTestDetails(sessionId, function(error, testDetails) {});

updateTest

Updates a single test. For example, update the passed state of a test (whether it was successful or not).

const testData = { "test[success]" : "1", "test[status_message]" : "test" };
api.updateTest(testData, sessionId, function(error, testDetails) {});

deleteTest

Deletes a single test, pass the WebDriver's SessionID

api.deleteTest(sessionId, function(error, success) {});

stopTest

Stops a single test, pass the WebDriver's SessionID

api.stopTest(sessionId, function(error, success) {});

getTunnelList

Gets list of active tunnels

api.getTunnelList(function(error, tunnelList) {});

deleteTunnel

Deletes a single Tunnel

api.deleteTunnel(tunnelId, function(error, success) {});

getBuilds

Retrieves the latest builds

api.getBuilds(function(error, builds) {}, offset, limit);

getTestsForBuild

Retrieves the tests for a single build

api.getTestsForBuild(buildId, function(error, tests) {});

deleteBuild

Deletes a single build

api.deleteBuild(buildId, function(error, success) {});

uploadFile

Uploads a local file to TestingBot Storage

api.uploadFile(localFilePath, function(error, appUrl) {});

uploadRemoteFile

Uploads a remote file to TestingBot Storage

api.uploadFile(remoteFileUrl, function(error, appUrl) {});

getStorageFile

Retrieve data from a previously uploaded file

api.getStorageFile(remoteFileUrl, function(error, fileDetails) {});

getStorageFiles

Retrieve list of previously uploaded files

api.getStorageFiles(function(error, fileDetails) {}, offset, limit);

deleteStorageFile

Delete a previously uploaded file

api.deleteStorageFile(appId, function(error, success) {});

getAuthenticationHashForSharing

Calculates the authentication hash for sharing, pass the WebDriver's SessionID. This is used to share a test's detail page on TestingBot

api.getAuthenticationHashForSharing(sessionId);

takeScreenshot

Takes screenshots for the specific browsers

api.takeScreenshot(function(error, screenshots) {}, url, browsers, waitTime, resolution, fullPage, callbackURL);

retrieveScreenshots

Retrieves screenshots for a specific takeScreenshot call

api.retrieveScreenshots(screenshotId, function(error, screenshots) {});

getScreenshotList

Retrieves all screenshots previously generate with your account

api.getScreenshotList(function(error, screenshots) {}, offset, limit);

getTeam

Retrieves team information

api.getTeam(function(error, data) {});

getUsersInTeam

Get all users in your team

api.getUsersInTeam(function(error, users) {});

getUserFromTeam

Retrieves information about a specific user in your team

api.getUserFromTeam(userId, function(error, user) {});

createUserInTeam

Add a user to your team. You need ADMIN rights for this.

api.createUserInTeam(user, function(error, result) {});

updateUserInTeam

Update a user in your team. You need ADMIN rights for this.

api.updateUserInTeam(userId, userData, function(error, result) {});

resetCredentials

Resets credentials for a specific user in your team. You need ADMIN rights for this.

api.resetCredentials(userId, function(error, result) {});

Tests

npm test

More documentation

Check out the TestingBot REST API for more information.