Skip to content

Commit 0b5e4f2

Browse files
committed
Update README.md
1 parent f2c2924 commit 0b5e4f2

File tree

1 file changed

+102
-30
lines changed

1 file changed

+102
-30
lines changed

README.md

+102-30
Original file line numberDiff line numberDiff line change
@@ -2,49 +2,121 @@
22

33
[![Build Status](https://travis-ci.org/browserstack/browserstack-local-nodejs.svg?branch=master)](https://travis-ci.org/browserstack/browserstack-local-nodejs)
44

5-
## Setup
5+
A simple Ruby wrapper for BrowserStack Local Binary.
66

7+
## Installation:
8+
9+
```
10+
gem install browserstack-local
11+
```
12+
13+
## Example:
14+
15+
```
16+
require 'browserstack-local'
17+
18+
#creates an instance of Local
19+
bs_local = BrowserStack::Local.new
20+
21+
#replace <browserstack-accesskey> with your key.
22+
# you may not add it if you have 'BROWSERSTACK_ACCESS_KEY' in your environment variables.
23+
bs_local_args = { "key" => "<browserstack-accesskey>" }
24+
25+
#starts the Local instance with the required arguments
26+
bs_local.start(bs_local_args)
27+
28+
#check if BrowserStack local instance is running
29+
bs_local.isRunning
30+
31+
#stop the Local instance
32+
bs_local.stop
33+
34+
```
35+
36+
## Additional Arguments
37+
38+
Apart from the key all other arguments are optional. For the full list of arguments, refer [BrowserStack Local modifiers](https://www.browserstack.com/local-testing#modifiers). To specify these arguments add them to the input hash for the BrowserStack::Local without the hyphen. For examples, refer below -
39+
40+
#### Verbose Logging
41+
To enable verbose logging -
42+
```
43+
bs_local_args = { "key" => "BROWSERSTACK_ACCESS_KEY" , "v" => "true"}
44+
```
45+
46+
#### Folder Testing
47+
To test local folder rather internal server, provide path to folder as value of this option -
48+
```
49+
bs_local_args = { "key" => "BROWSERSTACK_ACCESS_KEY" , "f" => "/my/awesome/folder"}
750
```
8-
npm install browserstack
51+
52+
#### Force Start
53+
To kill other running Browserstack Local instances -
54+
```
55+
bs_local_args = { "key" => "BROWSERSTACK_ACCESS_KEY" , "force" => "true"}
56+
```
57+
58+
#### Only Automate
59+
To disable local testing for Live and Screenshots, and enable only Automate -
60+
```
61+
bs_local_args = { "key" => "BROWSERSTACK_ACCESS_KEY" , "onlyAutomate" => "true"}
62+
```
63+
64+
#### Force Local
65+
To route all traffic via local(your) machine -
66+
```
67+
bs_local_args = { "key" => "BROWSERSTACK_ACCESS_KEY" , "forcelocal" => "true"}
68+
```
69+
70+
### Proxy
71+
To use a proxy for local testing -
72+
73+
* proxyHost: Hostname/IP of proxy, remaining proxy options are ignored if this option is absent
74+
* proxyPort: Port for the proxy, defaults to 3128 when -proxyHost is used
75+
* proxyUser: Username for connecting to proxy (Basic Auth Only)
76+
* proxyPass: Password for USERNAME, will be ignored if USERNAME is empty or not specified
77+
78+
```
79+
bs_local_args = { "key" => "BROWSERSTACK_ACCESS_KEY", "proxyHost" => "127.0.0.1", "proxyPort" => "8000", "proxyUser" => "user", "proxyPass" => "password"}
80+
```
81+
82+
### Local Identifier
83+
If doing simultaneous multiple local testing connections, set this uniquely for different processes -
84+
```
85+
bs_local_args = { "key" => "BROWSERSTACK_ACCESS_KEY" , "localIdentifier" => "randomstring"}
986
```
1087

11-
## API
88+
### Binary Path
89+
Path to specify local Binary path -
90+
```
91+
bs_local_args = { "key" => "BROWSERSTACK_ACCESS_KEY" , "binarypath" => "/browserstack/BrowserStackLocal"}
92+
```
1293

13-
### Constructor
94+
### Logfile
95+
To specify the path to file where the logs will be saved -
96+
```
97+
bs_local_args = { "key" => "BROWSERSTACK_ACCESS_KEY" , "logfile" => "/browserstack/logs.txt"}
98+
```
1499

15-
* `new browserstack.Local()`: creates an instance of Local
100+
## Contribute
16101

17-
### Methods
102+
### Build Instructions
18103

19-
* `start(options, callback)`: starts Local instance with options. The options available are detailed below.
20-
* `stop(callback)`: stops the Local instance
21-
* `isRunning()`: checks if Local instance is running and returns a corresponding boolean value
104+
To build gem, `rake build`.
22105

23-
The first and only argument to any callback function will be an error object.
106+
To run the test suite run, `rake test`.
24107

25-
### Options
108+
### Reporting bugs
26109

27-
* `key`: BrowserStack Access Key
28-
* `v`: Provides verbose logging
29-
* `f`: If you want to test local folder rather internal server, provide path to folder as value of this option
30-
* `force`: Kill other running Browserstack Local
31-
* `only`: Restricts Local Testing access to specified local servers and/or folders
32-
* `forcelocal`: Route all traffic via local machine
33-
* `onlyAutomate`: Disable Live Testing and Screenshots, just test Automate
34-
* `proxyHost`: Hostname/IP of proxy, remaining proxy options are ignored if this option is absent
35-
* `proxyPort`: Port for the proxy, defaults to 3128 when -proxyHost is used
36-
* `proxyUser`: Username for connecting to proxy (Basic Auth Only)
37-
* `proxyPass`: Password for USERNAME, will be ignored if USERNAME is empty or not specified
38-
* `localIdentifier`: If doing simultaneous multiple local testing connections, set this uniquely for different processes
39-
* `hosts`: List of hosts and ports where Local must be enabled for eg. localhost,3000,1,localhost,3001,0
40-
* `logfile`: Path to file where Local logs be saved to
41-
* `binarypath`: Optional path to Local binary
110+
You can submit bug reports either in the Github issue tracker.
42111

112+
Before submitting an issue please check if there is already an existing issue. If there is, please add any additional information give it a "+1" in the comments.
43113

44-
## Tests
114+
When submitting an issue please describe the issue clearly, including how to reproduce the bug, which situations it appears in, what you expect to happen, what actually happens, and what platform (operating system and version) you are using.
45115

46-
To run the test suite run - `npm test`.
116+
### Pull Requests
47117

48-
## Example
118+
We love pull requests! We are very happy to work with you to get your changes merged in, however please keep the following in mind.
49119

50-
To run the example run - `node node-example.js`.
120+
* Adhere to the coding conventions you see in the surrounding code.
121+
* Include tests, and make sure all tests pass.
122+
* Before submitting a pull-request, clean up the history by going over your commits and squashing together minor changes and fixes into the corresponding commits. You can do this using the interactive rebase command.

0 commit comments

Comments
 (0)