From 94daaf994d35c3e1807751f8ba9df2da85e694d2 Mon Sep 17 00:00:00 2001 From: Nidhi Makhijani Date: Thu, 21 Apr 2016 15:53:28 +0530 Subject: [PATCH 01/17] readme --- README.md | 56 ++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 47 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 8a69b8d..cd31f2a 100644 --- a/README.md +++ b/README.md @@ -2,25 +2,42 @@ [![Build Status](https://travis-ci.org/browserstack/browserstack-local-ruby.svg?branch=master)](https://travis-ci.org/browserstack/browserstack-local-ruby) -## Setup +## Installation: ``` gem install browserstack-local ``` -## API +## Usage and Examples: -### Constructor +Browserstack Local has a simple API. + +``` +require 'browserstack-local' + +bs_local = new BrowserStack::Local +bs_local.add_args "force" +bs_local.add_args "onlyAutomate" +bs_local.start(bs_local_options) +if (bs_local.isRunning) + bs_local.stop() +end + +``` + +### Super Simple API + +#### Constructor * `new BrowserStack::Local`: creates an instance of Local -### Methods +#### Methods * `start(options)`: starts Local instance with options. The options available are detailed below. * `stop()`: stops the Local instance * `isRunning()`: checks if Local instance is running -### Options +#### Options * `key`: BrowserStack Access Key * `v`: Provides verbose logging @@ -38,12 +55,33 @@ gem install browserstack-local * `logfile`: Path to file where Local logs be saved to * `binarypath`: Optional path to Local binary - -## Build +## Build Instructions To build gem, `rake build`. +To run the test suite run, `rake test`. + + +## Contribute + +Reporting bugs +-------------- + +You can submit bug reports either in the Github issue tracker. + +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. + +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. + +Pull Requests +------------- + +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. + +* Adhere to the coding conventions you see in the surrounding code. +* Include tests, and make sure all tests pass. +* 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. + + -## Tests -To run the test suite run, `rake test`. From 97a18083037268bb727ad7280cab63968769f5ed Mon Sep 17 00:00:00 2001 From: Nidhi Makhijani Date: Thu, 21 Apr 2016 15:55:11 +0530 Subject: [PATCH 02/17] readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cd31f2a..0104e56 100644 --- a/README.md +++ b/README.md @@ -18,9 +18,9 @@ require 'browserstack-local' bs_local = new BrowserStack::Local bs_local.add_args "force" bs_local.add_args "onlyAutomate" -bs_local.start(bs_local_options) +bs_local.start if (bs_local.isRunning) - bs_local.stop() + bs_local.stop end ``` From 470ebd43eb3bbcef8ba34377b027c9e193207ef9 Mon Sep 17 00:00:00 2001 From: Nidhi Makhijani Date: Thu, 21 Apr 2016 17:55:49 +0530 Subject: [PATCH 03/17] readme .. todo --- README.md | 91 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 59 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 0104e56..a521695 100644 --- a/README.md +++ b/README.md @@ -8,36 +8,72 @@ gem install browserstack-local ``` -## Usage and Examples: - -Browserstack Local has a simple API. +## Examples: ``` require 'browserstack-local' -bs_local = new BrowserStack::Local -bs_local.add_args "force" -bs_local.add_args "onlyAutomate" -bs_local.start +#creates an instance of Local +bs_local = BrowserStack::Local.new + +#options for Local instance +bs_local_options = {} + +#replace BROWSERSTACK_ACCESS_KEY with your key. +#you can also use environment variables. +bs_local_options['key'] = "BROWSERSTACK_ACCESS_KEY" + +#stops the Local instance with the required options +bs_local.start(bs_local_options) + +#checks if Local instance is running if (bs_local.isRunning) + #stop the Local instance bs_local.stop end ``` -### Super Simple API +## Additional Options + +To specify other options, add it to the options hash while creating a new instance -#### Constructor +### Verbose Logging -* `new BrowserStack::Local`: creates an instance of Local +To enable verbose logging - -#### Methods +``` +bs_local_options['v'] = "true" +``` + +### Folder Testing +``` +bs_local_options['v'] = "true" +``` -* `start(options)`: starts Local instance with options. The options available are detailed below. -* `stop()`: stops the Local instance -* `isRunning()`: checks if Local instance is running -#### Options +### Force +* `force`: Kill other running Browserstack Local + +``` +bs_local_options['v'] = "true" +``` + + +### Proxy +* `proxyHost`: Hostname/IP of proxy, remaining proxy options are ignored if this option is absent +* `proxyPort`: Port for the proxy, defaults to 3128 when -proxyHost is used +* `proxyUser`: Username for connecting to proxy (Basic Auth Only) +* `proxyPass`: Password for USERNAME, will be ignored if USERNAME is empty or not specified + + +### Local Identifier + +### Hosts + +### Binary Path + +### Logfile * `key`: BrowserStack Access Key * `v`: Provides verbose logging @@ -46,26 +82,22 @@ end * `only`: Restricts Local Testing access to specified local servers and/or folders * `forcelocal`: Route all traffic via local machine * `onlyAutomate`: Disable Live Testing and Screenshots, just test Automate -* `proxyHost`: Hostname/IP of proxy, remaining proxy options are ignored if this option is absent -* `proxyPort`: Port for the proxy, defaults to 3128 when -proxyHost is used -* `proxyUser`: Username for connecting to proxy (Basic Auth Only) -* `proxyPass`: Password for USERNAME, will be ignored if USERNAME is empty or not specified + * `localIdentifier`: If doing simultaneous multiple local testing connections, set this uniquely for different processes * `hosts`: List of hosts and ports where Local must be enabled for eg. localhost,3000,1,localhost,3001,0 * `logfile`: Path to file where Local logs be saved to * `binarypath`: Optional path to Local binary -## Build Instructions -To build gem, `rake build`. +## Contribute -To run the test suite run, `rake test`. +### Build Instructions +To build gem, `rake build`. -## Contribute +To run the test suite run, `rake test`. -Reporting bugs --------------- +### Reporting bugs You can submit bug reports either in the Github issue tracker. @@ -73,15 +105,10 @@ Before submitting an issue please check if there is already an existing issue. I 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. -Pull Requests -------------- +### Pull Requests 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. * Adhere to the coding conventions you see in the surrounding code. * Include tests, and make sure all tests pass. -* 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. - - - - +* 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. \ No newline at end of file From 2279ab2f5e8cf33987ab0a4d5ffd1d34136dd41a Mon Sep 17 00:00:00 2001 From: Nidhi Makhijani Date: Thu, 21 Apr 2016 18:17:21 +0530 Subject: [PATCH 04/17] Update README.md --- README.md | 65 +++++++++++++++++++++++-------------------------------- 1 file changed, 27 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index a521695..005814d 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ gem install browserstack-local ``` -## Examples: +## Example: ``` require 'browserstack-local' @@ -16,15 +16,15 @@ require 'browserstack-local' #creates an instance of Local bs_local = BrowserStack::Local.new -#options for Local instance -bs_local_options = {} +#arguments for Local instance +bs_local_args = {} #replace BROWSERSTACK_ACCESS_KEY with your key. #you can also use environment variables. -bs_local_options['key'] = "BROWSERSTACK_ACCESS_KEY" +bs_local_args['key'] = "BROWSERSTACK_ACCESS_KEY" #stops the Local instance with the required options -bs_local.start(bs_local_options) +bs_local.start(bs_local_args) #checks if Local instance is running if (bs_local.isRunning) @@ -34,60 +34,49 @@ end ``` -## Additional Options +## Additional Arguments -To specify other options, add it to the options hash while creating a new instance - -### Verbose Logging +Apart from the key all other arguments are optional. To specify these arguments add them to the inout hash for the BrowserStack::Local constructor. +#### Verbose Logging To enable verbose logging - - ``` -bs_local_options['v'] = "true" +bs_local_args['v'] = "true" ``` -### Folder Testing +#### Folder Testing +To enable folder testing - ``` -bs_local_options['v'] = "true" +bs_local_args['v'] = "true" ``` +#### Hosts +To specify hosts and ports for Local testing for eg. localhost,3000 - -### Force -* `force`: Kill other running Browserstack Local -``` -bs_local_options['v'] = "true" -``` +#### Force Start +To kill other running Browserstack Local instances - +#### Only Automate +To only enable local testing for automate - -### Proxy -* `proxyHost`: Hostname/IP of proxy, remaining proxy options are ignored if this option is absent -* `proxyPort`: Port for the proxy, defaults to 3128 when -proxyHost is used -* `proxyUser`: Username for connecting to proxy (Basic Auth Only) -* `proxyPass`: Password for USERNAME, will be ignored if USERNAME is empty or not specified +### Proxy +To use a proxy for local testing - ### Local Identifier +If doing simultaneous multiple local testing connections, set this uniquely for different processes - ### Hosts -### Binary Path +To restrict local testing access to specified local servers and/or folder -### Logfile - -* `key`: BrowserStack Access Key -* `v`: Provides verbose logging -* `f`: If you want to test local folder rather internal server, provide path to folder as value of this option -* `force`: Kill other running Browserstack Local -* `only`: Restricts Local Testing access to specified local servers and/or folders -* `forcelocal`: Route all traffic via local machine -* `onlyAutomate`: Disable Live Testing and Screenshots, just test Automate -* `localIdentifier`: If doing simultaneous multiple local testing connections, set this uniquely for different processes -* `hosts`: List of hosts and ports where Local must be enabled for eg. localhost,3000,1,localhost,3001,0 -* `logfile`: Path to file where Local logs be saved to -* `binarypath`: Optional path to Local binary +### Binary Path +Path to specify local Binary path +### Logfile +To specify the path to file where the logs will be saved - ## Contribute @@ -111,4 +100,4 @@ We love pull requests! We are very happy to work with you to get your changes me * Adhere to the coding conventions you see in the surrounding code. * Include tests, and make sure all tests pass. -* 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. \ No newline at end of file +* 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. From 187fa87da872c89bd5a7e429d783aa1cc6a27a0e Mon Sep 17 00:00:00 2001 From: Nidhi Makhijani Date: Thu, 21 Apr 2016 19:07:09 +0530 Subject: [PATCH 05/17] Update README.md --- README.md | 52 +++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 005814d..150c683 100644 --- a/README.md +++ b/README.md @@ -45,38 +45,76 @@ bs_local_args['v'] = "true" ``` #### Folder Testing -To enable folder testing - +To test local folder rather internal server, provide path to folder as value of this option - ``` -bs_local_args['v'] = "true" +bs_local_args['f'] = "/my/awesome/folder" ``` #### Hosts -To specify hosts and ports for Local testing for eg. localhost,3000 - +To specify hosts and ports for Local testing - +``` +bs_local_args['hosts'] = "localhost,8080,0" +``` +To restrict local testing access to specified local servers and/or folder +``` +bs_local_args['only'] = "true" +``` #### Force Start To kill other running Browserstack Local instances - +``` +bs_local_args['force'] = "true" +``` #### Only Automate -To only enable local testing for automate - +To disable local testing for Live and Screenshots, and enable only Automate - +``` +bs_local_args['onlyAutomate'] = "true" +``` + +#### Force Local +To route all traffic via local(your) machine - +``` +bs_local_args['forcelocal'] = "true" +``` + ### Proxy To use a proxy for local testing - +* proxyHost: Hostname/IP of proxy, remaining proxy options are ignored if this option is absent +* proxyPort: Port for the proxy, defaults to 3128 when -proxyHost is used +* proxyUser: Username for connecting to proxy (Basic Auth Only) +* proxyPass: Password for USERNAME, will be ignored if USERNAME is empty or not specified + +``` +bs_local_args['proxyHost'] = "127.0.0.1" +bs_local_args['proxyPort'] = "true" +bs_local_args['proxyUser'] = "user" +bs_local_args['proxyPass'] = "password" + +``` ### Local Identifier If doing simultaneous multiple local testing connections, set this uniquely for different processes - +``` +bs_local_args['localIdentifier'] = "randomstring" +``` -### Hosts - -To restrict local testing access to specified local servers and/or folder ### Binary Path Path to specify local Binary path +``` +bs_local_args['binarypath'] = "/awesome/browserstack/BrowserStackLocal" +``` ### Logfile To specify the path to file where the logs will be saved - +``` +bs_local_args['logfile'] = "/awesome/browserstack/logs.txt" +``` ## Contribute From 6c08743d17e89d0214be8c9e371d83dedb4b05d1 Mon Sep 17 00:00:00 2001 From: Nidhi Makhijani Date: Thu, 21 Apr 2016 19:25:37 +0530 Subject: [PATCH 06/17] Update README.md --- README.md | 45 ++++++++++++++++++--------------------------- 1 file changed, 18 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 150c683..8ee144a 100644 --- a/README.md +++ b/README.md @@ -16,21 +16,17 @@ require 'browserstack-local' #creates an instance of Local bs_local = BrowserStack::Local.new -#arguments for Local instance -bs_local_args = {} - #replace BROWSERSTACK_ACCESS_KEY with your key. #you can also use environment variables. -bs_local_args['key'] = "BROWSERSTACK_ACCESS_KEY" +bs_local_args = { "key" => "BROWSERSTACK_ACCESS_KEY" } -#stops the Local instance with the required options +#starts the Local instance with the required arguments bs_local.start(bs_local_args) -#checks if Local instance is running -if (bs_local.isRunning) - #stop the Local instance - bs_local.stop -end +puts bs_local.isRunning + +#stop the Local instance +bs_local.stop ``` @@ -41,42 +37,43 @@ Apart from the key all other arguments are optional. To specify these arguments #### Verbose Logging To enable verbose logging - ``` -bs_local_args['v'] = "true" +bs_local_args = { "key" => "BROWSERSTACK_ACCESS_KEY" , "v" => "true"} ``` #### Folder Testing To test local folder rather internal server, provide path to folder as value of this option - ``` -bs_local_args['f'] = "/my/awesome/folder" +bs_local_args = { "key" => "BROWSERSTACK_ACCESS_KEY" , "f" => "/my/awesome/folder"} ``` #### Hosts To specify hosts and ports for Local testing - ``` -bs_local_args['hosts'] = "localhost,8080,0" +bs_local_args = { "key" => "BROWSERSTACK_ACCESS_KEY" , "hosts" => "localhost,8080,0"} ``` + To restrict local testing access to specified local servers and/or folder ``` -bs_local_args['only'] = "true" +bs_local_args = { "key" => "BROWSERSTACK_ACCESS_KEY" , "only" => "true"} ``` #### Force Start To kill other running Browserstack Local instances - ``` -bs_local_args['force'] = "true" +bs_local_args = { "key" => "BROWSERSTACK_ACCESS_KEY" , "force" => "true"} ``` #### Only Automate To disable local testing for Live and Screenshots, and enable only Automate - ``` -bs_local_args['onlyAutomate'] = "true" +bs_local_args = { "key" => "BROWSERSTACK_ACCESS_KEY" , "onlyAutomate" => "true"} ``` #### Force Local To route all traffic via local(your) machine - ``` -bs_local_args['forcelocal'] = "true" +bs_local_args = { "key" => "BROWSERSTACK_ACCESS_KEY" , "forcelocal" => "true"} ``` @@ -89,31 +86,25 @@ To use a proxy for local testing - * proxyPass: Password for USERNAME, will be ignored if USERNAME is empty or not specified ``` -bs_local_args['proxyHost'] = "127.0.0.1" -bs_local_args['proxyPort'] = "true" -bs_local_args['proxyUser'] = "user" -bs_local_args['proxyPass'] = "password" - +bs_local_args = { "key" => "BROWSERSTACK_ACCESS_KEY", "proxyHost" => "127.0.0.1", "proxyPort" => "8000", "proxyUser" => "user", "proxyPass" => "password"} ``` ### Local Identifier If doing simultaneous multiple local testing connections, set this uniquely for different processes - ``` -bs_local_args['localIdentifier'] = "randomstring" +bs_local_args = { "key" => "BROWSERSTACK_ACCESS_KEY" , "localIdentifier" => "randomstring"} ``` - - ### Binary Path Path to specify local Binary path ``` -bs_local_args['binarypath'] = "/awesome/browserstack/BrowserStackLocal" +bs_local_args = { "key" => "BROWSERSTACK_ACCESS_KEY" , "binarypath" => "/browserstack/BrowserStackLocal"} ``` ### Logfile To specify the path to file where the logs will be saved - ``` -bs_local_args['logfile'] = "/awesome/browserstack/logs.txt" +bs_local_args = { "key" => "BROWSERSTACK_ACCESS_KEY" , "logfile" => "/browserstack/logs.txt"} ``` ## Contribute From ce324b90210958bbb059f27ebdbc6d1c8e40e755 Mon Sep 17 00:00:00 2001 From: Nidhi Makhijani Date: Thu, 21 Apr 2016 19:26:55 +0530 Subject: [PATCH 07/17] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8ee144a..5718339 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,8 @@ bs_local_args = { "key" => "BROWSERSTACK_ACCESS_KEY" } #starts the Local instance with the required arguments bs_local.start(bs_local_args) -puts bs_local.isRunning +#check if BrowserStack local instance is running +bs_local.isRunning #stop the Local instance bs_local.stop From 31a8e765ee27dc34316377a672765fd8c8fbf270 Mon Sep 17 00:00:00 2001 From: Nidhi Makhijani Date: Thu, 21 Apr 2016 19:40:37 +0530 Subject: [PATCH 08/17] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5718339..5d1b639 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ To specify hosts and ports for Local testing - bs_local_args = { "key" => "BROWSERSTACK_ACCESS_KEY" , "hosts" => "localhost,8080,0"} ``` -To restrict local testing access to specified local servers and/or folder +To restrict local testing access to specified local servers and/or folder - ``` bs_local_args = { "key" => "BROWSERSTACK_ACCESS_KEY" , "only" => "true"} ``` @@ -97,7 +97,7 @@ bs_local_args = { "key" => "BROWSERSTACK_ACCESS_KEY" , "localIdentifier" => "ran ``` ### Binary Path -Path to specify local Binary path +Path to specify local Binary path - ``` bs_local_args = { "key" => "BROWSERSTACK_ACCESS_KEY" , "binarypath" => "/browserstack/BrowserStackLocal"} ``` From b5cc36bda6d2e8d45a53bd76e56898764d9f8307 Mon Sep 17 00:00:00 2001 From: Nidhi Makhijani Date: Thu, 21 Apr 2016 19:41:35 +0530 Subject: [PATCH 09/17] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5d1b639..5531de5 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ bs_local.stop ## Additional Arguments -Apart from the key all other arguments are optional. To specify these arguments add them to the inout hash for the BrowserStack::Local constructor. +Apart from the key all other arguments are optional. To specify these arguments add them to the input hash for the BrowserStack::Local constructor. #### Verbose Logging To enable verbose logging - From 984307ca03019bbd210d5d29416b5c4d517d905b Mon Sep 17 00:00:00 2001 From: Nidhi Makhijani Date: Fri, 22 Apr 2016 12:01:51 +0530 Subject: [PATCH 10/17] Update README.md --- README.md | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 5531de5..11682f5 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ [![Build Status](https://travis-ci.org/browserstack/browserstack-local-ruby.svg?branch=master)](https://travis-ci.org/browserstack/browserstack-local-ruby) +A simple Ruby wrapper for BrowserStack Local Binary. + ## Installation: ``` @@ -16,9 +18,9 @@ require 'browserstack-local' #creates an instance of Local bs_local = BrowserStack::Local.new -#replace BROWSERSTACK_ACCESS_KEY with your key. -#you can also use environment variables. -bs_local_args = { "key" => "BROWSERSTACK_ACCESS_KEY" } +#replace with your key. +# you may not add it if you have 'BROWSERSTACK_ACCESS_KEY' in your environment variables. +bs_local_args = { "key" => "" } #starts the Local instance with the required arguments bs_local.start(bs_local_args) @@ -33,7 +35,7 @@ bs_local.stop ## Additional Arguments -Apart from the key all other arguments are optional. To specify these arguments add them to the input hash for the BrowserStack::Local constructor. +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 - #### Verbose Logging To enable verbose logging - @@ -47,18 +49,6 @@ To test local folder rather internal server, provide path to folder as value of bs_local_args = { "key" => "BROWSERSTACK_ACCESS_KEY" , "f" => "/my/awesome/folder"} ``` -#### Hosts -To specify hosts and ports for Local testing - -``` -bs_local_args = { "key" => "BROWSERSTACK_ACCESS_KEY" , "hosts" => "localhost,8080,0"} -``` - -To restrict local testing access to specified local servers and/or folder - -``` -bs_local_args = { "key" => "BROWSERSTACK_ACCESS_KEY" , "only" => "true"} -``` - - #### Force Start To kill other running Browserstack Local instances - ``` @@ -77,7 +67,6 @@ To route all traffic via local(your) machine - bs_local_args = { "key" => "BROWSERSTACK_ACCESS_KEY" , "forcelocal" => "true"} ``` - ### Proxy To use a proxy for local testing - From da180a324cd95e5277198b92d212c5404075eddc Mon Sep 17 00:00:00 2001 From: Nidhi Makhijani Date: Fri, 22 Apr 2016 13:45:41 +0530 Subject: [PATCH 11/17] consitent arguments --- README.md | 22 +++++++++++----------- lib/browserstack/local.rb | 32 ++++++++++++++++---------------- test/browserstack-local-test.rb | 26 +++++++++++++------------- 3 files changed, 40 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index 11682f5..25acddc 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ require 'browserstack-local' bs_local = BrowserStack::Local.new #replace with your key. -# you may not add it if you have 'BROWSERSTACK_ACCESS_KEY' in your environment variables. +# you may not add it if you have '' in your environment variables. bs_local_args = { "key" => "" } #starts the Local instance with the required arguments @@ -35,36 +35,36 @@ bs_local.stop ## Additional Arguments -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 - +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). For examples, refer below - #### Verbose Logging To enable verbose logging - ``` -bs_local_args = { "key" => "BROWSERSTACK_ACCESS_KEY" , "v" => "true"} +bs_local_args = { "key" => "" , "-v" => "true"} ``` #### Folder Testing To test local folder rather internal server, provide path to folder as value of this option - ``` -bs_local_args = { "key" => "BROWSERSTACK_ACCESS_KEY" , "f" => "/my/awesome/folder"} +bs_local_args = { "key" => "" , "-f" => "/my/awesome/folder"} ``` #### Force Start To kill other running Browserstack Local instances - ``` -bs_local_args = { "key" => "BROWSERSTACK_ACCESS_KEY" , "force" => "true"} +bs_local_args = { "key" => "" , "-force" => "true"} ``` #### Only Automate To disable local testing for Live and Screenshots, and enable only Automate - ``` -bs_local_args = { "key" => "BROWSERSTACK_ACCESS_KEY" , "onlyAutomate" => "true"} +bs_local_args = { "key" => "" , "-onlyAutomate" => "true"} ``` #### Force Local To route all traffic via local(your) machine - ``` -bs_local_args = { "key" => "BROWSERSTACK_ACCESS_KEY" , "forcelocal" => "true"} +bs_local_args = { "key" => "" , "-forcelocal" => "true"} ``` ### Proxy @@ -76,25 +76,25 @@ To use a proxy for local testing - * proxyPass: Password for USERNAME, will be ignored if USERNAME is empty or not specified ``` -bs_local_args = { "key" => "BROWSERSTACK_ACCESS_KEY", "proxyHost" => "127.0.0.1", "proxyPort" => "8000", "proxyUser" => "user", "proxyPass" => "password"} +bs_local_args = { "key" => "", "-proxyHost" => "127.0.0.1", "-proxyPort" => "8000", "-proxyUser" => "user", "-proxyPass" => "password"} ``` ### Local Identifier If doing simultaneous multiple local testing connections, set this uniquely for different processes - ``` -bs_local_args = { "key" => "BROWSERSTACK_ACCESS_KEY" , "localIdentifier" => "randomstring"} +bs_local_args = { "key" => "" , "-localIdentifier" => "randomstring"} ``` ### Binary Path Path to specify local Binary path - ``` -bs_local_args = { "key" => "BROWSERSTACK_ACCESS_KEY" , "binarypath" => "/browserstack/BrowserStackLocal"} +bs_local_args = { "key" => "" , "-binarypath" => "/browserstack/BrowserStackLocal"} ``` ### Logfile To specify the path to file where the logs will be saved - ``` -bs_local_args = { "key" => "BROWSERSTACK_ACCESS_KEY" , "logfile" => "/browserstack/logs.txt"} +bs_local_args = { "key" => "" , "-logfile" => "/browserstack/logs.txt"} ``` ## Contribute diff --git a/lib/browserstack/local.rb b/lib/browserstack/local.rb index 41f581a..9b3b9e3 100644 --- a/lib/browserstack/local.rb +++ b/lib/browserstack/local.rb @@ -14,38 +14,38 @@ def initialize(key = ENV["BROWSERSTACK_ACCESS_KEY"]) end def add_args(key, value=nil) - if key == "key" + if key == "-key" @key = value - elsif key == "v" && value.to_s != "false" + elsif key == "-v" && value.to_s != "false" @verbose_flag = "-vvv" - elsif key == "force" && value.to_s != "false" + elsif key == "-force" && value.to_s != "false" @force_flag = "-force" - elsif key == "only" && value.to_s != "false" + elsif key == "-only" && value.to_s != "false" @only_flag = "-only" - elsif key == "onlyAutomate" && value.to_s != "false" + elsif key == "-onlyAutomate" && value.to_s != "false" @only_automate_flag = "-onlyAutomate" - elsif key == "forcelocal" && value.to_s != "false" + elsif key == "-forcelocal" && value.to_s != "false" @force_local_flag = "-forcelocal" - elsif key == "localIdentifier" + elsif key == "-localIdentifier" @local_identifier_flag = "-localIdentifier '#{value}'" - elsif key == "f" + elsif key == "-f" @folder_flag = "-f" @folder_path = "'#{value}'" - elsif key == "proxyHost" + elsif key == "-proxyHost" @proxy_host = "-proxyHost '#{value}'" - elsif key == "proxyPort" + elsif key == "-proxyPort" @proxy_port = "-proxyPort #{value}" - elsif key == "proxyUser" + elsif key == "-proxyUser" @proxy_user = "-proxyUser '#{value}'" - elsif key == "proxyPass" + elsif key == "-proxyPass" @proxy_pass = "-proxyPass '#{value}'" - elsif key == "hosts" + elsif key == "-hosts" @hosts = value - elsif key == "logfile" + elsif key == "-logfile" @logfile = value - elsif key == "binarypath" + elsif key == "-binarypath" @binary_path = value - elsif key == "forceproxy" && value.to_s != "false" + elsif key == "-forceproxy" && value.to_s != "false" @force_proxy_flag = "-forceproxy" end end diff --git a/test/browserstack-local-test.rb b/test/browserstack-local-test.rb index b24e03a..86bd3bc 100644 --- a/test/browserstack-local-test.rb +++ b/test/browserstack-local-test.rb @@ -29,56 +29,56 @@ def test_multiple_binary end def test_enable_verbose - @bs_local.add_args('v') + @bs_local.add_args('-v') assert_match /\-v/, @bs_local.command end def test_set_folder - @bs_local.add_args 'f', "/" + @bs_local.add_args '-f', "/" assert_match /\-f/, @bs_local.command assert_match /\'\/\'/, @bs_local.command end def test_enable_force - @bs_local.add_args "force" + @bs_local.add_args "-force" assert_match /\-force/, @bs_local.command end def test_enable_only - @bs_local.add_args "only" + @bs_local.add_args "-only" assert_match /\-only/, @bs_local.command end def test_enable_only_automate - @bs_local.add_args "onlyAutomate" + @bs_local.add_args "-onlyAutomate" assert_match /\-onlyAutomate/, @bs_local.command end def test_enable_force_local - @bs_local.add_args "forcelocal" + @bs_local.add_args "-forcelocal" assert_match /\-forcelocal/, @bs_local.command end def test_set_local_identifier - @bs_local.add_args "localIdentifier", "randomString" + @bs_local.add_args "-localIdentifier", "randomString" assert_match /\-localIdentifier \'randomString\'/, @bs_local.command end def test_set_proxy - @bs_local.add_args "proxyHost", "localhost" - @bs_local.add_args "proxyPort", 8080 - @bs_local.add_args "proxyUser", "user" - @bs_local.add_args "proxyPass", "pass" + @bs_local.add_args "-proxyHost", "localhost" + @bs_local.add_args "-proxyPort", 8080 + @bs_local.add_args "-proxyUser", "user" + @bs_local.add_args "-proxyPass", "pass" assert_match /\-proxyHost \'localhost\' \-proxyPort 8080 \-proxyUser \'user\' \-proxyPass \'pass\'/, @bs_local.command end def test_force_proxy - @bs_local.add_args "forceproxy" + @bs_local.add_args "-forceproxy" assert_match /\-forceproxy/, @bs_local.command end def test_hosts - @bs_local.add_args "hosts", "localhost,8080,0" + @bs_local.add_args "-hosts", "localhost,8080,0" assert_match /localhost\,8080\,0/, @bs_local.command end From 29eab089c6802e2ca189599a1bac0a3d1e2f3978 Mon Sep 17 00:00:00 2001 From: Nidhi Makhijani Date: Fri, 22 Apr 2016 13:55:13 +0530 Subject: [PATCH 12/17] logfile not required --- test/browserstack-local-test.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/browserstack-local-test.rb b/test/browserstack-local-test.rb index 86bd3bc..c24780c 100644 --- a/test/browserstack-local-test.rb +++ b/test/browserstack-local-test.rb @@ -21,11 +21,9 @@ def test_is_running def test_multiple_binary @bs_local.start bs_local_2 = BrowserStack::Local.new - second_log_file = File.join(Dir.pwd, 'local2.log') assert_raises BrowserStack::LocalException do - bs_local_2.start({'logfile' => second_log_file}) + bs_local_2.start end - File.delete(second_log_file) end def test_enable_verbose From 6b96fc423bfd3c11c568b199e4816435e95b208d Mon Sep 17 00:00:00 2001 From: Nidhi Makhijani Date: Fri, 22 Apr 2016 14:02:47 +0530 Subject: [PATCH 13/17] Update README.md --- README.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 25acddc..95f7115 100644 --- a/README.md +++ b/README.md @@ -20,13 +20,13 @@ bs_local = BrowserStack::Local.new #replace with your key. # you may not add it if you have '' in your environment variables. -bs_local_args = { "key" => "" } +bs_local_args = { "-key" => "" } #starts the Local instance with the required arguments bs_local.start(bs_local_args) #check if BrowserStack local instance is running -bs_local.isRunning +puts bs_local.isRunning #stop the Local instance bs_local.stop @@ -40,31 +40,31 @@ Apart from the key all other arguments are optional. For the full list of argume #### Verbose Logging To enable verbose logging - ``` -bs_local_args = { "key" => "" , "-v" => "true"} +bs_local_args = { "-key" => "" , "-v" => "true"} ``` #### Folder Testing To test local folder rather internal server, provide path to folder as value of this option - ``` -bs_local_args = { "key" => "" , "-f" => "/my/awesome/folder"} +bs_local_args = { "-key" => "" , "-f" => "/my/awesome/folder"} ``` #### Force Start To kill other running Browserstack Local instances - ``` -bs_local_args = { "key" => "" , "-force" => "true"} +bs_local_args = { "-key" => "" , "-force" => "true"} ``` #### Only Automate To disable local testing for Live and Screenshots, and enable only Automate - ``` -bs_local_args = { "key" => "" , "-onlyAutomate" => "true"} +bs_local_args = { "-key" => "" , "-onlyAutomate" => "true"} ``` #### Force Local To route all traffic via local(your) machine - ``` -bs_local_args = { "key" => "" , "-forcelocal" => "true"} +bs_local_args = { "-key" => "" , "-forcelocal" => "true"} ``` ### Proxy @@ -76,25 +76,25 @@ To use a proxy for local testing - * proxyPass: Password for USERNAME, will be ignored if USERNAME is empty or not specified ``` -bs_local_args = { "key" => "", "-proxyHost" => "127.0.0.1", "-proxyPort" => "8000", "-proxyUser" => "user", "-proxyPass" => "password"} +bs_local_args = { "-key" => "", "-proxyHost" => "127.0.0.1", "-proxyPort" => "8000", "-proxyUser" => "user", "-proxyPass" => "password"} ``` ### Local Identifier If doing simultaneous multiple local testing connections, set this uniquely for different processes - ``` -bs_local_args = { "key" => "" , "-localIdentifier" => "randomstring"} +bs_local_args = { "-key" => "" , "-localIdentifier" => "randomstring"} ``` ### Binary Path Path to specify local Binary path - ``` -bs_local_args = { "key" => "" , "-binarypath" => "/browserstack/BrowserStackLocal"} +bs_local_args = { "-key" => "" , "-binarypath" => "/browserstack/BrowserStackLocal"} ``` ### Logfile To specify the path to file where the logs will be saved - ``` -bs_local_args = { "key" => "" , "-logfile" => "/browserstack/logs.txt"} +bs_local_args = { "-key" => "" , "-logfile" => "/browserstack/logs.txt"} ``` ## Contribute From 9fabf99c131ea02b5393e40d2d92763c0c8f5483 Mon Sep 17 00:00:00 2001 From: Nidhi Makhijani Date: Fri, 22 Apr 2016 16:37:53 +0530 Subject: [PATCH 14/17] Update README.md --- README.md | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 95f7115..3eff292 100644 --- a/README.md +++ b/README.md @@ -18,8 +18,7 @@ require 'browserstack-local' #creates an instance of Local bs_local = BrowserStack::Local.new -#replace with your key. -# you may not add it if you have '' in your environment variables. +#replace with your key. You can also set it in your environment variables - "BROWSERSTACK_ACCESS_KEY". bs_local_args = { "-key" => "" } #starts the Local instance with the required arguments @@ -33,9 +32,9 @@ bs_local.stop ``` -## Additional Arguments +## Arguments -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). For examples, refer below - +Apart from the key all other BrowserStack Local modifiers are optional. For the full list of modifiers, refer [BrowserStack Local modifiers](https://www.browserstack.com/local-testing#modifiers). For examples, refer below - #### Verbose Logging To enable verbose logging - @@ -67,7 +66,7 @@ To route all traffic via local(your) machine - bs_local_args = { "-key" => "" , "-forcelocal" => "true"} ``` -### Proxy +#### Proxy To use a proxy for local testing - * proxyHost: Hostname/IP of proxy, remaining proxy options are ignored if this option is absent @@ -79,19 +78,26 @@ To use a proxy for local testing - bs_local_args = { "-key" => "", "-proxyHost" => "127.0.0.1", "-proxyPort" => "8000", "-proxyUser" => "user", "-proxyPass" => "password"} ``` -### Local Identifier +#### Local Identifier If doing simultaneous multiple local testing connections, set this uniquely for different processes - ``` bs_local_args = { "-key" => "" , "-localIdentifier" => "randomstring"} ``` -### Binary Path +### Additional Arguments for BrowserStack Local wrappers + +Additional arguments that are enabled only for BrowserStack wrappers and not in BrowserStack Local binary. + +#### Binary Path + +By default, BrowserStack local wrappers try downlaoding and executing the latest version of BrowserStack binary in ~/.browserstack or the present working directory or the tmp folder by order. But you can override these by passing the -binarypath argument. Path to specify local Binary path - ``` bs_local_args = { "-key" => "" , "-binarypath" => "/browserstack/BrowserStackLocal"} ``` -### Logfile +#### Logfile +To save the logs to the file while running with the '-v' argument, you can specify the path of the file. By default the logs are saved in the local.log file in the present woring directory. To specify the path to file where the logs will be saved - ``` bs_local_args = { "-key" => "" , "-logfile" => "/browserstack/logs.txt"} From e0d71c2fa707da8e055c7a2116f19a0c84a0a050 Mon Sep 17 00:00:00 2001 From: Nidhi Makhijani Date: Fri, 22 Apr 2016 16:54:14 +0530 Subject: [PATCH 15/17] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3eff292..9987361 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ If doing simultaneous multiple local testing connections, set this uniquely for bs_local_args = { "-key" => "" , "-localIdentifier" => "randomstring"} ``` -### Additional Arguments for BrowserStack Local wrappers +## Additional Arguments for BrowserStack Local wrappers Additional arguments that are enabled only for BrowserStack wrappers and not in BrowserStack Local binary. From fc9a60650d0e579265700c510525427995efb666 Mon Sep 17 00:00:00 2001 From: Nidhi Makhijani Date: Tue, 26 Apr 2016 12:18:55 +0530 Subject: [PATCH 16/17] Update README.md --- README.md | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 9987361..c45e148 100644 --- a/README.md +++ b/README.md @@ -4,13 +4,13 @@ A simple Ruby wrapper for BrowserStack Local Binary. -## Installation: +## Installation ``` gem install browserstack-local ``` -## Example: +## Example ``` require 'browserstack-local' @@ -34,7 +34,7 @@ bs_local.stop ## Arguments -Apart from the key all other BrowserStack Local modifiers are optional. For the full list of modifiers, refer [BrowserStack Local modifiers](https://www.browserstack.com/local-testing#modifiers). For examples, refer below - +Apart from the key, all other BrowserStack Local modifiers are optional. For the full list of modifiers, refer [BrowserStack Local modifiers](https://www.browserstack.com/local-testing#modifiers). For examples, refer below - #### Verbose Logging To enable verbose logging - @@ -84,13 +84,11 @@ If doing simultaneous multiple local testing connections, set this uniquely for bs_local_args = { "-key" => "" , "-localIdentifier" => "randomstring"} ``` -## Additional Arguments for BrowserStack Local wrappers - -Additional arguments that are enabled only for BrowserStack wrappers and not in BrowserStack Local binary. +## Additional Arguments #### Binary Path -By default, BrowserStack local wrappers try downlaoding and executing the latest version of BrowserStack binary in ~/.browserstack or the present working directory or the tmp folder by order. But you can override these by passing the -binarypath argument. +By default, BrowserStack local wrappers try downloading and executing the latest version of BrowserStack binary in ~/.browserstack or the present working directory or the tmp folder by order. But you can override these by passing the -binarypath argument. Path to specify local Binary path - ``` bs_local_args = { "-key" => "" , "-binarypath" => "/browserstack/BrowserStackLocal"} @@ -100,7 +98,7 @@ bs_local_args = { "-key" => "" , "-binarypath" => "/brow To save the logs to the file while running with the '-v' argument, you can specify the path of the file. By default the logs are saved in the local.log file in the present woring directory. To specify the path to file where the logs will be saved - ``` -bs_local_args = { "-key" => "" , "-logfile" => "/browserstack/logs.txt"} +bs_local_args = { "-key" => "" , "-v" => "true", "-logfile" => "/browserstack/logs.txt"} ``` ## Contribute @@ -121,8 +119,8 @@ When submitting an issue please describe the issue clearly, including how to rep ### Pull Requests -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. +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. * Adhere to the coding conventions you see in the surrounding code. * Include tests, and make sure all tests pass. -* 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. +* Before submitting a pull-request, clean up the git 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. From f3a5d5cddcf9b6a28a658dfd3c416010464bae50 Mon Sep 17 00:00:00 2001 From: Nidhi Makhijani Date: Tue, 26 Apr 2016 12:20:38 +0530 Subject: [PATCH 17/17] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c45e148..f562b31 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ require 'browserstack-local' #creates an instance of Local bs_local = BrowserStack::Local.new -#replace with your key. You can also set it in your environment variables - "BROWSERSTACK_ACCESS_KEY". +#replace with your key. You can also set an environment variable - "BROWSERSTACK_ACCESS_KEY". bs_local_args = { "-key" => "" } #starts the Local instance with the required arguments