{"author":{"name":"Scott González","email":"scott.gonzalez@gmail.com","url":"http://scottgonzalez.com"},"name":"browserstack","description":"A client for working with the BrowserStack API.","version":"0.1.0","homepage":"https://github.com/scottgonzalez/node-browserstack","repository":{"type":"git","url":"git://github.com/scottgonzalez/node-browserstack.git"},"engines":{"node":">=0.4.0"},"dependencies":{},"devDependencies":{"grunt":"0.3.x"},"main":"lib/browserstack.js","_npmUser":{"name":"scott.gonzalez","email":"scott.gonzalez@gmail.com"},"_id":"browserstack@0.1.0","optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.0-3","_nodeVersion":"v0.6.10","_defaultsLoaded":true,"dist":{"shasum":"5cf9d95ce7d116190bb713651cb5ef65fae4c766","tarball":"http://registry-npm.ywwl.com/browserstack/download/browserstack-0.1.0.tgz","integrity":"sha512-2ucyE8W6lq1/jh1T0xJ4P/waEbHOf0TEZT4ZSiQcgJn5E+VMro1gC/9xWoXeo/xo/DaWyPy3YRLwxJH6NOKlLw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEiojwUXwhO/E16poReCZtJ/sP7qziRZcVLjir3jQxTiAiAFPFUaPLqvdL64li94M6gQ7wsNKWo1BysiaB7TmM9gMg=="}],"size":5326,"noattachment":false,"key":"/browserstack/-/browserstack-0.1.0.tgz"},"maintainers":[{"name":"scott.gonzalez","email":"scott.gonzalez@gmail.com"}],"directories":{},"readme":"# node-browserstack\n\nA node.js JavaScript client for working with [BrowserStack](http://browserstack.com) through its [REST API](https://github.com/browserstack/api) (*aka* Javascript Testing API), [Automate API](https://www.browserstack.com/automate/rest-api), [App Automate API](https://www.browserstack.com/app-automate/rest-api), and [Screenshots API](https://www.browserstack.com/screenshots/api).\n\n## Installation\n\n```\nnpm install browserstack\n```\n\n## Usage\n\n```javascript\nvar BrowserStack = require(\"browserstack\");\nvar browserStackCredentials = {\n\tusername: \"foo\",\n\tpassword: \"p455w0rd!!1\"\n};\n\n// REST API\nvar client = BrowserStack.createClient(browserStackCredentials);\n\nclient.getBrowsers(function(error, browsers) {\n\tconsole.log(\"The following browsers are available for testing\");\n\tconsole.log(browsers);\n});\n\n// Automate API\nvar automateClient = BrowserStack.createAutomateClient(browserStackCredentials);\n\nautomateClient.getBrowsers(function(error, browsers) {\n\tconsole.log(\"The following browsers are available for automated testing\");\n\tconsole.log(browsers);\n});\n\n// App Automate API\n// Show the upload builds for mobile app automation\nvar appAutomateClient = BrowserStack.createAppAutomateClient(browserStackCredentials);\n\nappAutomateClient.getBuilds(function(error, builds) {\n\tconsole.log(\"The following builds are available for app automated testing\");\n\tconsole.log(builds);\n});\n\n// Screenshots API\nvar screenshotClient = BrowserStack.createScreenshotClient(browserStackCredentials);\n\nscreenshotClient.getBrowsers(function(error, browsers) {\n\tconsole.log(\"The following browsers are available for screenshots\");\n\tconsole.log(browsers);\n});\n```\n\n## API\n\n### Objects\n\n#### browser objects\n\nA common pattern in the APIs is a \"browser object\" which is just a plain object with the following properties:\n\n* `os`: The operating system.\n* `os_version`: The operating system version.\n* `browser`: The browser name.\n* `browser_version`: The browser version.\n* `device`: The device name.\n\nA browser object may only have one of `browser` or `device` set; which property is set will depend on `os`.\n\n#### worker objects\n\nWorker objects are extended [browser objects](#browser-objects) which contain the following additional properties:\n\n* `id`: The worker id.\n* `status`: A string representing the current status of the worker.\n\t* Possible statuses: `\"running\"`, `\"queue\"`.\n\n#### project objects\n\nProject objects are plain objects which contain the following properties:\n\n* `id`: The id of the project.\n* `name`: The name of the project.\n* `created_at`: When the project was created.\n* `updated_at`: When the project was most recently updated.\n* `user_id`\n* `group_id`\n\n#### build objects\n\nBuild objects are plain objects which contain the following properties:\n\n* `hashed_id`: The hashed if of the build.\n* `name`: The name of the build.\n* `status`: The status of the build.\n* `duration`\n\n#### extended build objects\n\nExtended build objects are [build objects](#build-objects) with the following additional properties:\n\n* `id`: The id of the build.\n* `automation_project_id`: The id of the project this build belongs to.\n* `updated_at`: When the build was created.\n* `created_at`: When the build was most recently updated.\n* `delta`\n* `tags`\n* `user_id`\n* `group_id`\n\n#### session objects\n\nSession objects are extended [browser objects](#browser-objects) which contain the following additional properties:\n\n* `hashed_id`: The hashed ID of the session.\n* `name`: The name of the session.\n* `build_name`: The name of the build this session belongs to.\n* `project_name`: The name of the project this session belongs to.\n* `status`: The status of the session.\n* `browser_url`: The most recenly loaded URL the worker.\n* `duration`: The duration in seconds that the session has been active.\n* `logs`: The URL for the session logs.\n* `video_url`: The URL for the session video.\n* `reason`: The reason the session was terminated.\n\n#### screenshot job objects\n\nScreenshot job objects are plain objects which contain the following properties:\n\n* `job_id`: The id of the job.\n* `state`: The state of the job.\n* `win_res`: The screen resolution for browsers running on Windows. May be one of: `\"1024x768\"`, `\"1280x1024\"`.\n* `mac_res`: The screen resolution for browsers running on Mac OS X. May be one of: `\"1024x768\"`, `\"1280x960\"`, `\"1280x1024\"`, `\"1600x1200\"`, `\"1920x1080\"`.\n* `orientation`: The screen orientation for devices. May be one of: `\"portrait\"`, `\"landscape\"`.\n* `quality`: The quality of the screenshot. May be one of: `\"original\"`, `\"compressed\"`.\n* `wait_time`: The number of seconds to wait before taking the screenshot. May be one of: `2`, `5`, `10`, `15`, `20`, `60`.\n* `local`: Boolean indicating whether a local testing connection should be used.\n* `browsers`: A collection of [browser objects](#browser-objects) indicating which browsers and devices to take screenshots with.\n\n### screenshot state objects\n\nScreenshot state objects are extended [browser objects](#browser-objects) which contain the following additional properties:\n\n* `id`: The id of the screenshot object.\n* `state`: The state of the screenshot.\n* `url`: The URL of the page the screenshot was generated from.\n* `thumb_url`: The URL for the screenshot thumbnail.\n* `image_url`: The URL for the full-size screenshot.\n* `created_at`: The timestamp indicating when the screenshot was generated.\n\n### REST API v4\n\n*Note: For earlier versions of the API, please see [the wiki](https://github.com/scottgonzalez/node-browserstack/wiki/API).*\n\n#### BrowserStack.createClient(settings)\n\nCreates a new client instance.\n\n* `settings`: A hash of settings that apply to all requests for the new client.\n\t* `username`: The username for the BrowserStack account.\n\t* `password`: The password for the BrowserStack account.\n\t* `version` (optional; default: `4`): Which version of the BrowserStack API to use.\n\t* `server` (optional; default: `{ host: \"api.browserstack.com\", port: 80 }`): An object containing `host` and `port` to connect to a different BrowserStack API compatible service.\n\t* `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\"`\n\n#### client.getBrowsers(callback)\n\nGets the list of available browsers.\n\n* `callback` (`function(error, browsers)`): A callback to invoke when the API call is complete.\n\t* `browsers`: An array of [browser objects](#browser-objects).\n\n#### client.createWorker(settings, callback)\n\nCreates a worker.\n\n* `settings`: A hash of settings for the worker (an extended [browser object](#browser-objects)).\n\t* `os`: See [browser object](#browser-objects) for details.\n\t* `os_version`: See [browser object](#browser-objects) for details.\n\t* `browser`: See [browser object](#browser-objects) for details.\n\t* `browser_version`: See [browser object](#browser-objects) for details.\n\t* `device`: See [browser object](#browser-objects) for details.\n\t* `url` (optional): Which URL to navigate to upon creation.\n\t* `timeout` (optional): Maximum life of the worker (in seconds). Maximum value of `1800`. Specifying `0` will use the default of `300`.\n\t* `name` (optional): Provide a name for the worker.\n\t* `build` (optional): Group workers into a build.\n\t* `project` (optional): Provide the project the worker belongs to.\n\t* `browserstack.video` (optional): Set to `false` to disable video recording.\n* `callback` (`function(error, worker)`): A callback to invoke when the API call is complete.\n\t* `worker` A [worker object](#worker-objects).\n\n*Note: A special value of `\"latest\"` is supported for `browser_version`, which will use the latest stable version.*\n\n#### client.getWorker(id, callback)\n\nGets the status of a worker.\n\n* `id`: The id of the worker.\n* `callback` (`function(error, worker)`): A callback to invoke when the API call is complete.\n\t* `worker`: A [worker object](#worker-objects).\n\n#### client.changeUrl(id, options, callback)\n\nChange the URL of a worker.\n\n* `id`: The id of the worker.\n* `options`: Configuration for the URL change.\n\t* `url`: The new URL to set.\n\t* `timeout` (optional): Set a new timeout for this worker, see [createWorker](#client.CreateWorker) for details.\n* `callback` (`function(error, data)`): A callback to invoke when the API call is complete.\n\t* `data`: An object with a `message`, confirming the URL change.\n\n#### client.terminateWorker(id, callback)\n\nTerminates an active worker.\n\n* `id`: The id of the worker to terminate.\n* `callback` (`function(error, data)`): A callback to invoke when the API call is complete.\n\t* `data`: An object with a `time` property indicating how long the worker was alive.\n\n#### client.getWorkers(callback)\n\nGets the status of all workers.\n\n* `callback` (`function(error, workers)`): A callback to invoke when the API call is complete.\n\t* `workers`: An array of [worker objects](#worker-objects).\n\n#### client.takeScreenshot(id, callback)\n\nTake a screenshot at current state of worker.\n\n* `callback` (`function(error, data)`): A callback to invoke when the API call is complete.\n\t* `data`: An object with a `url` property having the public url for the screenshot.\n\n#### client.getLatest(browser, callback)\n\nGets the latest version of a browser.\n\n* `browser`: Which browser to get the latest version for. See [browser object](#browser-objects) for details.\n* `callback` (`function(error, version)`): A callback to invoke when the version is determined.\n\t* `version`: The latest version of the browser.\n\n*Note: Since mobile devices do not have version numbers, there is no latest version.*\n\n#### client.getLatest(callback)\n\nGets the latest version of all browsers.\n\n* `callback` (`function(error, versions)`): A callback to invoke when the versions are determined.\n\t* `versions`: A hash of browser names and versions.\n\n#### client.getApiStatus(callback)\n\n* `callback` (`function(error, status)`): A callback to invoke when the status is determined.\n\t* `used_time`: Time used so far this month, in seconds.\n\t* `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.\n\t* `running_sessions`: Number of running sessions.\n\t* `sessions_limit`: Number of allowable concurrent sessions.\n\n### Automate API\n\n#### BrowserStack.createAutomateClient(settings)\n\nCreates a new client instance.\n\n* `settings`: A hash of settings that apply to all requests for the new client.\n\t* `username`: The username for the BrowserStack account.\n\t* `password`: The password for the BrowserStack account.\n\t* `proxy` (optional; default: `null`): Proxy server supporting HTTPS to be used for connecting to BrowserStack. e.g. `\"http://proxy.example.com:1234\"`\n\n#### automateClient.getPlan(callback)\n\nGets information about your group's Automate plan, including the maximum number of parallel sessions allowed and the number of parallel sessions currently running.\n\n* `callback` (`function(error, plan)`): A callback to invoke when the API call is complete.\n\t* `plan`: An object with `parallel_sessions_max_allowed`, `parallel_sessions_running`, and `automate_plan` showing the current state of your plan.\n\n#### automateClient.getBrowsers(callback)\n\nGets the list of available browsers.\n\n* `callback` (`function(error, browsers)`): A callback to invoke when the API call is complete.\n\t* `browsers`: An array of [browser objects](#browser-objects).\n\n#### automateClient.getProjects(callback)\n\nGets the list of projects.\n\n* `callback` (`function(error, projects)`): A callback to invoke when the API call is complete.\n\t* `projects`: An array of [project objects](#project-objects).\n\n#### automateClient.getProject(id, callback)\n\nGets information about a project.\n\n* `id`: The ID of the project.\n* `callback` (`function(error, project)`): A callback to invoke when the API call is complete.\n\t* `project`: A [project object](#project-objects) including an array of [extended build objects](#build-objects).\n\n#### automateClient.getBuilds([options,] callback)\n\nGets the list of builds.\n\n* `options` (optional): An object containing search parameters.\n\t* `limit`: The number of builds to return. Defaults to `10`.\n\t* `status`: Filter builds based on status. May be one of `\"running\"`, `\"done\"`, `\"failed\"`, `\"timeout\"`.\n* `callback` (`function(error, builds)`): A callback to invoke when the API call is complete.\n\t* `builds`: An array of [build objects](#build-objects).\n\n#### automateClient.getSessions(buildId, [options,] callback)\n\nGets the list of sessions in a build.\n\n* `buildId`: The hashed ID of the build.\n* `options` (optional): An object containing search parameters.\n\t* `limit`: The number of sessions to return. Defaults to `10`.\n\t* `status`: Filter sessions based on status. May be one of `\"running\"`, `\"done\"`, `\"failed\"`.\n* `callback` (`function(error, sessions)`): A callback to invoke when the API call is complete.\n\t* `sessions`: An array of [session objects](#session-objects).\n\n#### automateClient.getSession(id, callback)\n\nGets the details for a session.\n\n* `id`: The hashed ID of the session.\n* `callback` (`function(error, session)`): A callback to invoke when the API call is complete.\n\t* `session`: A [session object](#session-objects).\n\n#### automateClient.updateSession(id, options, callback)\n\nUpdates the status of a session.\n\n* `id`: The hashed ID of the session.\n* `options`: An object containing the parameters.\n\t* `status`: New status value. [May be one of](https://www.browserstack.com/automate/rest-api#rest-api-sessions) `\"completed\"` or `\"error\"`.\n* `callback` (`function(error, session)`): A callback to invoke when the API call is complete.\n\t* `session`: The updated [session object](#session-objects).\n\n#### automateClient.deleteSession(id, callback)\n\nDeletes a session.\n\n* `id`: The hashed ID of the session.\n* `callback` (`function(error, data)`): A callback to invoke when the API call is complete.\n\t* `data`: An object with a `message`, confirming the deletion.\n\n### App Automate API\n\n#### BrowserStack.createAppAutomateClient(settings)\n\nCreates a new client instance.\n\n* `settings`: A hash of settings that apply to all requests for the new client.\n\t* `username`: The username for the BrowserStack account.\n\t* `password`: The password for the BrowserStack account.\n\t* `proxy` (optional; default: `null`): Proxy server supporting HTTPS to be used for connecting to BrowserStack. e.g. `\"http://proxy.example.com:1234\"`\n\n#### automateClient.getPlan(callback)\n\nGets information about your group's App Automate plan, including the maximum number of parallel sessions allowed and the number of parallel sessions currently running.\n\n* `callback` (`function(error, plan)`): A callback to invoke when the API call is complete.\n\t* `plan`: An object with `parallel_sessions_max_allowed`, `parallel_sessions_running`, and `automate_plan` showing the current state of your plan.\n\n#### automateClient.getProjects(callback)\n\nGets the list of projects.\n\n* `callback` (`function(error, projects)`): A callback to invoke when the API call is complete.\n\t* `projects`: An array of [project objects](#project-objects).\n\n#### automateClient.getProject(id, callback)\n\nGets information about a project.\n\n* `id`: The ID of the project.\n* `callback` (`function(error, project)`): A callback to invoke when the API call is complete.\n\t* `project`: A [project object](#project-objects) including an array of [extended build objects](#build-objects).\n\n#### automateClient.getBuilds([options,] callback)\n\nGets the list of builds.\n\n* `options` (optional): An object containing search parameters.\n\t* `limit`: The number of builds to return. Defaults to `10`.\n\t* `status`: Filter builds based on status. May be one of `\"running\"`, `\"done\"`, `\"failed\"`, `\"timeout\"`.\n* `callback` (`function(error, builds)`): A callback to invoke when the API call is complete.\n\t* `builds`: An array of [build objects](#build-objects).\n\n#### automateClient.getSessions(buildId, [options,] callback)\n\nGets the list of sessions in a build.\n\n* `buildId`: The hashed ID of the build.\n* `options` (optional): An object containing search parameters.\n\t* `limit`: The number of sessions to return. Defaults to `10`.\n\t* `status`: Filter sessions based on status. May be one of `\"running\"`, `\"done\"`, `\"failed\"`.\n* `callback` (`function(error, sessions)`): A callback to invoke when the API call is complete.\n\t* `sessions`: An array of [session objects](#session-objects).\n\n#### automateClient.getSession(id, callback)\n\nGets the details for a session.\n\n* `id`: The hashed ID of the session.\n* `callback` (`function(error, session)`): A callback to invoke when the API call is complete.\n\t* `session`: A [session object](#session-objects).\n\n#### automateClient.updateSession(id, options, callback)\n\nUpdates the status of a session.\n\n* `id`: The hashed ID of the session.\n* `options`: An object containing the parameters.\n\t* `status`: New status value. [May be one of](https://www.browserstack.com/automate/rest-api#rest-api-sessions) `\"completed\"` or `\"error\"`.\n* `callback` (`function(error, session)`): A callback to invoke when the API call is complete.\n\t* `session`: The updated [session object](#session-objects).\n\n#### automateClient.deleteSession(id, callback)\n\nDeletes a session.\n\n* `id`: The hashed ID of the session.\n* `callback` (`function(error, data)`): A callback to invoke when the API call is complete.\n\t* `data`: An object with a `message`, confirming the deletion.\n\n### Screenshots API\n\n#### BrowserStack.createScreenshotClient(settings)\n\nCreates a new client instance.\n\n* `settings`: A hash of settings that apply to all requests for the new client.\n\t* `username`: The username for the BrowserStack account.\n\t* `password`: The password for the BrowserStack account.\n\t* `proxy` (optional; default: `null`): Proxy server supporting HTTPS to be used for connecting to BrowserStack. e.g. `\"http://proxy.example.com:1234\"`\n\n#### screenshotClient.getBrowsers(callback)\n\nGets the list of available browsers.\n\n* `callback` (`function(error, browsers)`): A callback to invoke when the API call is complete.\n\t* `browsers`: An array of [browser objects](#browser-objects).\n\n#### screenshotClient.generateScreenshots(options, callback)\n\nCreates a job to take screenshots.\n\n* `options`: A hash of settings for the screenshots. See [screenshot job objects](#screenshot-job-objects) for details.\n\t* `url`: The URL of the desired page.\n\t* `browsers`: A collection of [browser objects](#browser-objects) indicating which browsers and devices to take screenshots with.\n\t* `win_res` (optional): Only required if taking a screenshot on Windows. Defaults to `\"1024x768\"`.\n\t* `mac_res` (optional): Only required if taking a screenshot on Mac OS X. Defaults to \"1024x768\"`.\n\t* `orientation` (optional): Defaults to `\"portrait\"`.\n\t* `quality` (optional): Defaults to `\"compressed\"`.\n\t* `wait_time` (optional): Defaults to `5`.\n\t* `local` (optional): Defaults to `false`.\n* `callback` (`function(error, job)`): A callback to invoke when the API call is complete.\n\t* `job`: A [screenshot job object](#screenshot-job-objects) containing [screenshot state objects](#screenshot-state-objects) in place of [browser objects](#browser-objects).\n\n#### screenshotClient.getJob(id, callback)\n\nGets details about the current status of a screenshot job.\n\n* `id`: The id of the job.\n* `callback` (`function(error, job)`): A callback to invoke when the API call is complete.\n\t* `job`: A [screenshot job object](#screenshot-job-objects) containing [screenshot state objects](#screenshot-state-objects) in place of [browser objects](#browser-objects).\n\n## Tests\n\nTo run the full test suite, you must have a BrowserStack account. Run `npm test` with the `BROWSERSTACK_USERNAME` and `BROWSERSTACK_KEY` environment variables set.\n\nTo run just the lint checks, run `npm lint`.\n\n## License\n\nCopyright node-browserstack contributors. Released under the terms of the MIT license.\n","publish_time":1336583294706,"_cnpm_publish_time":1336583294706,"dist-tags":{"latest":"1.6.1"}}