From d067e595228bcc68b9845a8ebb0f59b472391e12 Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Wed, 26 Aug 2020 03:43:35 +0530 Subject: [PATCH 01/24] Updating First test for Android and iOS --- android/{single_test.rb => first_test.rb} | 29 ++++++++++++++++------- ios/{single_test.rb => first_test.rb} | 24 ++++++++++++++++++- 2 files changed, 43 insertions(+), 10 deletions(-) rename android/{single_test.rb => first_test.rb} (52%) rename ios/{single_test.rb => first_test.rb} (59%) diff --git a/android/single_test.rb b/android/first_test.rb similarity index 52% rename from android/single_test.rb rename to android/first_test.rb index 9440c1b..2e6e8a8 100644 --- a/android/single_test.rb +++ b/android/first_test.rb @@ -2,24 +2,34 @@ require 'appium_lib' require 'selenium-webdriver' -username = 'BROWSERSTACK_USERNAME' -access_key = 'BROWSERSTACK_ACCESS_KEY' - caps = {} -caps['build'] = 'Ruby Appium Sample' +# Set your access credentials +caps['browserstack.user'] = 'YOUR_USERNAME' +caps['browserstack.key'] = 'YOUR_ACCESS_KEY' + +# Set URL of the application under test +caps['app'] = 'bs://' + +# Specify device and os_version for testing +caps['device'] = 'Google Pixel 3' +caps['os_version'] = '9.0' + +# Set other BrowserStack capabilities +caps['project'] = 'First Ruby project' +caps['build'] = 'Ruby Android' caps['name'] = 'single_test' -caps['device'] = 'Google Pixel' -caps['platformName'] = 'android' -caps['browserstack.debug'] = true -caps['app'] = 'bs://' +# Initialize the remote Webdriver using BrowserStack remote URL +# and desired capabilities defined above appium_driver = Appium::Driver.new({ 'caps' => caps, 'appium_lib' => { - :server_url => "http://#{username}:#{access_key}@hub-cloud.browserstack.com/wd/hub" + :server_url => "http://hub-cloud.browserstack.com/wd/hub" }}, true) driver = appium_driver.start_driver +# Test case for the BrowserStack sample Android app. +# If you have uploaded your app, update the test case here. wait = Selenium::WebDriver::Wait.new(:timeout => 30) wait.until { driver.find_element(:accessibility_id, "Search Wikipedia").displayed? } element = driver.find_element(:accessibility_id, "Search Wikipedia") @@ -37,4 +47,5 @@ puts "No results found - Test Failed" end +# Invoke driver.quit() after the test is done to indicate that the test is completed. driver.quit diff --git a/ios/single_test.rb b/ios/first_test.rb similarity index 59% rename from ios/single_test.rb rename to ios/first_test.rb index 0b1d409..8e09272 100644 --- a/ios/single_test.rb +++ b/ios/first_test.rb @@ -13,13 +13,34 @@ caps['browserstack.debug'] = true caps['app'] = 'bs://' +caps = {} +# Set your access credentials +caps['browserstack.user'] = 'YOUR_USERNAME' +caps['browserstack.key'] = 'YOUR_ACCESS_KEY' + +# Set URL of the application under test +caps['app'] = 'bs://' + +# Specify device and os_version for testing +caps['device'] = "iPhone 11 Pro" +caps['os_version'] = "13" + +# Set other BrowserStack capabilities +caps['project'] = 'First Ruby project' +caps['build'] = 'Ruby iOS' +caps['name'] = 'single_test' + +# Initialize the remote Webdriver using BrowserStack remote URL +# and desired capabilities defined above appium_driver = Appium::Driver.new({ 'caps' => caps, 'appium_lib' => { - :server_url => "http://#{username}:#{access_key}@hub-cloud.browserstack.com/wd/hub" + :server_url => "http://hub-cloud.browserstack.com/wd/hub" }}, true) driver = appium_driver.start_driver +# Test case for the BrowserStack sample Android app. +# If you have uploaded your app, update the test case here. wait = Selenium::WebDriver::Wait.new(:timeout => 30) wait.until { driver.find_element(:accessibility_id, "Text Button").displayed? } textButton = driver.find_element(:accessibility_id, "Text Button") @@ -40,4 +61,5 @@ puts "Test Failed" end +# Invoke driver.quit() after the test is done to indicate that the test is completed. driver.quit \ No newline at end of file From d6dc94ee59920bea0b60ff03f8c9a6b7454c6df5 Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Wed, 26 Aug 2020 03:53:10 +0530 Subject: [PATCH 02/24] Adding 'platformName' capability --- android/first_test.rb | 3 +++ ios/first_test.rb | 14 +++----------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/android/first_test.rb b/android/first_test.rb index 2e6e8a8..67353d7 100644 --- a/android/first_test.rb +++ b/android/first_test.rb @@ -19,6 +19,9 @@ caps['build'] = 'Ruby Android' caps['name'] = 'single_test' +#Set the platform name +caps['platformName'] = 'android' + # Initialize the remote Webdriver using BrowserStack remote URL # and desired capabilities defined above appium_driver = Appium::Driver.new({ diff --git a/ios/first_test.rb b/ios/first_test.rb index 8e09272..4862efe 100644 --- a/ios/first_test.rb +++ b/ios/first_test.rb @@ -2,17 +2,6 @@ require 'appium_lib' require 'selenium-webdriver' -username = 'BROWSERSTACK_USERNAME' -access_key = 'BROWSERSTACK_ACCESS_KEY' - -caps = {} -caps['build'] = 'Ruby Appium Sample' -caps['name'] = 'single_test' -caps['device'] = 'iPhone 7 Plus' -caps['platformName'] = 'iOS' -caps['browserstack.debug'] = true -caps['app'] = 'bs://' - caps = {} # Set your access credentials caps['browserstack.user'] = 'YOUR_USERNAME' @@ -30,6 +19,9 @@ caps['build'] = 'Ruby iOS' caps['name'] = 'single_test' +#Set the platform name +caps['platformName'] = 'iOS' + # Initialize the remote Webdriver using BrowserStack remote URL # and desired capabilities defined above appium_driver = Appium::Driver.new({ From 9bb2285da4073b92dc4586486b20f4eb0371ebb3 Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Wed, 26 Aug 2020 04:11:45 +0530 Subject: [PATCH 03/24] Adding Ruby bundler and updating Readme --- Gemfile | 2 ++ Gemfile.lock | 36 ++++++++++++++++++++++++++ README.md | 72 +++++++++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 106 insertions(+), 4 deletions(-) create mode 100644 Gemfile create mode 100644 Gemfile.lock diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..b4971b3 --- /dev/null +++ b/Gemfile @@ -0,0 +1,2 @@ +gem 'appium_lib' +gem 'browserstack-local' \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..8ddff1d --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,36 @@ +GEM + specs: + appium_lib (10.6.0) + appium_lib_core (~> 3.3) + nokogiri (~> 1.8, >= 1.8.1) + tomlrb (~> 1.1) + appium_lib_core (3.10.1) + faye-websocket (~> 0.10.0) + selenium-webdriver (~> 3.14, >= 3.14.1) + browserstack-local (1.3.0) + childprocess (3.0.0) + eventmachine (1.2.7) + faye-websocket (0.10.9) + eventmachine (>= 0.12.0) + websocket-driver (>= 0.5.1) + mini_portile2 (2.4.0) + nokogiri (1.10.10) + mini_portile2 (~> 2.4.0) + rubyzip (2.3.0) + selenium-webdriver (3.142.7) + childprocess (>= 0.5, < 4.0) + rubyzip (>= 1.2.2) + tomlrb (1.3.0) + websocket-driver (0.7.3) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + +PLATFORMS + ruby + +DEPENDENCIES + appium_lib + browserstack-local + +BUNDLED WITH + 2.1.4 diff --git a/README.md b/README.md index 04c006d..e61258c 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,73 @@ # ruby-appium-app-browserstack -App Automate Ruby Samples ---------------------- -This repository contains code for Automated Native App tests. Please feel free to clone the repo and use the example code. +This repository demonstrates how to run Appium Ruby tests on BrowserStack App Automate. -For frameworks integration with BrowserStack, refer to their individual repositories - +## Setup + +### Requirements + +1. Ruby + + - If not installed, install Ruby from [here](https://www.ruby-lang.org/en/documentation/installation/) + +2. Dependency Manager `bundler` + + - If not installed, run command `gem install bundler` + +### Install the dependencies + +To install the dependencies, run the following commands : + +```ruby +bundle install +``` + +## Getting Started + +Getting Started with Appium tests in Ruby on BrowserStack couldn't be easier! + +### Upoad your Android or iOS App + +Upload your Android app (.apk or .aab file) or iOS app (.ipa file) to BrowserStack servers using our REST API. Here is an example cURL request : + +``` +curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \ +-X POST "https://api-cloud.browserstack.com/app-automate/upload" \ +-F "file=@/path/to/apk/file" +``` + +Ensure that @ symbol is prepended to the file path in the above request. Please note the `app_url` value returned in the API response. We will use this to set the application under test while configuring the test later on. + +**Note**: If you do not have an .apk or .ipa file and are looking to simply try App Automate, you can download and test using our [sample Android app](https://www.browserstack.com/app-automate/sample-apps/android/WikipediaSample.apk) or [sample iOS app](https://www.browserstack.com/app-automate/sample-apps/ios/BStackSampleApp.ipa). + +### **Run first test :** + +Open `first_test.rb` file for Android for ios folder + +- Replace `YOUR_USERNAME` & `YOUR_ACCESS_KEY` with your BrowserStack access credentials + +- Replace `bs://` wkth the URL obtained from app upload step + +- Set the device and OS version + +- If you have uploaded your own app update the test case + +- Run `ruby first_test.rb` + +For more details, refer to our documentation - [Get Started with your first test on App Automate](https://www.browserstack.com/docs/app-automate/appium/getting-started/ruby) + +### **Use Local testing for apps that access resources hosted in development or testing environments :** + +Refer to our documentation - [Get Started with Local testing on App Automate](https://www.browserstack.com/docs/app-automate/appium/getting-started/ruby/local-testing) + +## Integration with other frameworks + +For other Ruby frameworks samples, refer to following repositories : - [Cucumber](https://github.com/browserstack/cucumber-ruby-appium-app-browserstack) + +Note: For other test frameworks supported by App-Automate refer our [Developer documentation](https://www.browserstack.com/docs/) + +## Getting Help + +If you are running into any issues or have any queries, please check [Browserstack Support page](https://www.browserstack.com/support/app-automate) or [get in touch with us](https://www.browserstack.com/contact?ref=help). From 8ca501c4502660fa4825936c83a24183d7b80103 Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Wed, 26 Aug 2020 04:12:51 +0530 Subject: [PATCH 04/24] Updating gemfile --- Gemfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Gemfile b/Gemfile index b4971b3..55bfc94 100644 --- a/Gemfile +++ b/Gemfile @@ -1,2 +1,4 @@ +source 'http://rubygems.org' + gem 'appium_lib' gem 'browserstack-local' \ No newline at end of file From 17e62f85f104f489decc34a122f611c82adaafdf Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Wed, 26 Aug 2020 17:30:59 +0530 Subject: [PATCH 05/24] Updating test class names --- README.md | 4 ++-- android/{first_test.rb => browserstack_sample_android.rb} | 0 ios/{first_test.rb => browserstack_sample_iOS.rb} | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename android/{first_test.rb => browserstack_sample_android.rb} (100%) rename ios/{first_test.rb => browserstack_sample_iOS.rb} (100%) diff --git a/README.md b/README.md index e61258c..dc335fa 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ Ensure that @ symbol is prepended to the file path in the above request. Please ### **Run first test :** -Open `first_test.rb` file for Android for ios folder +Open `browserstack_sample_android.rb` file for Android folder or `browserstack_sample_iOS.rb` ios folder - Replace `YOUR_USERNAME` & `YOUR_ACCESS_KEY` with your BrowserStack access credentials @@ -52,7 +52,7 @@ Open `first_test.rb` file for Android for ios folder - If you have uploaded your own app update the test case -- Run `ruby first_test.rb` +- Run `ruby browserstack_sample_android.rb` or `ruby browserstack_sample_iOS.rb` For more details, refer to our documentation - [Get Started with your first test on App Automate](https://www.browserstack.com/docs/app-automate/appium/getting-started/ruby) diff --git a/android/first_test.rb b/android/browserstack_sample_android.rb similarity index 100% rename from android/first_test.rb rename to android/browserstack_sample_android.rb diff --git a/ios/first_test.rb b/ios/browserstack_sample_iOS.rb similarity index 100% rename from ios/first_test.rb rename to ios/browserstack_sample_iOS.rb From 06919c6ff1d93cd91764a0c60adda6a08f35b34d Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Wed, 26 Aug 2020 17:51:09 +0530 Subject: [PATCH 06/24] Removing unwanted Readmes --- README.md | 2 +- android/README.md | 28 ---------------------------- ios/README.md | 28 ---------------------------- 3 files changed, 1 insertion(+), 57 deletions(-) delete mode 100644 android/README.md delete mode 100644 ios/README.md diff --git a/README.md b/README.md index dc335fa..f1f6a9f 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ This repository demonstrates how to run Appium Ruby tests on BrowserStack App Au ### Install the dependencies -To install the dependencies, run the following commands : +To install the dependencies, run the following command in the base directory : ```ruby bundle install diff --git a/android/README.md b/android/README.md deleted file mode 100644 index 2af07eb..0000000 --- a/android/README.md +++ /dev/null @@ -1,28 +0,0 @@ -## Android - -## Prerequisites -- Install the appium_lib gem
-`gem install 'appium_lib'` -- Install the local bindings gem (if you need to run local tests)
-`gem install 'browserstack-local'` - -## Running your tests -- Do remember to switch the USERNAME and ACCESS_KEY with your own browserstack credentials. -- Upload your Native App (.apk file) to BrowserStack servers using upload API: - - ``` - curl -u "username:accesskey" -X POST "https://api.browserstack.com/app-automate/upload" -F "file=@/path/to/app/file/Application-debug.apk" - ``` - -- If you do not have an .apk file and looking to simply try App Automate, you can download our [sample app](https://www.browserstack.com/app-automate/sample-apps/android/WikipediaSample.apk) -and upload to the BrowserStack servers using the above API. -- For running local tests, you can use our [local sample app](https://www.browserstack.com/app-automate/sample-apps/android/LocalSample.apk). -- Update the desired capability "app" with the App URL returned from the above API call - -## Notes -* You can view your test results on the [BrowserStack App Automate dashboard](https://www.browserstack.com/app-automate) -* Refer [Get Started](https://www.browserstack.com/app-automate/appium-ruby) document to configure the capabilities - -For frameworks integration with BrowserStack, refer to their individual repositories - - -- [Cucumber](https://github.com/browserstack/cucumber-ruby-appium-app-browserstack) diff --git a/ios/README.md b/ios/README.md deleted file mode 100644 index 7626bac..0000000 --- a/ios/README.md +++ /dev/null @@ -1,28 +0,0 @@ -## iOS - -## Prerequisites -- Install the appium_lib gem
-`gem install 'appium_lib'` -- Install the local bindings gem (if you need to run local tests)
-`gem install 'browserstack-local'` - -## Running your tests -- Do remember to switch the USERNAME and ACCESS_KEY with your own browserstack credentials. -- Upload your Native App (.ipa file) to BrowserStack servers using upload API: - - ``` - curl -u "username:accesskey" -X POST "https://api.browserstack.com/app-automate/upload" -F "file=@/path/to/app/file/Application-debug.ipa" - ``` - -- If you do not have an .ipa file and looking to simply try App Automate, you can download our [sample app](https://www.browserstack.com/app-automate/sample-apps/ios/BStackSampleApp.ipa) -and upload to the BrowserStack servers using the above API. -- For running local tests, you can use our [local sample app](https://www.browserstack.com/app-automate/sample-apps/ios/LocalSample.ipa). -- Update the desired capability "app" with the App URL returned from the above API call - -## Notes -* You can view your test results on the [BrowserStack App Automate dashboard](https://www.browserstack.com/app-automate) -* Refer [Get Started](https://www.browserstack.com/app-automate/appium-ruby) document to configure the capabilities - -For frameworks integration with BrowserStack, refer to their individual repositories - - -- [Cucumber](https://github.com/browserstack/cucumber-ruby-appium-app-browserstack) From 90c24ba20e79735601952a9888d559d76c50faf8 Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Wed, 26 Aug 2020 18:24:38 +0530 Subject: [PATCH 07/24] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f1f6a9f..f8b4afc 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ Ensure that @ symbol is prepended to the file path in the above request. Please ### **Run first test :** -Open `browserstack_sample_android.rb` file for Android folder or `browserstack_sample_iOS.rb` ios folder +Open `browserstack_sample_android.rb` file for Android or `browserstack_sample_iOS.rb` for ios - Replace `YOUR_USERNAME` & `YOUR_ACCESS_KEY` with your BrowserStack access credentials From 783d1d407149b80596fae08019eb55a442e4afaa Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Mon, 31 Aug 2020 18:24:37 +0530 Subject: [PATCH 08/24] Adding specific versions for dependencies. Updated Readme --- Gemfile | 4 ++-- Gemfile.lock | 5 +++-- README.md | 4 +++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index 55bfc94..6d4947a 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,4 @@ source 'http://rubygems.org' -gem 'appium_lib' -gem 'browserstack-local' \ No newline at end of file +gem 'appium_lib', ">=10.5.0" +gem 'browserstack-local', ">=1.3.0" \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index 8ddff1d..d8d14b4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,4 +1,5 @@ GEM + remote: http://rubygems.org/ specs: appium_lib (10.6.0) appium_lib_core (~> 3.3) @@ -29,8 +30,8 @@ PLATFORMS ruby DEPENDENCIES - appium_lib - browserstack-local + appium_lib (>= 10.5.0) + browserstack-local (>= 1.3.0) BUNDLED WITH 2.1.4 diff --git a/README.md b/README.md index f8b4afc..4b2c416 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ This repository demonstrates how to run Appium Ruby tests on BrowserStack App Au ### Requirements -1. Ruby +1. Ruby 2.2+ - If not installed, install Ruby from [here](https://www.ruby-lang.org/en/documentation/installation/) @@ -54,6 +54,8 @@ Open `browserstack_sample_android.rb` file for Android or `browserstack_sample_i - Run `ruby browserstack_sample_android.rb` or `ruby browserstack_sample_iOS.rb` +- You can access the test execution results, and debugging information such as video recording, network logs on [App Automate dashboard](https://app-automate.browserstack.com/dashboard) + For more details, refer to our documentation - [Get Started with your first test on App Automate](https://www.browserstack.com/docs/app-automate/appium/getting-started/ruby) ### **Use Local testing for apps that access resources hosted in development or testing environments :** From 7d839de4ad3a0d1f10ccb8a7b3f2ed1bc4dac5af Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Tue, 1 Sep 2020 19:24:40 +0530 Subject: [PATCH 09/24] Typo fixes --- README.md | 2 +- ios/browserstack_sample_iOS.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4b2c416..d962e1d 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ This repository demonstrates how to run Appium Ruby tests on BrowserStack App Au ### Install the dependencies -To install the dependencies, run the following command in the base directory : +To install the dependencies, run the following command in the project's base directory : ```ruby bundle install diff --git a/ios/browserstack_sample_iOS.rb b/ios/browserstack_sample_iOS.rb index 4862efe..581df9c 100644 --- a/ios/browserstack_sample_iOS.rb +++ b/ios/browserstack_sample_iOS.rb @@ -31,7 +31,7 @@ }}, true) driver = appium_driver.start_driver -# Test case for the BrowserStack sample Android app. +# Test case for the BrowserStack sample iOS app. # If you have uploaded your app, update the test case here. wait = Selenium::WebDriver::Wait.new(:timeout => 30) wait.until { driver.find_element(:accessibility_id, "Text Button").displayed? } From 176afd63a725f66853b0b6251d41a5d547704cf7 Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Fri, 25 Sep 2020 03:42:58 +0530 Subject: [PATCH 10/24] Updated local test script --- ...b => browserstack_sample_android_local.rb} | 34 +++++++++++++++---- ...st.rb => browserstack_sample_iOS_local.rb} | 33 ++++++++++++++---- 2 files changed, 53 insertions(+), 14 deletions(-) rename android/{local_test.rb => browserstack_sample_android_local.rb} (53%) rename ios/{local_test.rb => browserstack_sample_iOS_local.rb} (54%) diff --git a/android/local_test.rb b/android/browserstack_sample_android_local.rb similarity index 53% rename from android/local_test.rb rename to android/browserstack_sample_android_local.rb index 33824df..893476d 100644 --- a/android/local_test.rb +++ b/android/browserstack_sample_android_local.rb @@ -3,29 +3,47 @@ require 'selenium-webdriver' require 'browserstack/local' -username = 'BROWSERSTACK_USERNAME' -access_key = 'BROWSERSTACK_ACCESS_KEY' +username = 'YOUR_USERNAME' +access_key = 'YOUR_ACCESS_KEY' caps = {} -caps['build'] = 'Ruby Appium Sample' +# Set your access credentials +caps['browserstack.user'] = username +caps['browserstack.key'] = access_key + +# Set URL of the application under test +caps['app'] = 'bs://' + +# Specify device and os_version for testing +caps['device'] = 'Google Pixel 3' +caps['os_version'] = '9.0' + +# Set browserstack.local capability as true +caps['browserstack.local'] = true + +# Set other BrowserStack capabilities +caps['project'] = 'First Ruby project' +caps['build'] = 'Ruby Android Local' caps['name'] = 'local_test' -caps['device'] = 'Google Pixel' caps['platformName'] = 'android' -caps['browserstack.local'] = true caps['browserstack.debug'] = true -caps['app'] = 'bs://' +# Start browserstack local bs_local = BrowserStack::Local.new bs_local_args = { "key" => access_key } bs_local.start(bs_local_args) +# Initialize the remote Webdriver using BrowserStack remote URL +# and desired capabilities defined above appium_driver = Appium::Driver.new({ 'caps' => caps, 'appium_lib' => { - :server_url => "http://#{username}:#{access_key}@hub-cloud.browserstack.com/wd/hub" + :server_url => "http://hub-cloud.browserstack.com/wd/hub" }}, true) driver = appium_driver.start_driver +# Test case for the BrowserStack sample Android app. +# If you have uploaded your app, update the test case here. wait = Selenium::WebDriver::Wait.new(:timeout => 30) wait.until { driver.find_element(:id, "com.example.android.basicnetworking:id/test_action").displayed? } element = driver.find_element(:id, "com.example.android.basicnetworking:id/test_action") @@ -40,5 +58,7 @@ puts "Local Testing setup not working - Test Failed" end +# Invoke driver.quit() after the test is done to indicate that the test is completed. driver.quit +# Stop browserstack local bs_local.stop diff --git a/ios/local_test.rb b/ios/browserstack_sample_iOS_local.rb similarity index 54% rename from ios/local_test.rb rename to ios/browserstack_sample_iOS_local.rb index b8fe44b..f6ee287 100644 --- a/ios/local_test.rb +++ b/ios/browserstack_sample_iOS_local.rb @@ -3,29 +3,45 @@ require 'selenium-webdriver' require 'browserstack/local' -username = 'BROWSERSTACK_USERNAME' -access_key = 'BROWSERSTACK_ACCESS_KEY' + +username = 'YOUR_USERNAME' +access_key = 'YOUR_ACCESS_KEY' caps = {} -caps['build'] = 'Ruby Appium Sample' +# Set your access credentials +caps['browserstack.user'] = username +caps['browserstack.key'] = access_key + +# Set URL of the application under test +caps['app'] = 'bs://' + +# Specify device and os_version for testing +caps['device'] = "iPhone 11 Pro" +caps['os_version'] = "13" + +# Set other BrowserStack capabilities +caps['project'] = 'First Ruby project' +caps['build'] = 'Ruby iOS Local' caps['name'] = 'local_test' -caps['device'] = 'iPhone 7 Plus' caps['platformName'] = 'iOS' -caps['browserstack.local'] = true caps['browserstack.debug'] = true -caps['app'] = 'bs://' +# Start browserstack local bs_local = BrowserStack::Local.new bs_local_args = { "key" => access_key } bs_local.start(bs_local_args) +# Initialize the remote Webdriver using BrowserStack remote URL +# and desired capabilities defined above appium_driver = Appium::Driver.new({ 'caps' => caps, 'appium_lib' => { - :server_url => "http://#{username}:#{access_key}@hub-cloud.browserstack.com/wd/hub" + :server_url => "http://hub-cloud.browserstack.com/wd/hub" }}, true) driver = appium_driver.start_driver +# Initialize the remote Webdriver using BrowserStack remote URL +# and desired capabilities defined above wait = Selenium::WebDriver::Wait.new(:timeout => 30) wait.until { driver.find_element(:accessibility_id, "TestBrowserStackLocal").displayed? } test_button = driver.find_element(:accessibility_id, "TestBrowserStackLocal") @@ -44,5 +60,8 @@ puts "Test Failed" end +# Invoke driver.quit() after the test is done to indicate that the test is completed. driver.quit + +# Stop browserstack local bs_local.stop From d5feb83682fa5d1cfeba53537accad90e2aed802 Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Fri, 25 Sep 2020 13:34:01 +0530 Subject: [PATCH 11/24] Updated readme --- README.md | 40 +++++++++++++++++++++++----- ios/browserstack_sample_iOS_local.rb | 5 +++- 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index d962e1d..61b5578 100644 --- a/README.md +++ b/README.md @@ -26,8 +26,9 @@ bundle install Getting Started with Appium tests in Ruby on BrowserStack couldn't be easier! -### Upoad your Android or iOS App +### Run your first test : +**1. Upload your Android or iOS App** Upload your Android app (.apk or .aab file) or iOS app (.ipa file) to BrowserStack servers using our REST API. Here is an example cURL request : ``` @@ -40,8 +41,7 @@ Ensure that @ symbol is prepended to the file path in the above request. Please **Note**: If you do not have an .apk or .ipa file and are looking to simply try App Automate, you can download and test using our [sample Android app](https://www.browserstack.com/app-automate/sample-apps/android/WikipediaSample.apk) or [sample iOS app](https://www.browserstack.com/app-automate/sample-apps/ios/BStackSampleApp.ipa). -### **Run first test :** - +**2. Configure and run your first test** Open `browserstack_sample_android.rb` file for Android or `browserstack_sample_iOS.rb` for ios - Replace `YOUR_USERNAME` & `YOUR_ACCESS_KEY` with your BrowserStack access credentials @@ -56,11 +56,39 @@ Open `browserstack_sample_android.rb` file for Android or `browserstack_sample_i - You can access the test execution results, and debugging information such as video recording, network logs on [App Automate dashboard](https://app-automate.browserstack.com/dashboard) -For more details, refer to our documentation - [Get Started with your first test on App Automate](https://www.browserstack.com/docs/app-automate/appium/getting-started/ruby) +--- + +### Use Local testing for apps that access resources hosted in development or testing environments : + +**1. Upload your Android or iOS App** + +Upload your Android app (.apk or .aab file) or iOS app (.ipa file) that access resources hosted on your internal or test environments to BrowserStack servers using our REST API. Here is an example cURL request : + +``` +curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \ +-X POST "https://api-cloud.browserstack.com/app-automate/upload" \ +-F "file=@/path/to/apk/file" +``` + +Ensure that @ symbol is prepended to the file path in the above request. Please note the `app_url` value returned in the API response. We will use this to set the application under test while configuring the test later on. + +**Note**: If you do not have an .apk or .ipa file and are looking to simply try App Automate, you can download and test using our [sample Android Local app](https://www.browserstack.com/app-automate/sample-apps/android/LocalSample.apk) or [sample iOS Local app](https://www.browserstack.com/app-automate/sample-apps/ios/LocalSample.ipa). + + +**2. Configure and run your local test** +Open `browserstack_sample_android_local.rb` file for Android or `browserstack_sample_iOS_local.rb` for ios + +- Replace `YOUR_USERNAME` & `YOUR_ACCESS_KEY` with your BrowserStack access credentials + +- Replace `bs://` wkth the URL obtained from app upload step + +- Set the device and OS version -### **Use Local testing for apps that access resources hosted in development or testing environments :** +- If you have uploaded your own app update the test case + +- Run `ruby browserstack_sample_android_local.rb` or `ruby browserstack_sample_iOS_local.rb` -Refer to our documentation - [Get Started with Local testing on App Automate](https://www.browserstack.com/docs/app-automate/appium/getting-started/ruby/local-testing) +- You can access the test execution results, and debugging information such as video recording, network logs on [App Automate dashboard](https://app-automate.browserstack.com/dashboard) ## Integration with other frameworks diff --git a/ios/browserstack_sample_iOS_local.rb b/ios/browserstack_sample_iOS_local.rb index f6ee287..d0c3808 100644 --- a/ios/browserstack_sample_iOS_local.rb +++ b/ios/browserstack_sample_iOS_local.rb @@ -19,6 +19,9 @@ caps['device'] = "iPhone 11 Pro" caps['os_version'] = "13" +# Set browserstack.local capability as true +caps['browserstack.local'] = true + # Set other BrowserStack capabilities caps['project'] = 'First Ruby project' caps['build'] = 'Ruby iOS Local' @@ -54,7 +57,7 @@ result_element = driver.find_element(:accessibility_id, "ResultBrowserStackLocal") -if result_element.text.match("Up and running") +if result_element.text.match('Up and running') puts "Test Passed" else puts "Test Failed" From 8589894124a7e3abca4c26c1cfc38177c11f7432 Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Fri, 25 Sep 2020 15:00:21 +0530 Subject: [PATCH 12/24] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 61b5578..825e161 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,7 @@ Ensure that @ symbol is prepended to the file path in the above request. Please **Note**: If you do not have an .apk or .ipa file and are looking to simply try App Automate, you can download and test using our [sample Android app](https://www.browserstack.com/app-automate/sample-apps/android/WikipediaSample.apk) or [sample iOS app](https://www.browserstack.com/app-automate/sample-apps/ios/BStackSampleApp.ipa). **2. Configure and run your first test** + Open `browserstack_sample_android.rb` file for Android or `browserstack_sample_iOS.rb` for ios - Replace `YOUR_USERNAME` & `YOUR_ACCESS_KEY` with your BrowserStack access credentials @@ -76,6 +77,7 @@ Ensure that @ symbol is prepended to the file path in the above request. Please **2. Configure and run your local test** + Open `browserstack_sample_android_local.rb` file for Android or `browserstack_sample_iOS_local.rb` for ios - Replace `YOUR_USERNAME` & `YOUR_ACCESS_KEY` with your BrowserStack access credentials From a52de6253f9d8587157c72958e6746087ebf4fbf Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Fri, 25 Sep 2020 15:06:24 +0530 Subject: [PATCH 13/24] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 825e161..fa8c3cd 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ Ensure that @ symbol is prepended to the file path in the above request. Please **2. Configure and run your first test** -Open `browserstack_sample_android.rb` file for Android or `browserstack_sample_iOS.rb` for ios +Open `browserstack_sample_android.rb` file for Android or `browserstack_sample_iOS.rb` for ios : - Replace `YOUR_USERNAME` & `YOUR_ACCESS_KEY` with your BrowserStack access credentials @@ -78,7 +78,7 @@ Ensure that @ symbol is prepended to the file path in the above request. Please **2. Configure and run your local test** -Open `browserstack_sample_android_local.rb` file for Android or `browserstack_sample_iOS_local.rb` for ios +Open `browserstack_sample_android_local.rb` file for Android or `browserstack_sample_iOS_local.rb` for ios : - Replace `YOUR_USERNAME` & `YOUR_ACCESS_KEY` with your BrowserStack access credentials From 84d363dc0286c086afc27feea62d6590e80c0d5a Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Fri, 25 Sep 2020 15:22:52 +0530 Subject: [PATCH 14/24] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index fa8c3cd..f690550 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,8 @@ Open `browserstack_sample_android_local.rb` file for Android or `browserstack_sa - Set the device and OS version +- Ensure that `browserstack.local` capability is set to `true`. Within the test script, there is code snippet that automatically establishes Local Testing connection to BrowserStack servers using Ruby binding for BrowserStack Local. + - If you have uploaded your own app update the test case - Run `ruby browserstack_sample_android_local.rb` or `ruby browserstack_sample_iOS_local.rb` From a1ef075f330cf3c891e29da21163868faf0dbb36 Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Sat, 26 Sep 2020 16:08:27 +0530 Subject: [PATCH 15/24] updating file names according to QSG --- .../{browserstack_sample_android.rb => browserstack_sample.rb} | 0 ...stack_sample_android_local.rb => browserstack_sample_local.rb} | 0 ios/{browserstack_sample_iOS.rb => browserstack_sample.rb} | 0 ...wserstack_sample_iOS_local.rb => browserstack_sample_local.rb} | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename android/{browserstack_sample_android.rb => browserstack_sample.rb} (100%) rename android/{browserstack_sample_android_local.rb => browserstack_sample_local.rb} (100%) rename ios/{browserstack_sample_iOS.rb => browserstack_sample.rb} (100%) rename ios/{browserstack_sample_iOS_local.rb => browserstack_sample_local.rb} (100%) diff --git a/android/browserstack_sample_android.rb b/android/browserstack_sample.rb similarity index 100% rename from android/browserstack_sample_android.rb rename to android/browserstack_sample.rb diff --git a/android/browserstack_sample_android_local.rb b/android/browserstack_sample_local.rb similarity index 100% rename from android/browserstack_sample_android_local.rb rename to android/browserstack_sample_local.rb diff --git a/ios/browserstack_sample_iOS.rb b/ios/browserstack_sample.rb similarity index 100% rename from ios/browserstack_sample_iOS.rb rename to ios/browserstack_sample.rb diff --git a/ios/browserstack_sample_iOS_local.rb b/ios/browserstack_sample_local.rb similarity index 100% rename from ios/browserstack_sample_iOS_local.rb rename to ios/browserstack_sample_local.rb From d267bec4784877239b70205ce4fc35589aa3323a Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Sat, 26 Sep 2020 16:14:05 +0530 Subject: [PATCH 16/24] Updating Readme. --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f690550..656c5c0 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ Ensure that @ symbol is prepended to the file path in the above request. Please **2. Configure and run your first test** -Open `browserstack_sample_android.rb` file for Android or `browserstack_sample_iOS.rb` for ios : +Open `browserstack_sample.rb` file in `Android` or `iOS` directory : - Replace `YOUR_USERNAME` & `YOUR_ACCESS_KEY` with your BrowserStack access credentials @@ -53,7 +53,7 @@ Open `browserstack_sample_android.rb` file for Android or `browserstack_sample_i - If you have uploaded your own app update the test case -- Run `ruby browserstack_sample_android.rb` or `ruby browserstack_sample_iOS.rb` +- Run `ruby browserstack_sample.rb` - You can access the test execution results, and debugging information such as video recording, network logs on [App Automate dashboard](https://app-automate.browserstack.com/dashboard) @@ -78,7 +78,7 @@ Ensure that @ symbol is prepended to the file path in the above request. Please **2. Configure and run your local test** -Open `browserstack_sample_android_local.rb` file for Android or `browserstack_sample_iOS_local.rb` for ios : +Open `browserstack_sample_local.rb` file in `Android` or `iOS` directory : - Replace `YOUR_USERNAME` & `YOUR_ACCESS_KEY` with your BrowserStack access credentials @@ -90,7 +90,7 @@ Open `browserstack_sample_android_local.rb` file for Android or `browserstack_sa - If you have uploaded your own app update the test case -- Run `ruby browserstack_sample_android_local.rb` or `ruby browserstack_sample_iOS_local.rb` +- Run `ruby browserstack_sample_local.rb` - You can access the test execution results, and debugging information such as video recording, network logs on [App Automate dashboard](https://app-automate.browserstack.com/dashboard) From e868768b5dc39c46931fe3bc1d3578d20ac578e5 Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Sat, 26 Sep 2020 16:24:19 +0530 Subject: [PATCH 17/24] Updating Readme. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 656c5c0..39e089b 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ Ensure that @ symbol is prepended to the file path in the above request. Please **2. Configure and run your first test** -Open `browserstack_sample.rb` file in `Android` or `iOS` directory : +Open `browserstack_sample.rb` file in `android` or `ios` directory : - Replace `YOUR_USERNAME` & `YOUR_ACCESS_KEY` with your BrowserStack access credentials @@ -78,7 +78,7 @@ Ensure that @ symbol is prepended to the file path in the above request. Please **2. Configure and run your local test** -Open `browserstack_sample_local.rb` file in `Android` or `iOS` directory : +Open `browserstack_sample_local.rb` file in `android` or `ios` directory : - Replace `YOUR_USERNAME` & `YOUR_ACCESS_KEY` with your BrowserStack access credentials From f729424a684d8064dc3f499b301b86963e9c8e56 Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Thu, 1 Oct 2020 14:52:07 +0530 Subject: [PATCH 18/24] Adding workaround for Windows in Ruby --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 39e089b..ccef761 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,14 @@ To install the dependencies, run the following command in the project's base dir bundle install ``` +**Note**: If you are using Windows, RubyInstaller has a known [issue](https://github.com/oneclick/rubyinstaller2/issues/96). Run the following script as a workaround to resolve it - + +```ruby +gem install ffi +gem uninstall -aIx eventmachine +gem install eventmachine --platform=ruby +``` + ## Getting Started Getting Started with Appium tests in Ruby on BrowserStack couldn't be easier! From dba1f18eb998734621e11829d71d4fed8e08ae78 Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Thu, 1 Oct 2020 19:04:48 +0530 Subject: [PATCH 19/24] BrowserStack access credentials URL in readme. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ccef761..756519c 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ Ensure that @ symbol is prepended to the file path in the above request. Please Open `browserstack_sample.rb` file in `android` or `ios` directory : -- Replace `YOUR_USERNAME` & `YOUR_ACCESS_KEY` with your BrowserStack access credentials +- Replace `YOUR_USERNAME` & `YOUR_ACCESS_KEY` with your BrowserStack access credentials. Get your BrowserStack access credentials from [here](https://www.browserstack.com/accounts/settings) - Replace `bs://` wkth the URL obtained from app upload step @@ -88,7 +88,7 @@ Ensure that @ symbol is prepended to the file path in the above request. Please Open `browserstack_sample_local.rb` file in `android` or `ios` directory : -- Replace `YOUR_USERNAME` & `YOUR_ACCESS_KEY` with your BrowserStack access credentials +- Replace `YOUR_USERNAME` & `YOUR_ACCESS_KEY` with your BrowserStack access credentials. Get your BrowserStack access credentials from [here](https://www.browserstack.com/accounts/settings) - Replace `bs://` wkth the URL obtained from app upload step From 5c9d964364f82702c58872082f94c5439985b6a1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 7 Oct 2020 09:26:22 +0000 Subject: [PATCH 20/24] Bump faye-websocket from 0.10.9 to 0.11.0 Bumps [faye-websocket](https://github.com/faye/faye-websocket-ruby) from 0.10.9 to 0.11.0. - [Release notes](https://github.com/faye/faye-websocket-ruby/releases) - [Changelog](https://github.com/faye/faye-websocket-ruby/blob/master/CHANGELOG.md) - [Commits](https://github.com/faye/faye-websocket-ruby/compare/0.10.9...0.11.0) Signed-off-by: dependabot[bot] --- Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index d8d14b4..cc945f2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -5,13 +5,13 @@ GEM appium_lib_core (~> 3.3) nokogiri (~> 1.8, >= 1.8.1) tomlrb (~> 1.1) - appium_lib_core (3.10.1) - faye-websocket (~> 0.10.0) + appium_lib_core (3.11.0) + faye-websocket (~> 0.11.0) selenium-webdriver (~> 3.14, >= 3.14.1) browserstack-local (1.3.0) childprocess (3.0.0) eventmachine (1.2.7) - faye-websocket (0.10.9) + faye-websocket (0.11.0) eventmachine (>= 0.12.0) websocket-driver (>= 0.5.1) mini_portile2 (2.4.0) From 90d0636b6c78d3f149f13090ad8cc759e0f69d30 Mon Sep 17 00:00:00 2001 From: Rishav Kumar Date: Tue, 13 Oct 2020 16:43:39 +0530 Subject: [PATCH 21/24] fixed readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 756519c..1672f23 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ This repository demonstrates how to run Appium Ruby tests on BrowserStack App Au ### Requirements -1. Ruby 2.2+ +1. Ruby >=2.3.0 - If not installed, install Ruby from [here](https://www.ruby-lang.org/en/documentation/installation/) From ecc23bd47652b47336cc07f5a6dd9b436d9a5c60 Mon Sep 17 00:00:00 2001 From: Rishav Kumar Date: Tue, 13 Oct 2020 16:53:08 +0530 Subject: [PATCH 22/24] removed support for lower version --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1672f23..400f7ef 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ This repository demonstrates how to run Appium Ruby tests on BrowserStack App Au ### Requirements -1. Ruby >=2.3.0 +1. Ruby >=2.6 - If not installed, install Ruby from [here](https://www.ruby-lang.org/en/documentation/installation/) From 6c399190031b11bbf42c9addcf258597b6e28eb8 Mon Sep 17 00:00:00 2001 From: Nitish Bhardwaj Date: Mon, 20 Sep 2021 16:54:13 +0530 Subject: [PATCH 23/24] Updated build names as per QIG --- android/browserstack_sample.rb | 2 +- android/browserstack_sample_local.rb | 2 +- ios/browserstack_sample.rb | 2 +- ios/browserstack_sample_local.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/android/browserstack_sample.rb b/android/browserstack_sample.rb index 67353d7..f0aac8f 100644 --- a/android/browserstack_sample.rb +++ b/android/browserstack_sample.rb @@ -16,7 +16,7 @@ # Set other BrowserStack capabilities caps['project'] = 'First Ruby project' -caps['build'] = 'Ruby Android' +caps['build'] = 'browserstack-build-1' caps['name'] = 'single_test' #Set the platform name diff --git a/android/browserstack_sample_local.rb b/android/browserstack_sample_local.rb index 893476d..861aae5 100644 --- a/android/browserstack_sample_local.rb +++ b/android/browserstack_sample_local.rb @@ -23,7 +23,7 @@ # Set other BrowserStack capabilities caps['project'] = 'First Ruby project' -caps['build'] = 'Ruby Android Local' +caps['build'] = 'browserstack-build-1' caps['name'] = 'local_test' caps['platformName'] = 'android' caps['browserstack.debug'] = true diff --git a/ios/browserstack_sample.rb b/ios/browserstack_sample.rb index 581df9c..152d65d 100644 --- a/ios/browserstack_sample.rb +++ b/ios/browserstack_sample.rb @@ -16,7 +16,7 @@ # Set other BrowserStack capabilities caps['project'] = 'First Ruby project' -caps['build'] = 'Ruby iOS' +caps['build'] = 'browserstack-build-1' caps['name'] = 'single_test' #Set the platform name diff --git a/ios/browserstack_sample_local.rb b/ios/browserstack_sample_local.rb index d0c3808..26c8fb1 100644 --- a/ios/browserstack_sample_local.rb +++ b/ios/browserstack_sample_local.rb @@ -24,7 +24,7 @@ # Set other BrowserStack capabilities caps['project'] = 'First Ruby project' -caps['build'] = 'Ruby iOS Local' +caps['build'] = 'browserstack-build-1' caps['name'] = 'local_test' caps['platformName'] = 'iOS' caps['browserstack.debug'] = true From 56329e24f5d76224859b19cfea50fb2e0b9125a7 Mon Sep 17 00:00:00 2001 From: lonayman <112390677+lonayman@users.noreply.github.com> Date: Tue, 30 Aug 2022 14:59:37 +0300 Subject: [PATCH 24/24] Update browserstack_sample.rb --- android/browserstack_sample.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/android/browserstack_sample.rb b/android/browserstack_sample.rb index f0aac8f..b141545 100644 --- a/android/browserstack_sample.rb +++ b/android/browserstack_sample.rb @@ -1,11 +1,11 @@ -require 'rubygems' +Derequire 'rubygems' require 'appium_lib' require 'selenium-webdriver' caps = {} # Set your access credentials -caps['browserstack.user'] = 'YOUR_USERNAME' -caps['browserstack.key'] = 'YOUR_ACCESS_KEY' +caps['browserstack.user'] = 'ysmnturut_aqNVOR' +caps['browserstack.key'] = 'n8WqPYcXQNBwiDmi8K8H' # Set URL of the application under test caps['app'] = 'bs://'