Giter Club home page Giter Club logo

node-browserstack's Introduction

node-browserstack

A node.js JavaScript client for working with BrowserStack through its REST API (aka Javascript Testing API), Automate API, App Automate API, and Screenshots API.

Installation

npm install browserstack

Usage

var BrowserStack = require("browserstack");
var browserStackCredentials = {
	username: "foo",
	password: "p455w0rd!!1"
};

// REST API
var client = BrowserStack.createClient(browserStackCredentials);

client.getBrowsers(function(error, browsers) {
	console.log("The following browsers are available for testing");
	console.log(browsers);
});

// Automate API
var automateClient = BrowserStack.createAutomateClient(browserStackCredentials);

automateClient.getBrowsers(function(error, browsers) {
	console.log("The following browsers are available for automated testing");
	console.log(browsers);
});

// App Automate API
// Show the upload builds for mobile app automation
var appAutomateClient = BrowserStack.createAppAutomateClient(browserStackCredentials);

appAutomateClient.getBuilds(function(error, builds) {
	console.log("The following builds are available for app automated testing");
	console.log(builds);
});

// Screenshots API
var screenshotClient = BrowserStack.createScreenshotClient(browserStackCredentials);

screenshotClient.getBrowsers(function(error, browsers) {
	console.log("The following browsers are available for screenshots");
	console.log(browsers);
});

API

Objects

browser objects

A common pattern in the APIs is a "browser object" which is just a plain object with the following properties:

  • os: The operating system.
  • os_version: The operating system version.
  • browser: The browser name.
  • browser_version: The browser version.
  • device: The device name.

A browser object may only have one of browser or device set; which property is set will depend on os.

worker objects

Worker objects are extended browser objects which contain the following additional properties:

  • id: The worker id.
  • status: A string representing the current status of the worker.
    • Possible statuses: "running", "queue".

project objects

Project objects are plain objects which contain the following properties:

  • id: The id of the project.
  • name: The name of the project.
  • created_at: When the project was created.
  • updated_at: When the project was most recently updated.
  • user_id
  • group_id

build objects

Build objects are plain objects which contain the following properties:

  • hashed_id: The hashed if of the build.
  • name: The name of the build.
  • status: The status of the build.
  • duration

extended build objects

Extended build objects are build objects with the following additional properties:

  • id: The id of the build.
  • automation_project_id: The id of the project this build belongs to.
  • updated_at: When the build was created.
  • created_at: When the build was most recently updated.
  • delta
  • tags
  • user_id
  • group_id

session objects

Session objects are extended browser objects which contain the following additional properties:

  • hashed_id: The hashed ID of the session.
  • name: The name of the session.
  • build_name: The name of the build this session belongs to.
  • project_name: The name of the project this session belongs to.
  • status: The status of the session.
  • browser_url: The most recenly loaded URL the worker.
  • duration: The duration in seconds that the session has been active.
  • logs: The URL for the session logs.
  • video_url: The URL for the session video.
  • reason: The reason the session was terminated.

screenshot job objects

Screenshot job objects are plain objects which contain the following properties:

  • job_id: The id of the job.
  • state: The state of the job.
  • win_res: The screen resolution for browsers running on Windows. May be one of: "1024x768", "1280x1024".
  • mac_res: The screen resolution for browsers running on Mac OS X. May be one of: "1024x768", "1280x960", "1280x1024", "1600x1200", "1920x1080".
  • orientation: The screen orientation for devices. May be one of: "portrait", "landscape".
  • quality: The quality of the screenshot. May be one of: "original", "compressed".
  • wait_time: The number of seconds to wait before taking the screenshot. May be one of: 2, 5, 10, 15, 20, 60.
  • local: Boolean indicating whether a local testing connection should be used.
  • browsers: A collection of browser objects indicating which browsers and devices to take screenshots with.

screenshot state objects

Screenshot state objects are extended browser objects which contain the following additional properties:

  • id: The id of the screenshot object.
  • state: The state of the screenshot.
  • url: The URL of the page the screenshot was generated from.
  • thumb_url: The URL for the screenshot thumbnail.
  • image_url: The URL for the full-size screenshot.
  • created_at: The timestamp indicating when the screenshot was generated.

REST API v4

Note: For earlier versions of the API, please see the wiki.

BrowserStack.createClient(settings)

Creates a new client instance.

  • settings: A hash of settings that apply to all requests for the new client.
    • username: The username for the BrowserStack account.
    • password: The password for the BrowserStack account.
    • version (optional; default: 4): Which version of the BrowserStack API to use.
    • server (optional; default: { host: "api.browserstack.com", port: 80 }): An object containing host and port to connect to a different BrowserStack API compatible service.
    • proxy (optional; default: null): Proxy server supporting HTTPS to be used for connecting to BrowserStack (or settings.server). e.g. "http://proxy.example.com:1234"

client.getBrowsers(callback)

Gets the list of available browsers.

  • callback (function(error, browsers)): A callback to invoke when the API call is complete.

client.createWorker(settings, callback)

Creates a worker.

  • settings: A hash of settings for the worker (an extended browser object).
    • os: See browser object for details.
    • os_version: See browser object for details.
    • browser: See browser object for details.
    • browser_version: See browser object for details.
    • device: See browser object for details.
    • url (optional): Which URL to navigate to upon creation.
    • timeout (optional): Maximum life of the worker (in seconds). Maximum value of 1800. Specifying 0 will use the default of 300.
    • name (optional): Provide a name for the worker.
    • build (optional): Group workers into a build.
    • project (optional): Provide the project the worker belongs to.
    • browserstack.video (optional): Set to false to disable video recording.
  • callback (function(error, worker)): A callback to invoke when the API call is complete.

Note: A special value of "latest" is supported for browser_version, which will use the latest stable version.

client.getWorker(id, callback)

Gets the status of a worker.

  • id: The id of the worker.
  • callback (function(error, worker)): A callback to invoke when the API call is complete.

client.changeUrl(id, options, callback)

Change the URL of a worker.

  • id: The id of the worker.
  • options: Configuration for the URL change.
    • url: The new URL to set.
    • timeout (optional): Set a new timeout for this worker, see createWorker for details.
  • callback (function(error, data)): A callback to invoke when the API call is complete.
    • data: An object with a message, confirming the URL change.

client.terminateWorker(id, callback)

Terminates an active worker.

  • id: The id of the worker to terminate.
  • callback (function(error, data)): A callback to invoke when the API call is complete.
    • data: An object with a time property indicating how long the worker was alive.

client.getWorkers(callback)

Gets the status of all workers.

  • callback (function(error, workers)): A callback to invoke when the API call is complete.

client.takeScreenshot(id, callback)

Take a screenshot at current state of worker.

  • callback (function(error, data)): A callback to invoke when the API call is complete.
    • data: An object with a url property having the public url for the screenshot.

client.getLatest(browser, callback)

Gets the latest version of a browser.

  • browser: Which browser to get the latest version for. See browser object for details.
  • callback (function(error, version)): A callback to invoke when the version is determined.
    • version: The latest version of the browser.

Note: Since mobile devices do not have version numbers, there is no latest version.

client.getLatest(callback)

Gets the latest version of all browsers.

  • callback (function(error, versions)): A callback to invoke when the versions are determined.
    • versions: A hash of browser names and versions.

client.getApiStatus(callback)

  • callback (function(error, status)): A callback to invoke when the status is determined.
    • used_time: Time used so far this month, in seconds.
    • total_available_time: Total available time, in seconds. Paid plans have unlimited API time and will receive the string "Unlimited Testing Time" instead of a number.
    • running_sessions: Number of running sessions.
    • sessions_limit: Number of allowable concurrent sessions.

Automate API

BrowserStack.createAutomateClient(settings)

Creates a new client instance.

  • settings: A hash of settings that apply to all requests for the new client.
    • username: The username for the BrowserStack account.
    • password: The password for the BrowserStack account.
    • proxy (optional; default: null): Proxy server supporting HTTPS to be used for connecting to BrowserStack. e.g. "http://proxy.example.com:1234"

automateClient.getPlan(callback)

Gets information about your group's Automate plan, including the maximum number of parallel sessions allowed and the number of parallel sessions currently running.

  • callback (function(error, plan)): A callback to invoke when the API call is complete.
    • plan: An object with parallel_sessions_max_allowed, parallel_sessions_running, and automate_plan showing the current state of your plan.

automateClient.getBrowsers(callback)

Gets the list of available browsers.

  • callback (function(error, browsers)): A callback to invoke when the API call is complete.

automateClient.getProjects(callback)

Gets the list of projects.

  • callback (function(error, projects)): A callback to invoke when the API call is complete.

automateClient.getProject(id, callback)

Gets information about a project.

  • id: The ID of the project.
  • callback (function(error, project)): A callback to invoke when the API call is complete.

automateClient.getBuilds([options,] callback)

Gets the list of builds.

  • options (optional): An object containing search parameters.
    • limit: The number of builds to return. Defaults to 10.
    • status: Filter builds based on status. May be one of "running", "done", "failed", "timeout".
  • callback (function(error, builds)): A callback to invoke when the API call is complete.

automateClient.getSessions(buildId, [options,] callback)

Gets the list of sessions in a build.

  • buildId: The hashed ID of the build.
  • options (optional): An object containing search parameters.
    • limit: The number of sessions to return. Defaults to 10.
    • status: Filter sessions based on status. May be one of "running", "done", "failed".
  • callback (function(error, sessions)): A callback to invoke when the API call is complete.

automateClient.getSession(id, callback)

Gets the details for a session.

  • id: The hashed ID of the session.
  • callback (function(error, session)): A callback to invoke when the API call is complete.

automateClient.updateSession(id, options, callback)

Updates the status of a session.

  • id: The hashed ID of the session.
  • options: An object containing the parameters.
    • status: New status value. May be one of "completed" or "error".
  • callback (function(error, session)): A callback to invoke when the API call is complete.

automateClient.deleteSession(id, callback)

Deletes a session.

  • id: The hashed ID of the session.
  • callback (function(error, data)): A callback to invoke when the API call is complete.
    • data: An object with a message, confirming the deletion.

App Automate API

BrowserStack.createAppAutomateClient(settings)

Creates a new client instance.

  • settings: A hash of settings that apply to all requests for the new client.
    • username: The username for the BrowserStack account.
    • password: The password for the BrowserStack account.
    • proxy (optional; default: null): Proxy server supporting HTTPS to be used for connecting to BrowserStack. e.g. "http://proxy.example.com:1234"

automateClient.getPlan(callback)

Gets information about your group's App Automate plan, including the maximum number of parallel sessions allowed and the number of parallel sessions currently running.

  • callback (function(error, plan)): A callback to invoke when the API call is complete.
    • plan: An object with parallel_sessions_max_allowed, parallel_sessions_running, and automate_plan showing the current state of your plan.

automateClient.getProjects(callback)

Gets the list of projects.

  • callback (function(error, projects)): A callback to invoke when the API call is complete.

automateClient.getProject(id, callback)

Gets information about a project.

  • id: The ID of the project.
  • callback (function(error, project)): A callback to invoke when the API call is complete.

automateClient.getBuilds([options,] callback)

Gets the list of builds.

  • options (optional): An object containing search parameters.
    • limit: The number of builds to return. Defaults to 10.
    • status: Filter builds based on status. May be one of "running", "done", "failed", "timeout".
  • callback (function(error, builds)): A callback to invoke when the API call is complete.

automateClient.getSessions(buildId, [options,] callback)

Gets the list of sessions in a build.

  • buildId: The hashed ID of the build.
  • options (optional): An object containing search parameters.
    • limit: The number of sessions to return. Defaults to 10.
    • status: Filter sessions based on status. May be one of "running", "done", "failed".
  • callback (function(error, sessions)): A callback to invoke when the API call is complete.

automateClient.getSession(id, callback)

Gets the details for a session.

  • id: The hashed ID of the session.
  • callback (function(error, session)): A callback to invoke when the API call is complete.

automateClient.updateSession(id, options, callback)

Updates the status of a session.

  • id: The hashed ID of the session.
  • options: An object containing the parameters.
    • status: New status value. May be one of "completed" or "error".
  • callback (function(error, session)): A callback to invoke when the API call is complete.

automateClient.deleteSession(id, callback)

Deletes a session.

  • id: The hashed ID of the session.
  • callback (function(error, data)): A callback to invoke when the API call is complete.
    • data: An object with a message, confirming the deletion.

Screenshots API

BrowserStack.createScreenshotClient(settings)

Creates a new client instance.

  • settings: A hash of settings that apply to all requests for the new client.
    • username: The username for the BrowserStack account.
    • password: The password for the BrowserStack account.
    • proxy (optional; default: null): Proxy server supporting HTTPS to be used for connecting to BrowserStack. e.g. "http://proxy.example.com:1234"

screenshotClient.getBrowsers(callback)

Gets the list of available browsers.

  • callback (function(error, browsers)): A callback to invoke when the API call is complete.

screenshotClient.generateScreenshots(options, callback)

Creates a job to take screenshots.

  • options: A hash of settings for the screenshots. See screenshot job objects for details.
    • url: The URL of the desired page.
    • browsers: A collection of browser objects indicating which browsers and devices to take screenshots with.
    • win_res (optional): Only required if taking a screenshot on Windows. Defaults to "1024x768".
    • mac_res (optional): Only required if taking a screenshot on Mac OS X. Defaults to "1024x768"`.
    • orientation (optional): Defaults to "portrait".
    • quality (optional): Defaults to "compressed".
    • wait_time (optional): Defaults to 5.
    • local (optional): Defaults to false.
  • callback (function(error, job)): A callback to invoke when the API call is complete.

screenshotClient.getJob(id, callback)

Gets details about the current status of a screenshot job.

Tests

To run the full test suite, you must have a BrowserStack account. Run npm test with the BROWSERSTACK_USERNAME and BROWSERSTACK_KEY environment variables set.

To run just the lint checks, run npm lint.

License

Copyright node-browserstack contributors. Released under the terms of the MIT license.

node-browserstack's People

Contributors

airportyh avatar b1zzu avatar daffl avatar dependabot[bot] avatar gingermusketeer avatar jazzzz avatar joshlangner avatar jzaefferer avatar kartsims avatar mukeshtiwari1987 avatar nakula avatar saranshbs avatar scottgonzalez avatar shirish87 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-browserstack's Issues

Automate API and code linter

Hi @scottgonzalez !

I am back with a new soon-to-be PR to support Automate API. BrowserStack actually proposes 3 APIs... And I also need the last one for my project so I thought I would implement its features to your NPM module too...

It is pretty simple so I will just propose the PR following best practices that we did last time for Screenshots API...

One thing though where we had some troubles was code style. I use Atom with the jsbeautify plugin, which can get code style configuration from a .jsbeautifyrc file so I thought it would be nice to include it in the repo, what do you think ? To do so, I would need your file in whatever format it is. Could you provide me that in a Gist or something ?

Thanks !

changeUrl returning 500 error

Hey there, I am not too sure whether this is a problem within this lib, the API or my implementation but I am currently getting a 500 error back when trying to call this function. The endpoint is also not currently listed on the API schema, so wondering if this functionality has been removed?

<!DOCTYPE html>
<html>
<head>
  <title>We're sorry, but something went wrong (500)</title>
  <style type="text/css">
    body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
    div.dialog {
      width: 25em;
      padding: 0 4em;
      margin: 4em auto 0 auto;
      border: 1px solid #ccc;
      border-right-color: #999;
      border-bottom-color: #999;
    }
    h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
  </style>
</head>

<body>
  <!-- This file lives in public/500.html -->
  <div class="dialog">
    <h1>We're sorry, but something went wrong.</h1>
    <p>We've been notified about this issue and we'll take a look at it shortly.</p>
  </div>
</body>
</html>

Improve readme to include a test.

How does one use this code? The readme illustrates how to read browsers, and then we've got a list of functions with no real clear idea as far as the flow of what to what.

Should the readme have an assert for an example? Or is this out of scope?

Review v3 API

BrowserStack has a tendency to add new features to their API without changing versions. A quick glance at the create worker API shows that they've added project, name, and build fields. The full API should be reviewed and compared to what's currently supported/documented in node-browserstack. It's possible that the only updates necessary will be documentation changes.

CLI and tunneling

Hey Scott,
Would you be open to a pull request that adds a CLI for browserstack and support for tunneling? I had written my own browserstack.js for a CLI before coming across node-browserstack. It would be fairly easy to adapt my CLI work to node-browserstack.

Usage: browserstack [options] [command]

  Commands:

    launch <browser> <url>
    Launch a remote browser:version at a url

    tunnel <host> <port>
    Create a tunnel

    launched 
    List live browsers

    all
    List all available browsers

  Options:

    -h, --help     output usage information
    -V, --version  output the version number
    -u, --user     Launch authentication username:password
    -t, --timeout  Launch duration after which browsers exit
    -k, --key      Tunnel auth key
    --ssl          Tunnel should use ssl

Getting: "Uncaught TypeError: Invalid Version: "

I get the following when it tries to const BrowserStack = require('browserstack')
or ES6
import BrowserStack from 'browserstack'

ideas please

Uncaught TypeError: Invalid Version: 
    at new SemVer (eval at <anonymous> (app.js:8368), <anonymous>:293:11)
    at compare (eval at <anonymous> (app.js:8368), <anonymous>:570:10)
    at Function.lt (eval at <anonymous> (app.js:8368), <anonymous>:604:10)
    at Object.eval (eval at <anonymous> (app.js:8374), <anonymous>:10:12)
    at eval (eval at <anonymous> (app.js:8374), <anonymous>:56:30)
    at Object.<anonymous> (app.js:8374)
    at __webpack_require__ (app.js:556)
    at fn (app.js:87)
    at Object.eval (eval at <anonymous> (app.js:8362), <anonymous>:6:1)
    at eval (eval at <anonymous> (app.js:8362), <anonymous>:103:30)

delete multiple sessions & builds

Would be awesome if methods for deleting multiple sessions and builds:

  • automateClient.deleteSessions()
  • automateClient.deleteBuild()
  • automateClient.deleteBuilds()

Currently only deleteSession() seems to be implemented when it comes to deletion.

How do I find out a worker result

Hello there!

I'm trying to use this module to launch a browserstack worker so I can test an internal jasmine-runner page. So I start up a local server, create a tunnel through BrowserStackTunnel.jar and then use this module to create a worker pointing to my local server.
My problem is that I don't know how to get some results from the page. I mean, I create the worker and it seems to run, but I don't get any result after the worker is done.
What is the purpose of the worker then? What am I testing if I can't get any result?

Thanks in advance.

App Automate to use the new dashboard

Hi Scott
This is an enhancement request.
The AppAutomate is using the old dashboard. BrowserStack has a new dashboard.
Would be nice to get the getSession method changed from
https://app-automate.browserstack.com/builds/<builId>/sessions/<sessionId>
to
https://app-automate.browserstack.com/dashboard/v2/builds/<builId>/sessions/<sessionId> So the URL points to the new dashboard
Thanks

Readme update to show createWorker new url navigation

Ok so here is whats happening, and this could be that I'm trying to do something wrong

from BrowserStack.createClient I create a client.createWorker from one of the browsers with an appended url. It works great and I get see the results, but I cant figure out how to access the client.createWorker id so I can then implement a client.changeUrl I'm new to callbacks so I haven't fully grocked it but I do have one working. ok here is some sample code of what I'm doing:

function main(callback) {
    var testables = {};
    client.getBrowsers(function( error, browsers) {
        if(error) {
            return callback(error);
        }
        //OS Groups
        os_groups = _.groupBy(browsers, 'os');
        windows = _.groupBy(os_groups.Windows, 'os_version');
        osx = _.groupBy(os_groups['OS X'], 'os_version');
        ios = _.groupBy(os_groups['ios'], 'os_version');
        android = _.groupBy(os_groups['android'], 'os_version');


        //windows 10
        windows_10 = _.groupBy(windows['10'], 'browser');
        testables.windows_10_chrome = _.max(windows_10.chrome, function(ten_chrome){return ten_chrome.browser_version;});
        testables.windows_10_firefox = _.max(windows_10.firefox, function(ten_firefox){return ten_firefox.browser_version;});
        testables.windows_10_ie = _.max(windows_10.ie, function(ten_ie){return ten_ie.browser_version;});
        //osx El Capitan
        osx_ElCap = _.groupBy(osx['El Capitan'], 'browser');
        testables.osx_ElCap_chrome = _.max(osx_ElCap.chrome, function(El_chrome){return El_chrome.browser_version;});
        testables.osx_ElCap_firefox = _.max(osx_ElCap.firefox, function(El_firefox){return El_firefox.browser_version;});
        testables.osx_ElCap_safari = _.max(osx_ElCap.safari, function(El_safari){return El_safari.browser_version;});
        callback(null, testables);
    });
}

function handleMainResult(err, result) {
    if (err) {
        console.error(err.stack || err.message);
        return;
    }
    console.log("RESULT", result);
    for(var testpoint in result){
        console.log("TESTPOINT", testpoint);
        var testpointproperties = result[testpoint];
        testpointproperties["project"] = testpoint;
        testpointproperties["url"] = siteurl;
        testpointproperties["timeout"] = 5;
        //console.log(testpointproperties);
        client.createWorker(testpointproperties);
    };

    urlList = getUrls();
    console.log(urlList);
};

Context:
The end result is that I want to be able to build my projects based on OS and browser
then download the screenshots to integrate the results into a jenkins job that will populate an internal website with latest screen shots.

API unable to update job name

Hello, I have come across a case where the package wont update the job name using the automate client.
I am automating using selenium and cucumber JS with typescript.
I am passing name and status to be updated to my respective browserstack job, however, only status gets updated.
here is the code of where i am trying to achieve it:

 async updateTestStatus(sessionId: string, params: any) {
    this.sessionClient = await browserstack.createAutomateClient(this.browserStackCredentials);

    await this.sessionClient.updateSession(sessionId, params, (error, session) => {
      if (error) {
        return Error;
      } 
    });
  }

and I am calling it like this in my After hook:

After(async (hookForResult: HookScenarioResult) => {
    if (hookForResult.failureException) {
      await browserStackApi.updateTestStatus(sessionId,
       {name: hookForResult.scenario.name, status: hookForResult.status});
      driver.takeScreenshot().then(data => {
        attach(new Buffer(data, 'base64'), 'image/png');
      }).catch(error => {
        // tslint:disable-next-line:no-console
        logger.printLog(error);
        throw error;
      });
    } else {
     await browserStackApi.updateTestStatus(sessionId,
      {name: hookForResult.scenario.name, status: hookForResult.status});
    }
  });

Please suggest.

takeScreenshot failing

Hey there, I am encountering an intermittent error and just not too sure where it's coming from, the takeScreenshot callback is passed error, data but when logging it out it seems to have been passed incorrect values.

error = null;
data = {};

I think that this is being caused by the remote browser having been shutdown and it's actually the Browserstack API that could be passing the wrong value? Any thoughts would be welcome.

npm audit vulnerabilities

High            Machine-In-The-Middle

  Package         https-proxy-agent

  Patched in      >=3.0.0

  Dependency of   browserstack

  Path            browserstack > https-proxy-agent

  More info       https://npmjs.com/advisories/1184


  High            Machine-In-The-Middle

  Package         https-proxy-agent

  Patched in      >=3.0.0

  Dependency of   browserstacktunnel-wrapper

  Path            browserstacktunnel-wrapper > https-proxy-agent

  More info       https://npmjs.com/advisories/1184

@scottgonzalez can you have a look please? You will need to make the update on browserstacktunnel-wrapper too.

Thanks!

getLatest not available from BrowserStack.createAutomateClient

This code snippet return a function:

require('browserstack').createClient({username:'u',password:'p'}).getLatest

But these returns undefined:

require('browserstack').createAutomateClient({username:'u',password:'p'}).getLatest
require('browserstack').createScreenshotClient({username:'u',password:'p'}).getLatest

I'm using createAutomateClient to filter out browsers which won't be possible to connect to using Selenium WebDriver, but would also like to just be able to test the latest.

npm module?

Could you make this into a node module, it's quite easy just run "npm init"

using updateSession

Hi,
I am new to the browserstack side of the things and currently trying to implement and use this package to update my test session to pass or fail on the basis of my scenario result:
So far:

import * as browserstack from 'browserstack';

const browserStackCredentials = {
  username: '<My username>',
  password: '<My Key>'
};

const automateClient = browserstack.createAutomateClient(browserStackCredentials);

After(async scenario => {
    if (scenario.failureException) {
      await automateClient.updateSession(sessionId, {status: 'fail'});

But this code errors:
TypeError: Request path contains unescaped characters
I have no clue how to fix this. Please help.

I am using CucumberJS with Typescript and selenium-webdriver for my automation

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.