From 43e97a10dcc1befd6dbafe1a66ff574117d665ce Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Sun, 12 Jul 2020 18:57:21 +0530 Subject: [PATCH 01/33] Updated main Readme.md file Updated main Readme.md file with following sections and relevant content : - Introduction - Documentation - Installation- Requirements, Dependencies - Getting Started/Usage - Integration with other frameworks - Getting Help --- README.md | 130 ++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 122 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 42e89bb..c6a1f92 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,127 @@ # python-appium-app-browserstack -App Automate Python Samples ---------------------- -This repository contains code for Automated Native App tests. Please feel free to clone the repo and use the example code. -Refer [Getting Started with App Automate](https://www.browserstack.com/app-automate/appium-python) for more details. +python-appium-app-browserstack provides sample code to run tests using Appium with Python on BrowserStack’s real device cloud. It includes code required to integrate with BrowserStack cloud and tests for BrowserStack’s sample Android and iOS app. + +## Documentation + +--- +Refer [Getting Started using Appium with Python](https://www.browserstack.com/app-automate/appium-python) + +## Installation + +--- + +### Requirements + +1. Python 3.5+ or Python 2.7+ (refer [python-2-master branch](https://github.com/browserstack/python-appium-app-browserstack/tree/python-2-master)) + + - If Python is not installed, follow these instructions: + - For Windows, download latest python version from [here](https://www.python.org/downloads/windows/) and run the installer exe + - For Mac and Linux, run python --version to see what python version is pre-installed. If you want updated version download from [here](https://www.python.org/downloads/) + +2. pip + + - If pip is not installed, follow these instructions: + - Securely download get-pip.py by following this link: get-pip.py or use following curl command: + + ```sh + curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py + ``` + + ```sh + python get-pip.py + ``` + +### Dependencies + +- Depending on your use case, switch to android/ or ios/ folder and run - + +```sh +pip install -r requirements.txt +``` + +## Getting Started + +--- +Getting Started with Python Appium tests on real BrowserStack devices couldn't be easier. + +### **Run first test in 3 simple steps :** + +1. ### Upload App + + - Upload your android app apk or iOS app ipa file, or Upload one of the Browserstack’s sample app [WikipediaSampleAndroidApp](https://www.browserstack.com/app-automate/sample-apps/android/WikipediaSample.apk) | [BStackSampleiOSApp](https://www.browserstack.com/app-automate/sample-apps/ios/BStackSampleApp.ipa) + + Note: Update username and accesskey with BrowserStack credentials (Find your BrowserStack credentials [here](https://www.browserstack.com/accounts/settings)) + + ``` sh + curl -u "username:accesskey" -X POST "https://api.browserstack.com/app-automate/upload" -F "file=@/path/to/app/file/Application-debug.apk" + ``` + + - Copy the 'app_url' (bs://\) returned in the response and keep it somewhere + +2. ### Configure and run tests + + - Open file android/BrowserStackAndroid.py for android tests or ios/BrowserStackIOS.py for iOS tests + + - Update BrowserStack credentials - userName & accessKey (Find your BrowserStack credentials [here](https://www.browserstack.com/accounts/settings) + + - Update the desired_caps "app" capability with app_url (bs://\) received in upload app API response + + - If you have uploaded your app instead of sample app, update the tests in the file accordingly + + - Run tests with following command + + ```sh + python android/BrowserStackAndroid.py or python ios/BrowserStackIOS.py + ``` + +3. ### Thats it! view your tests results on [BrowserStack App Automate dashboard](https://app-automate.browserstack.com/) + +### **If your app is deployed on development or testing environment, try BrowserStack Local Testing** + +1. ### Upload app pointing to staging or dev environment + + - Upload your android app apk or iOS app ipa file, or Upload one of the Browserstack’s sample app [LocalAndroidSample.apk](https://www.browserstack.com/app-automate/sample-apps/android/LocalSample.apk) | [LocaliOSSample.ipa](https://www.browserstack.com/app-automate/sample-apps/ios/LocalSample.ipa) + + Note: Update your BrowserStack credentials - username and accesskey (Find your BrowserStack credentials [here](https://www.browserstack.com/accounts/settings)) + + ``` sh + curl -u "username:accesskey" -X POST "https://api.browserstack.com/app-automate/upload" -F "file=@/path/to/app/file/Application-debug.apk" + ``` + + - Copy the 'app_url'(bs://\) returned in the response and keep it somewhere + +2. ### Configure and run local tests + + - Open file android/LocalSampleAndroid.py for android tests or ios/LocalSampleIOS.py for iOS tests + + - Update BrowserStack credentials - userName & accessKey (Find your BrowserStack credentials [here](https://www.browserstack.com/accounts/settings) + + - Update the desired_caps "app" capability with app_url (bs://\) received in upload app API response + + - If you have uploaded your app instead of sample app, update the tests accordingly + + - Run tests with following command + + ```sh + python android/LocalSampleAndroid.py or python ios/LocalSampleIOS.py + ``` + +3. ### Thats it! View your tests results on [BrowserStack App Automate dashboard](https://app-automate.browserstack.com/) + +## Integration with other python frameworks + +--- +For Python frameworks samples and integrations with BrowserStack, refer to following reposoritories : -For frameworks integration with BrowserStack, refer to their individual repositories - -- [Lettuce](https://github.com/browserstack/lettuce-appium-app-browserstack) - [Behave](https://github.com/browserstack/behave-appium-app-browserstack) -For python 2 support refer the branch -- [python-2-master](https://github.com/browserstack/python-appium-app-browserstack/tree/python-2-master) +- [Lettuce](https://github.com/browserstack/lettuce-appium-app-browserstack) + +Note: To check all test frameworks supported by App-Automate refer [App-Automate testing frameworks documentation](https://www.browserstack.com/docs?product=app-automate) + +## 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 baae2c7d7866695c87d66844cb7a1852d01249e3 Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Sun, 12 Jul 2020 19:12:24 +0530 Subject: [PATCH 02/33] Updated main readme.md documentation - Removed horizontal lines - Reduced font of step headers - Typo fixes --- README.md | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index c6a1f92..c31f6ce 100644 --- a/README.md +++ b/README.md @@ -4,13 +4,10 @@ python-appium-app-browserstack provides sample code to run tests using Appium wi ## Documentation ---- Refer [Getting Started using Appium with Python](https://www.browserstack.com/app-automate/appium-python) ## Installation ---- - ### Requirements 1. Python 3.5+ or Python 2.7+ (refer [python-2-master branch](https://github.com/browserstack/python-appium-app-browserstack/tree/python-2-master)) @@ -42,12 +39,11 @@ pip install -r requirements.txt ## Getting Started ---- -Getting Started with Python Appium tests on real BrowserStack devices couldn't be easier. +Getting Started with Python Appium tests on real BrowserStack devices couldn't be easier! ### **Run first test in 3 simple steps :** -1. ### Upload App +1. #### Upload App - Upload your android app apk or iOS app ipa file, or Upload one of the Browserstack’s sample app [WikipediaSampleAndroidApp](https://www.browserstack.com/app-automate/sample-apps/android/WikipediaSample.apk) | [BStackSampleiOSApp](https://www.browserstack.com/app-automate/sample-apps/ios/BStackSampleApp.ipa) @@ -57,9 +53,9 @@ Getting Started with Python Appium tests on real BrowserStack devices couldn't b curl -u "username:accesskey" -X POST "https://api.browserstack.com/app-automate/upload" -F "file=@/path/to/app/file/Application-debug.apk" ``` - - Copy the 'app_url' (bs://\) returned in the response and keep it somewhere + - Copy the 'app_url' (bs://\) returned in the response and save it -2. ### Configure and run tests +2. #### Configure and run tests - Open file android/BrowserStackAndroid.py for android tests or ios/BrowserStackIOS.py for iOS tests @@ -75,11 +71,11 @@ Getting Started with Python Appium tests on real BrowserStack devices couldn't b python android/BrowserStackAndroid.py or python ios/BrowserStackIOS.py ``` -3. ### Thats it! view your tests results on [BrowserStack App Automate dashboard](https://app-automate.browserstack.com/) +3. #### Thats it! view your tests results on [BrowserStack App Automate dashboard](https://app-automate.browserstack.com/) ### **If your app is deployed on development or testing environment, try BrowserStack Local Testing** -1. ### Upload app pointing to staging or dev environment +1. #### Upload app - Upload your android app apk or iOS app ipa file, or Upload one of the Browserstack’s sample app [LocalAndroidSample.apk](https://www.browserstack.com/app-automate/sample-apps/android/LocalSample.apk) | [LocaliOSSample.ipa](https://www.browserstack.com/app-automate/sample-apps/ios/LocalSample.ipa) @@ -89,13 +85,13 @@ Getting Started with Python Appium tests on real BrowserStack devices couldn't b curl -u "username:accesskey" -X POST "https://api.browserstack.com/app-automate/upload" -F "file=@/path/to/app/file/Application-debug.apk" ``` - - Copy the 'app_url'(bs://\) returned in the response and keep it somewhere + - Copy the 'app_url'(bs://\) returned in the response and save it -2. ### Configure and run local tests +2. #### Configure and run local tests - Open file android/LocalSampleAndroid.py for android tests or ios/LocalSampleIOS.py for iOS tests - - Update BrowserStack credentials - userName & accessKey (Find your BrowserStack credentials [here](https://www.browserstack.com/accounts/settings) + - Update BrowserStack credentials - userName & accessKey (Find your BrowserStack credentials) [here](https://www.browserstack.com/accounts/settings) - Update the desired_caps "app" capability with app_url (bs://\) received in upload app API response @@ -107,21 +103,17 @@ Getting Started with Python Appium tests on real BrowserStack devices couldn't b python android/LocalSampleAndroid.py or python ios/LocalSampleIOS.py ``` -3. ### Thats it! View your tests results on [BrowserStack App Automate dashboard](https://app-automate.browserstack.com/) +3. #### Thats it! View your tests results on [BrowserStack App Automate dashboard](https://app-automate.browserstack.com/) ## Integration with other python frameworks ---- -For Python frameworks samples and integrations with BrowserStack, refer to following reposoritories : +For other Python frameworks samples, refer to following reposoritories : - [Behave](https://github.com/browserstack/behave-appium-app-browserstack) - - [Lettuce](https://github.com/browserstack/lettuce-appium-app-browserstack) -Note: To check all test frameworks supported by App-Automate refer [App-Automate testing frameworks documentation](https://www.browserstack.com/docs?product=app-automate) +Note: For other test frameworks supported by App-Automate refer [App-Automate testing frameworks documentation](https://www.browserstack.com/docs?product=app-automate) ## 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). - +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). \ No newline at end of file From abf0536285b66ae16a6e6f0fc8d63a2f69ccf151 Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Sun, 12 Jul 2020 19:28:36 +0530 Subject: [PATCH 03/33] Fixed typo errors in main Readme file --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c31f6ce..b2bf7fc 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # python-appium-app-browserstack -python-appium-app-browserstack provides sample code to run tests using Appium with Python on BrowserStack’s real device cloud. It includes code required to integrate with BrowserStack cloud and tests for BrowserStack’s sample Android and iOS app. +This repository provides sample code to run tests using Appium with Python on BrowserStack’s real device cloud. It includes code required to integrate with BrowserStack cloud and tests written for BrowserStack’s sample Android and iOS apps. ## Documentation @@ -57,13 +57,13 @@ Getting Started with Python Appium tests on real BrowserStack devices couldn't b 2. #### Configure and run tests - - Open file android/BrowserStackAndroid.py for android tests or ios/BrowserStackIOS.py for iOS tests + - Open file android/BrowserStackAndroid.py to run android tests or ios/BrowserStackIOS.py to run iOS tests - - Update BrowserStack credentials - userName & accessKey (Find your BrowserStack credentials [here](https://www.browserstack.com/accounts/settings) + - Update BrowserStack credentials - userName & accessKey (Find your BrowserStack credentials [here](https://www.browserstack.com/accounts/settings)) - Update the desired_caps "app" capability with app_url (bs://\) received in upload app API response - - If you have uploaded your app instead of sample app, update the tests in the file accordingly + - If you have uploaded your app instead of BrowserStack sample app, update the tests accordingly - Run tests with following command @@ -91,7 +91,7 @@ Getting Started with Python Appium tests on real BrowserStack devices couldn't b - Open file android/LocalSampleAndroid.py for android tests or ios/LocalSampleIOS.py for iOS tests - - Update BrowserStack credentials - userName & accessKey (Find your BrowserStack credentials) [here](https://www.browserstack.com/accounts/settings) + - Update BrowserStack credentials - userName & accessKey (Find your BrowserStack credentials [here](https://www.browserstack.com/accounts/settings)) - Update the desired_caps "app" capability with app_url (bs://\) received in upload app API response From a1c692804b4248934732f4b63c1947c7f1131207 Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Sun, 12 Jul 2020 19:40:20 +0530 Subject: [PATCH 04/33] Updated Readme.md documentation text and fixed few typos --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b2bf7fc..ccb8768 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ Getting Started with Python Appium tests on real BrowserStack devices couldn't b 3. #### Thats it! view your tests results on [BrowserStack App Automate dashboard](https://app-automate.browserstack.com/) -### **If your app is deployed on development or testing environment, try BrowserStack Local Testing** +### **Try BrowserStack Local Testing to test your apps deployed on development or testing environment** 1. #### Upload app @@ -107,7 +107,7 @@ Getting Started with Python Appium tests on real BrowserStack devices couldn't b ## Integration with other python frameworks -For other Python frameworks samples, refer to following reposoritories : +For other Python frameworks samples, refer to following repositories : - [Behave](https://github.com/browserstack/behave-appium-app-browserstack) - [Lettuce](https://github.com/browserstack/lettuce-appium-app-browserstack) From b17572323dbfc4ab3e53753c4697aa2bb13610d2 Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Sun, 12 Jul 2020 19:47:15 +0530 Subject: [PATCH 05/33] Updated link to download pip and fixed typos. --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ccb8768..9f1ae9b 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Refer [Getting Started using Appium with Python](https://www.browserstack.com/a 2. pip - If pip is not installed, follow these instructions: - - Securely download get-pip.py by following this link: get-pip.py or use following curl command: + - Securely download get-pip.py by following this link: [get-pip.py](https://bootstrap.pypa.io/get-pip.py) or use following curl command: ```sh curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py @@ -59,7 +59,7 @@ Getting Started with Python Appium tests on real BrowserStack devices couldn't b - Open file android/BrowserStackAndroid.py to run android tests or ios/BrowserStackIOS.py to run iOS tests - - Update BrowserStack credentials - userName & accessKey (Find your BrowserStack credentials [here](https://www.browserstack.com/accounts/settings)) + - Update BrowserStack credentials - userName & accessKey (Find your BrowserStack credentials [here](https://www.browserstack.com/accounts/settings)) - Update the desired_caps "app" capability with app_url (bs://\) received in upload app API response @@ -91,7 +91,7 @@ Getting Started with Python Appium tests on real BrowserStack devices couldn't b - Open file android/LocalSampleAndroid.py for android tests or ios/LocalSampleIOS.py for iOS tests - - Update BrowserStack credentials - userName & accessKey (Find your BrowserStack credentials [here](https://www.browserstack.com/accounts/settings)) + - Update BrowserStack credentials - userName & accessKey (Find your BrowserStack credentials [here](https://www.browserstack.com/accounts/settings)) - Update the desired_caps "app" capability with app_url (bs://\) received in upload app API response From 5e476029f6857aed996b2ee24bc076bbb2e2b139 Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Mon, 13 Jul 2020 00:01:58 +0530 Subject: [PATCH 06/33] Updated main README.md and deleted android, ios specific readme Updated content of main README.md and deleted android, ios specific README files. --- README.md | 12 ++++++------ android/README.md | 34 ---------------------------------- ios/README.md | 34 ---------------------------------- 3 files changed, 6 insertions(+), 74 deletions(-) delete mode 100644 android/README.md delete mode 100644 ios/README.md diff --git a/README.md b/README.md index 9f1ae9b..da21963 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # python-appium-app-browserstack -This repository provides sample code to run tests using Appium with Python on BrowserStack’s real device cloud. It includes code required to integrate with BrowserStack cloud and tests written for BrowserStack’s sample Android and iOS apps. +This repository demonstrates how to run Appium Python mobile app tests on BrowserStack's real device cloud. ## Documentation @@ -31,10 +31,10 @@ Refer [Getting Started using Appium with Python](https://www.browserstack.com/a ### Dependencies -- Depending on your use case, switch to android/ or ios/ folder and run - +- Depending on whether you are running android or iOS tests, run : ```sh -pip install -r requirements.txt +pip install -r android/requirements.txt or pip install -r ios/requirements.txt ``` ## Getting Started @@ -45,7 +45,7 @@ Getting Started with Python Appium tests on real BrowserStack devices couldn't b 1. #### Upload App - - Upload your android app apk or iOS app ipa file, or Upload one of the Browserstack’s sample app [WikipediaSampleAndroidApp](https://www.browserstack.com/app-automate/sample-apps/android/WikipediaSample.apk) | [BStackSampleiOSApp](https://www.browserstack.com/app-automate/sample-apps/ios/BStackSampleApp.ipa) + - Upload your android app apk or iOS app ipa file, or upload one of the Browserstack’s sample app [WikipediaSampleAndroidApp](https://www.browserstack.com/app-automate/sample-apps/android/WikipediaSample.apk) | [BStackSampleiOSApp](https://www.browserstack.com/app-automate/sample-apps/ios/BStackSampleApp.ipa) Note: Update username and accesskey with BrowserStack credentials (Find your BrowserStack credentials [here](https://www.browserstack.com/accounts/settings)) @@ -73,11 +73,11 @@ Getting Started with Python Appium tests on real BrowserStack devices couldn't b 3. #### Thats it! view your tests results on [BrowserStack App Automate dashboard](https://app-automate.browserstack.com/) -### **Try BrowserStack Local Testing to test your apps deployed on development or testing environment** +### **Try BrowserStack Local Testing to test apps deployed on development or testing environment** 1. #### Upload app - - Upload your android app apk or iOS app ipa file, or Upload one of the Browserstack’s sample app [LocalAndroidSample.apk](https://www.browserstack.com/app-automate/sample-apps/android/LocalSample.apk) | [LocaliOSSample.ipa](https://www.browserstack.com/app-automate/sample-apps/ios/LocalSample.ipa) + - Upload your android app apk or iOS app ipa file, or upload one of the Browserstack’s sample app [LocalAndroidSample.apk](https://www.browserstack.com/app-automate/sample-apps/android/LocalSample.apk) | [LocaliOSSample.ipa](https://www.browserstack.com/app-automate/sample-apps/ios/LocalSample.ipa) Note: Update your BrowserStack credentials - username and accesskey (Find your BrowserStack credentials [here](https://www.browserstack.com/accounts/settings)) diff --git a/android/README.md b/android/README.md deleted file mode 100644 index 0e4aaa6..0000000 --- a/android/README.md +++ /dev/null @@ -1,34 +0,0 @@ -## Dependencies - -For installing the required packages, use the following command - -``` -$ pip3 install -r requirements.txt -``` - -## Running your tests - -- Do remember to switch the BROWSERSTACK_USERNAME and BROWSERSTACK_ACCESS_KEY with your own browserstack credentials. -- Upload your Native App (.apk file) to BrowserStack servers using upload API and update the app capability: - - ``` - 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. -- Run ```python3 BrowserStackAndroid.py``` -- For LocalSample tests, you can use our [local sample app](https://www.browserstack.com/app-automate/sample-apps/android/LocalSample.apk). -- Run ```python3 LocalSampleAndroid.py``` -- 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-python) document to configure the capabilities - -For frameworks integration with BrowserStack, refer to their individual repositories - - -- [Lettuce](https://github.com/browserstack/lettuce-appium-app-browserstack) -- [Behave](https://github.com/browserstack/behave-appium-app-browserstack) - -For python 2 support refer the branch -- [python-2-master](https://github.com/browserstack/python-appium-app-browserstack/tree/python-2-master) diff --git a/ios/README.md b/ios/README.md deleted file mode 100644 index ecf1540..0000000 --- a/ios/README.md +++ /dev/null @@ -1,34 +0,0 @@ -## Dependencies - -For installing the required packages, use the following command - -``` -$ pip3 install -r requirements.txt -``` - -## Running your tests - -- Do remember to switch the BROWSERSTACK_USERNAME and BROWSERSTACK_ACCESS_KEY with your own browserstack credentials. -- Upload your Native App (.ipa file) to BrowserStack servers using upload API and update the app capability: - - ``` - 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. -- Update the desired capability "app" with the App URL returned from the above API call -- Run ```python3 BrowserStackIOS.py``` -- For LocalSample tests, you can use our [local sample app](https://www.browserstack.com/app-automate/sample-apps/ios/LocalSample.ipa). -- Run ```python3 LocalSampleIOS.py``` for local testing - -## 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-python) document to configure the capabilities - -For frameworks integration with BrowserStack, refer to their individual repositories - - -- [Lettuce](https://github.com/browserstack/lettuce-appium-app-browserstack) -- [Behave](https://github.com/browserstack/behave-appium-app-browserstack) - -For python 2 support refer the branch -- [python-2-master](https://github.com/browserstack/python-appium-app-browserstack/tree/python-2-master) From 3d6d2459b263308817cadb1dd12ca9eba69bbc9a Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Mon, 13 Jul 2020 00:11:32 +0530 Subject: [PATCH 07/33] Adding links to Getting Help section if user faces any issues. --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index da21963..254a56b 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,8 @@ Getting Started with Python Appium tests on real BrowserStack devices couldn't b 3. #### Thats it! view your tests results on [BrowserStack App Automate dashboard](https://app-automate.browserstack.com/) + Note: If you face any issues, refer [Getting Help section](#Getting-Help) + ### **Try BrowserStack Local Testing to test apps deployed on development or testing environment** 1. #### Upload app @@ -105,6 +107,8 @@ Getting Started with Python Appium tests on real BrowserStack devices couldn't b 3. #### Thats it! View your tests results on [BrowserStack App Automate dashboard](https://app-automate.browserstack.com/) + Note: If you face any issues, refer [Getting Help section](#Getting-Help) + ## Integration with other python frameworks For other Python frameworks samples, refer to following repositories : From 151cbdcb7b58c10119a67d2c54a9134b26733359 Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Wed, 15 Jul 2020 12:20:47 +0530 Subject: [PATCH 08/33] Updated file structure, added support for parallel testing Updated File structure - Added run_first_test, run_local_test, run_parallel_test directories under examples directory Updated configuration files to add project, build, and name for every session ran on BrowserStack. Updated support for parallel testing for iOS and Android. --- android/.gitignore | 3 + android/examples/run_first_test/config.json | 13 ++++ android/examples/run_first_test/first_test.py | 51 +++++++++++++ android/examples/run_local_test/config.json | 14 ++++ android/examples/run_local_test/local_test.py | 72 +++++++++++++++++++ .../examples/run_parallel_tests/config.json | 26 +++++++ .../run_parallel_tests/parallel_tests.py | 58 +++++++++++++++ ios/examples/local.log | 4 ++ ios/examples/run_first_test/config.json | 13 ++++ ios/examples/run_first_test/first_test.py | 55 ++++++++++++++ ios/examples/run_local_test/config.json | 14 ++++ ios/examples/run_local_test/local.log | 4 ++ ios/examples/run_local_test/local_test.py | 71 ++++++++++++++++++ ios/examples/run_parallel_tests/config.json | 19 +++++ .../run_parallel_tests/parallel_test.py | 62 ++++++++++++++++ 15 files changed, 479 insertions(+) create mode 100644 android/.gitignore create mode 100644 android/examples/run_first_test/config.json create mode 100644 android/examples/run_first_test/first_test.py create mode 100644 android/examples/run_local_test/config.json create mode 100644 android/examples/run_local_test/local_test.py create mode 100644 android/examples/run_parallel_tests/config.json create mode 100644 android/examples/run_parallel_tests/parallel_tests.py create mode 100644 ios/examples/local.log create mode 100644 ios/examples/run_first_test/config.json create mode 100644 ios/examples/run_first_test/first_test.py create mode 100644 ios/examples/run_local_test/config.json create mode 100644 ios/examples/run_local_test/local.log create mode 100644 ios/examples/run_local_test/local_test.py create mode 100644 ios/examples/run_parallel_tests/config.json create mode 100644 ios/examples/run_parallel_tests/parallel_test.py diff --git a/android/.gitignore b/android/.gitignore new file mode 100644 index 0000000..10ba245 --- /dev/null +++ b/android/.gitignore @@ -0,0 +1,3 @@ +*/local.log +*/browserstack.err +*/**.pyc diff --git a/android/examples/run_first_test/config.json b/android/examples/run_first_test/config.json new file mode 100644 index 0000000..eebb25d --- /dev/null +++ b/android/examples/run_first_test/config.json @@ -0,0 +1,13 @@ +{ + "username":"BROWSERSTACK_USERNAME", + "access_key":"BROWSERSTACK_ACCESS_KEY", + + "capabilities": { + "project": "First Python Android Project", + "build": "Python 3 Android", + "name": "single_test", + "browserstack.debug": true, + "app": "bs://d318ec55142bf92b1fec9fce6904109294db6678", + "device": "Google Pixel" + } +} \ No newline at end of file diff --git a/android/examples/run_first_test/first_test.py b/android/examples/run_first_test/first_test.py new file mode 100644 index 0000000..f24963a --- /dev/null +++ b/android/examples/run_first_test/first_test.py @@ -0,0 +1,51 @@ +from appium import webdriver +from appium.webdriver.common.mobileby import MobileBy +from selenium.webdriver.support.ui import WebDriverWait +from selenium.webdriver.support import expected_conditions as EC +import time +import os, json + +config_file_path = os.path.join(os.path.dirname(__file__), "config.json") +print("Config file = %s" % (config_file_path)) +with open(config_file_path) as config_file: + CONFIG = json.load(config_file) + +BROWSERSTACK_USERNAME = os.environ['BROWSERSTACK_USERNAME'] if 'BROWSERSTACK_USERNAME' in os.environ else CONFIG['username'] +BROWSERSTACK_ACCESS_KEY = os.environ['BROWSERSTACK_ACCESS_KEY'] if 'BROWSERSTACK_ACCESS_KEY' in os.environ else CONFIG['access_key'] + +def test(): + """ + Test for BrowserStack sample Wikipedia Android app. + Note: If you have uploaded your app to BrowserStack update the test here. + """ + + desired_capabilities = CONFIG['capabilities'] + + driver = webdriver.Remote( + desired_capabilities = desired_capabilities, + command_executor = "http://%s:%s@hub-cloud.browserstack.com/wd/hub" % (BROWSERSTACK_USERNAME, BROWSERSTACK_ACCESS_KEY) + ) + + search_element = WebDriverWait(driver, 30).until ( + EC.element_to_be_clickable((MobileBy.ACCESSIBILITY_ID, "Search Wikipedia")) + ) + + search_element.click() + + search_input = WebDriverWait(driver, 30).until ( + EC.element_to_be_clickable((MobileBy.ID, "org.wikipedia.alpha:id/search_src_text")) + ) + + search_input.send_keys("BrowserStack") + + time.sleep(5) + + search_results = driver.find_elements_by_class_name("android.widget.TextView") + + assert(len(search_results) > 0) + + driver.quit() + + +if __name__ == "__main__": + test() \ No newline at end of file diff --git a/android/examples/run_local_test/config.json b/android/examples/run_local_test/config.json new file mode 100644 index 0000000..bfadf73 --- /dev/null +++ b/android/examples/run_local_test/config.json @@ -0,0 +1,14 @@ +{ + "username":"BROWSERSTACK_USERNAME", + "access_key":"BROWSERSTACK_ACCESS_KEY", + + "capabilities": { + "project": "First Python Android Project", + "build": "Python 3 Android Local", + "name": "local_test", + "browserstack.debug": true, + "app": "bs://2628effb9a083f98a66db866cb4dbd2ee0311cbc", + "device": "Samsung Galaxy S7", + "browserstack.local": true + } +} \ No newline at end of file diff --git a/android/examples/run_local_test/local_test.py b/android/examples/run_local_test/local_test.py new file mode 100644 index 0000000..dfe91c6 --- /dev/null +++ b/android/examples/run_local_test/local_test.py @@ -0,0 +1,72 @@ +from appium import webdriver +from appium.webdriver.common.mobileby import MobileBy +from selenium.webdriver.support.ui import WebDriverWait +from selenium.webdriver.support import expected_conditions as EC +from browserstack.local import Local +import time +import os, json + +config_file_path = os.path.join(os.path.dirname(__file__), "config.json") +print("Config file = %s" % (config_file_path)) +with open(config_file_path) as config_file: + CONFIG = json.load(config_file) + +BROWSERSTACK_USERNAME = os.environ['BROWSERSTACK_USERNAME'] if 'BROWSERSTACK_USERNAME' in os.environ else CONFIG['username'] +BROWSERSTACK_ACCESS_KEY = os.environ['BROWSERSTACK_ACCESS_KEY'] if 'BROWSERSTACK_ACCESS_KEY' in os.environ else CONFIG['access_key'] + +bs_local = None + +def start_local(): + global bs_local + bs_local = Local() + bs_local_args = { "key": BROWSERSTACK_ACCESS_KEY, "forcelocal": "true" } + bs_local.start(**bs_local_args) + +def stop_local(): + global bs_local + bs_local.stop() + +def test(): + """ + Test for BrowserStack's sample local Android app. + Note: If you have uploaded your app to BrowserStack update the test here. + """ + + start_local() + + desired_capabilities = CONFIG['capabilities'] + + driver = webdriver.Remote( + desired_capabilities = desired_capabilities, + command_executor = "http://%s:%s@hub-cloud.browserstack.com/wd/hub" % (BROWSERSTACK_USERNAME, BROWSERSTACK_ACCESS_KEY) + ) + + test_button = WebDriverWait(driver, 30).until( + EC.element_to_be_clickable((MobileBy.ID, "com.example.android.basicnetworking:id/test_action")) + ) + test_button.click() + WebDriverWait(driver, 30).until( + EC.element_to_be_clickable((MobileBy.CLASS_NAME, "android.widget.TextView")) + ) + + test_element = None + search_results = driver.find_elements_by_class_name("android.widget.TextView") + for result in search_results: + if result.text.__contains__("The active connection is"): + test_element = result + + if test_element is None: + raise Exception("Cannot find the needed TextView element from app") + + matched_string = test_element.text + print (matched_string) + assert(matched_string.__contains__("The active connection is wifi")) + assert(matched_string.__contains__("Up and running")) + + driver.quit() + + stop_local() + + +if __name__ == "__main__": + test() \ No newline at end of file diff --git a/android/examples/run_parallel_tests/config.json b/android/examples/run_parallel_tests/config.json new file mode 100644 index 0000000..e86994e --- /dev/null +++ b/android/examples/run_parallel_tests/config.json @@ -0,0 +1,26 @@ +{ + "username":"BROWSERSTACK_USERNAME", + "access_key":"BROWSERSTACK_ACCESS_KEY", + + "capabilities": { + "project": "First Python Android Project", + "build": "Python 3 Android Parallel", + "name": "parallel_test", + "browserstack.debug": true, + "app": "bs://d318ec55142bf92b1fec9fce6904109294db6678" + }, + + "environments": [{ + "device": "Samsung Galaxy S8" + }, + { + "device": "Samsung Galaxy S7" + }, + { + "device": "Google Nexus 5" + }, + { + "device": "Google Pixel" + }] + +} \ No newline at end of file diff --git a/android/examples/run_parallel_tests/parallel_tests.py b/android/examples/run_parallel_tests/parallel_tests.py new file mode 100644 index 0000000..4679fe9 --- /dev/null +++ b/android/examples/run_parallel_tests/parallel_tests.py @@ -0,0 +1,58 @@ +from appium import webdriver +from appium.webdriver.common.mobileby import MobileBy +from selenium.webdriver.support.ui import WebDriverWait +from selenium.webdriver.support import expected_conditions as EC +import time +import os, json, threading + + +config_file_path = os.path.join(os.path.dirname(__file__), "config.json") +print("Config file = %s" % (config_file_path)) +with open(config_file_path) as config_file: + CONFIG = json.load(config_file) + +BROWSERSTACK_USERNAME = os.environ['BROWSERSTACK_USERNAME'] if 'BROWSERSTACK_USERNAME' in os.environ else CONFIG['username'] +BROWSERSTACK_ACCESS_KEY = os.environ['BROWSERSTACK_ACCESS_KEY'] if 'BROWSERSTACK_ACCESS_KEY' in os.environ else CONFIG['access_key'] + +def test(device_index): + """ + Test for BrowserStack sample Wikipedia Android app. + Note: If you have uploaded your app to BrowserStack update the test here. + """ + + desired_capabilities = CONFIG['capabilities'] + desired_capabilities['device'] = CONFIG['environments'][device_index]['device'] + + + driver = webdriver.Remote( + desired_capabilities = desired_capabilities, + command_executor = "http://%s:%s@hub-cloud.browserstack.com/wd/hub" % (BROWSERSTACK_USERNAME, BROWSERSTACK_ACCESS_KEY) + ) + + search_element = WebDriverWait(driver, 30).until ( + EC.element_to_be_clickable((MobileBy.ACCESSIBILITY_ID, "Search Wikipedia")) + ) + + search_element.click() + + search_input = WebDriverWait(driver, 30).until ( + EC.element_to_be_clickable((MobileBy.ID, "org.wikipedia.alpha:id/search_src_text")) + ) + + search_input.send_keys("BrowserStack") + + time.sleep(5) + + search_results = driver.find_elements_by_class_name("android.widget.TextView") + + assert(len(search_results) > 0) + + driver.quit() + + +if __name__ == "__main__": + jobs = [] + for i in range(4): + p = threading.Thread(target=test,args=(i,)) + jobs.append(p) + p.start() \ No newline at end of file diff --git a/ios/examples/local.log b/ios/examples/local.log new file mode 100644 index 0000000..7b06067 --- /dev/null +++ b/ios/examples/local.log @@ -0,0 +1,4 @@ + +Wed Jul 15 2020 11:56:48 GMT+0530 (IST) -- Press Ctrl-C to exit + + diff --git a/ios/examples/run_first_test/config.json b/ios/examples/run_first_test/config.json new file mode 100644 index 0000000..9a70472 --- /dev/null +++ b/ios/examples/run_first_test/config.json @@ -0,0 +1,13 @@ +{ + "username":"BROWSERSTACK_USERNAME", + "access_key":"BROWSERSTACK_ACCESS_KEY", + + "capabilities": { + "project": "First Python iOS Project", + "build": "Python 3 iOS", + "name": "single_test", + "browserstack.debug": true, + "app": "bs://1e5f65dc1f0ebe44d78594f075324908e191f620", + "device": "iPhone 7" + } +} \ No newline at end of file diff --git a/ios/examples/run_first_test/first_test.py b/ios/examples/run_first_test/first_test.py new file mode 100644 index 0000000..7c7e540 --- /dev/null +++ b/ios/examples/run_first_test/first_test.py @@ -0,0 +1,55 @@ +from appium import webdriver +from appium.webdriver.common.mobileby import MobileBy +from selenium.webdriver.support.ui import WebDriverWait +from selenium.webdriver.support import expected_conditions as EC +import time +import os, json + +config_file_path = os.path.join(os.path.dirname(__file__), "config.json") +print("Config file = %s" % (config_file_path)) +with open(config_file_path) as config_file: + CONFIG = json.load(config_file) + +BROWSERSTACK_USERNAME = os.environ['BROWSERSTACK_USERNAME'] if 'BROWSERSTACK_USERNAME' in os.environ else CONFIG['username'] +BROWSERSTACK_ACCESS_KEY = os.environ['BROWSERSTACK_ACCESS_KEY'] if 'BROWSERSTACK_ACCESS_KEY' in os.environ else CONFIG['access_key'] + +def test(): + """ + Test for BrowserStack sample iOS app. + Note: If you have uploaded your app to BrowserStack update the test here. + """ + + desired_capabilities = CONFIG['capabilities'] + + driver = webdriver.Remote( + desired_capabilities = desired_capabilities, + command_executor = "http://%s:%s@hub-cloud.browserstack.com/wd/hub" % (BROWSERSTACK_USERNAME, BROWSERSTACK_ACCESS_KEY) + ) + + text_button = WebDriverWait(driver, 30).until( + EC.element_to_be_clickable((MobileBy.ACCESSIBILITY_ID, "Text Button")) + ) + + text_button.click() + + text_input = WebDriverWait(driver, 30).until( + EC.element_to_be_clickable((MobileBy.ACCESSIBILITY_ID, "Text Input")) + ) + text_input.send_keys("hello@browserstack.com"+"\n") + + time.sleep(5) + + text_output = WebDriverWait(driver, 30).until( + EC.element_to_be_clickable((MobileBy.ACCESSIBILITY_ID, "Text Output")) + ) + + if text_output!=None and text_output.text=="hello@browserstack.com": + assert True + else: + assert False + + driver.quit() + + +if __name__ == "__main__": + test() \ No newline at end of file diff --git a/ios/examples/run_local_test/config.json b/ios/examples/run_local_test/config.json new file mode 100644 index 0000000..011e0d8 --- /dev/null +++ b/ios/examples/run_local_test/config.json @@ -0,0 +1,14 @@ +{ + "username":"BROWSERSTACK_USERNAME", + "access_key":"BROWSERSTACK_ACCESS_KEY", + + "capabilities": { + "project": "First Python iOS Project", + "build": "Python 3 iOS Local", + "name": "local_test", + "browserstack.debug": true, + "app": "bs://f88e466b82d604adffc3a065e483fabcb8ea9f38", + "device": "iPhone 7", + "browserstack.local": true + } +} \ No newline at end of file diff --git a/ios/examples/run_local_test/local.log b/ios/examples/run_local_test/local.log new file mode 100644 index 0000000..894f0cf --- /dev/null +++ b/ios/examples/run_local_test/local.log @@ -0,0 +1,4 @@ + +Wed Jul 15 2020 05:26:58 GMT+0530 (IST) -- Press Ctrl-C to exit + + diff --git a/ios/examples/run_local_test/local_test.py b/ios/examples/run_local_test/local_test.py new file mode 100644 index 0000000..63b5a95 --- /dev/null +++ b/ios/examples/run_local_test/local_test.py @@ -0,0 +1,71 @@ +from appium import webdriver +from appium.webdriver.common.mobileby import MobileBy +from selenium.webdriver.support.ui import WebDriverWait +from selenium.webdriver.support import expected_conditions as EC +from browserstack.local import Local +import time +import os, json + +config_file_path = os.path.join(os.path.dirname(__file__), "config.json") +print("Config file = %s" % (config_file_path)) +with open(config_file_path) as config_file: + CONFIG = json.load(config_file) + +BROWSERSTACK_USERNAME = os.environ['BROWSERSTACK_USERNAME'] if 'BROWSERSTACK_USERNAME' in os.environ else CONFIG['username'] +BROWSERSTACK_ACCESS_KEY = os.environ['BROWSERSTACK_ACCESS_KEY'] if 'BROWSERSTACK_ACCESS_KEY' in os.environ else CONFIG['access_key'] + +bs_local = None + +def start_local(): + global bs_local + bs_local = Local() + bs_local_args = { "key": BROWSERSTACK_ACCESS_KEY, "forcelocal": "true" } + bs_local.start(**bs_local_args) + +def stop_local(): + global bs_local + bs_local.stop() + +def existence_lambda(s): + result = s.find_element_by_accessibility_id("ResultBrowserStackLocal").get_attribute("value") + return result and len(result) > 0 + +def test(): + """ + Test for BrowserStack's sample local iOS app. + Note: If you have uploaded your app to BrowserStack update the test here. + """ + + start_local() + + desired_capabilities = CONFIG['capabilities'] + + driver = webdriver.Remote( + desired_capabilities = desired_capabilities, + command_executor = "http://%s:%s@hub-cloud.browserstack.com/wd/hub" % (BROWSERSTACK_USERNAME, BROWSERSTACK_ACCESS_KEY) + ) + + test_button = WebDriverWait(driver, 30).until( + EC.element_to_be_clickable((MobileBy.ACCESSIBILITY_ID, "TestBrowserStackLocal")) + ) + test_button.click() + + WebDriverWait(driver, 30).until(existence_lambda) + result_element = driver.find_element_by_accessibility_id("ResultBrowserStackLocal") + result_string = result_element.text.lower() + + if result_string.__contains__("not working"): + screenshot_file = "%s/screenshot.png" % os.getcwd() + driver.save_screenshot(screenshot_file) + print ("Screenshot stored at %s" % screenshot_file) + print ("Unexpected BrowserStackLocal test result") + else: + assert(result_string.__contains__("up and running")) + + driver.quit() + + stop_local() + + +if __name__ == "__main__": + test() \ No newline at end of file diff --git a/ios/examples/run_parallel_tests/config.json b/ios/examples/run_parallel_tests/config.json new file mode 100644 index 0000000..b636065 --- /dev/null +++ b/ios/examples/run_parallel_tests/config.json @@ -0,0 +1,19 @@ +{ + "username":"BROWSERSTACK_USERNAME", + "access_key":"BROWSERSTACK_ACCESS_KEY", + + "capabilities": { + "project": "First Python iOS Project", + "build": "Python 3 iOS Parallel", + "name": "parallel_test", + "browserstack.debug": true, + "app": "bs://1e5f65dc1f0ebe44d78594f075324908e191f620" + }, + + "environments": [{ + "device": "iPhone 7" + }, { + "device": "iPhone 7 Plus" + }] + +} \ No newline at end of file diff --git a/ios/examples/run_parallel_tests/parallel_test.py b/ios/examples/run_parallel_tests/parallel_test.py new file mode 100644 index 0000000..fa37893 --- /dev/null +++ b/ios/examples/run_parallel_tests/parallel_test.py @@ -0,0 +1,62 @@ +from appium import webdriver +from appium.webdriver.common.mobileby import MobileBy +from selenium.webdriver.support.ui import WebDriverWait +from selenium.webdriver.support import expected_conditions as EC +import time +import os, json, threading + + +config_file_path = os.path.join(os.path.dirname(__file__), "config.json") +print("Config file = %s" % (config_file_path)) +with open(config_file_path) as config_file: + CONFIG = json.load(config_file) + +BROWSERSTACK_USERNAME = os.environ['BROWSERSTACK_USERNAME'] if 'BROWSERSTACK_USERNAME' in os.environ else CONFIG['username'] +BROWSERSTACK_ACCESS_KEY = os.environ['BROWSERSTACK_ACCESS_KEY'] if 'BROWSERSTACK_ACCESS_KEY' in os.environ else CONFIG['access_key'] + +def test(device_index): + """ + Test for BrowserStack sample iOS app. + Note: If you have uploaded your app to BrowserStack update the test here. + """ + + desired_capabilities = CONFIG['capabilities'] + desired_capabilities['device'] = CONFIG['environments'][device_index]['device'] + + + driver = webdriver.Remote( + desired_capabilities = desired_capabilities, + command_executor = "http://%s:%s@hub-cloud.browserstack.com/wd/hub" % (BROWSERSTACK_USERNAME, BROWSERSTACK_ACCESS_KEY) + ) + + text_button = WebDriverWait(driver, 30).until( + EC.element_to_be_clickable((MobileBy.ACCESSIBILITY_ID, "Text Button")) + ) + + text_button.click() + + text_input = WebDriverWait(driver, 30).until( + EC.element_to_be_clickable((MobileBy.ACCESSIBILITY_ID, "Text Input")) + ) + text_input.send_keys("hello@browserstack.com"+"\n") + + time.sleep(5) + + text_output = WebDriverWait(driver, 30).until( + EC.element_to_be_clickable((MobileBy.ACCESSIBILITY_ID, "Text Output")) + ) + + if text_output!=None and text_output.text=="hello@browserstack.com": + assert True + else: + assert False + + driver.quit() + + +if __name__ == "__main__": + jobs = [] + for i in range(2): + p = threading.Thread(target=test,args=(i,)) + jobs.append(p) + p.start() \ No newline at end of file From d362136aa92316e9cd7d9e748d25b081125986e1 Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Wed, 15 Jul 2020 12:46:04 +0530 Subject: [PATCH 09/33] Deleting old test files, Added .gitignore --- android/.gitignore => .gitignore | 0 android/BrowserStackAndroid.py | 32 ------------------- android/LocalSampleAndroid.py | 55 -------------------------------- ios/BrowserStackIOS.py | 39 ---------------------- ios/LocalSampleIOS.py | 55 -------------------------------- ios/examples/local.log | 4 --- 6 files changed, 185 deletions(-) rename android/.gitignore => .gitignore (100%) delete mode 100644 android/BrowserStackAndroid.py delete mode 100644 android/LocalSampleAndroid.py delete mode 100644 ios/BrowserStackIOS.py delete mode 100644 ios/LocalSampleIOS.py delete mode 100644 ios/examples/local.log diff --git a/android/.gitignore b/.gitignore similarity index 100% rename from android/.gitignore rename to .gitignore diff --git a/android/BrowserStackAndroid.py b/android/BrowserStackAndroid.py deleted file mode 100644 index f647e9b..0000000 --- a/android/BrowserStackAndroid.py +++ /dev/null @@ -1,32 +0,0 @@ -from appium import webdriver -from appium.webdriver.common.mobileby import MobileBy -from selenium.webdriver.support.ui import WebDriverWait -from selenium.webdriver.support import expected_conditions as EC -import time - -userName = "BROWSERSTACK_USERNAME" -accessKey = "BROWSERSTACK_ACCESS_KEY" - -desired_caps = { - "build": "Python 3 Android", - "device": "Samsung Galaxy S7", - "app": "bs://" -} - -driver = webdriver.Remote("http://" + userName + ":" + accessKey + "@hub-cloud.browserstack.com/wd/hub", desired_caps) - -search_element = WebDriverWait(driver, 30).until( - EC.element_to_be_clickable((MobileBy.ACCESSIBILITY_ID, "Search Wikipedia")) -) -search_element.click() - -search_input = WebDriverWait(driver, 30).until( - EC.element_to_be_clickable((MobileBy.ID, "org.wikipedia.alpha:id/search_src_text")) -) -search_input.send_keys("BrowserStack") -time.sleep(5) - -search_results = driver.find_elements_by_class_name("android.widget.TextView") -assert(len(search_results) > 0) - -driver.quit() diff --git a/android/LocalSampleAndroid.py b/android/LocalSampleAndroid.py deleted file mode 100644 index f0d953f..0000000 --- a/android/LocalSampleAndroid.py +++ /dev/null @@ -1,55 +0,0 @@ -from appium import webdriver -from appium.webdriver.common.mobileby import MobileBy -from selenium.webdriver.support.ui import WebDriverWait -from selenium.webdriver.support import expected_conditions as EC -from browserstack.local import Local -import time - -userName = "BROWSERSTACK_USERNAME" -accessKey = "BROWSERSTACK_ACCESS_KEY" - -desired_caps = { - "build": "Python 3 Android Local", - "device": "Samsung Galaxy S7", - "browserstack.local": True, - "app": "bs://" -} - -bs_local = None - -def start_local(): - global bs_local - bs_local = Local() - bs_local_args = { "key": accessKey, "forcelocal": "true" } - bs_local.start(**bs_local_args) - -def stop_local(): - global bs_local - bs_local.stop() - -start_local() -driver = webdriver.Remote("http://" + userName + ":" + accessKey + "@hub-cloud.browserstack.com/wd/hub", desired_caps) -test_button = WebDriverWait(driver, 30).until( - EC.element_to_be_clickable((MobileBy.ID, "com.example.android.basicnetworking:id/test_action")) -) -test_button.click() -WebDriverWait(driver, 30).until( - EC.element_to_be_clickable((MobileBy.CLASS_NAME, "android.widget.TextView")) -) - -test_element = None -search_results = driver.find_elements_by_class_name("android.widget.TextView") -for result in search_results: - if result.text.__contains__("The active connection is"): - test_element = result - -if test_element is None: - raise Exception("Cannot find the needed TextView element from app") - -matched_string = test_element.text -print (matched_string) -assert(matched_string.__contains__("The active connection is wifi")) -assert(matched_string.__contains__("Up and running")) - -driver.quit() -stop_local() diff --git a/ios/BrowserStackIOS.py b/ios/BrowserStackIOS.py deleted file mode 100644 index 4b27e43..0000000 --- a/ios/BrowserStackIOS.py +++ /dev/null @@ -1,39 +0,0 @@ -from appium import webdriver -from appium.webdriver.common.mobileby import MobileBy -from selenium.webdriver.support.ui import WebDriverWait -from selenium.webdriver.support import expected_conditions as EC -import time - -userName = "BROWSERSTACK_USERNAME" -accessKey = "BROWSERSTACK_ACCESS_KEY" - -desired_caps = { - "build": "Python 3 iOS", - "device": "iPhone 7", - "app": "bs://" -} - -driver = webdriver.Remote("http://" + userName + ":" + accessKey + "@hub-cloud.browserstack.com/wd/hub", desired_caps) - -text_button = WebDriverWait(driver, 30).until( - EC.element_to_be_clickable((MobileBy.ACCESSIBILITY_ID, "Text Button")) -) -text_button.click() - -text_input = WebDriverWait(driver, 30).until( - EC.element_to_be_clickable((MobileBy.ACCESSIBILITY_ID, "Text Input")) -) -text_input.send_keys("hello@browserstack.com"+"\n") - -time.sleep(5) - -text_output = WebDriverWait(driver, 30).until( - EC.element_to_be_clickable((MobileBy.ACCESSIBILITY_ID, "Text Output")) -) - -if text_output!=None and text_output.text=="hello@browserstack.com": - assert True -else: - assert False - -driver.quit() \ No newline at end of file diff --git a/ios/LocalSampleIOS.py b/ios/LocalSampleIOS.py deleted file mode 100644 index 3d90f1a..0000000 --- a/ios/LocalSampleIOS.py +++ /dev/null @@ -1,55 +0,0 @@ -from appium import webdriver -from appium.webdriver.common.mobileby import MobileBy -from selenium.webdriver.support.ui import WebDriverWait -from selenium.webdriver.support import expected_conditions as EC -from browserstack.local import Local -import os - -userName = "BROWSERSTACK_USERNAME" -accessKey = "BROWSERSTACK_ACCESS_KEY" - -desired_caps = { - "build": "Python 3 iOS Local", - "device": "iPhone 7", - "browserstack.local": True, - "app": "bs://" -} - -bs_local = None - -def start_local(): - global bs_local - bs_local = Local() - bs_local_args = { "key": accessKey, "forcelocal": "true" } - bs_local.start(**bs_local_args) - -def stop_local(): - global bs_local - bs_local.stop() - -def existence_lambda(s): - result = s.find_element_by_accessibility_id("ResultBrowserStackLocal").get_attribute("value") - return result and len(result) > 0 - -start_local() -driver = webdriver.Remote("http://" + userName + ":" + accessKey + "@hub-cloud.browserstack.com/wd/hub", desired_caps) - -test_button = WebDriverWait(driver, 30).until( - EC.element_to_be_clickable((MobileBy.ACCESSIBILITY_ID, "TestBrowserStackLocal")) -) -test_button.click() - -WebDriverWait(driver, 30).until(existence_lambda) -result_element = driver.find_element_by_accessibility_id("ResultBrowserStackLocal") -result_string = result_element.text.lower() - -if result_string.__contains__("not working"): - screenshot_file = "%s/screenshot.png" % os.getcwd() - driver.save_screenshot(screenshot_file) - print ("Screenshot stored at %s" % screenshot_file) - print ("Unexpected BrowserStackLocal test result") -else: - assert(result_string.__contains__("up and running")) - -driver.quit() -stop_local() diff --git a/ios/examples/local.log b/ios/examples/local.log deleted file mode 100644 index 7b06067..0000000 --- a/ios/examples/local.log +++ /dev/null @@ -1,4 +0,0 @@ - -Wed Jul 15 2020 11:56:48 GMT+0530 (IST) -- Press Ctrl-C to exit - - From a1e3103661ca1db6062831e915d586a231550fa0 Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Wed, 15 Jul 2020 12:49:12 +0530 Subject: [PATCH 10/33] Removing local.log file from examples/ios/run_local_test directory --- ios/examples/run_local_test/local.log | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 ios/examples/run_local_test/local.log diff --git a/ios/examples/run_local_test/local.log b/ios/examples/run_local_test/local.log deleted file mode 100644 index 894f0cf..0000000 --- a/ios/examples/run_local_test/local.log +++ /dev/null @@ -1,4 +0,0 @@ - -Wed Jul 15 2020 05:26:58 GMT+0530 (IST) -- Press Ctrl-C to exit - - From 3b26b5edea62912f6921fb8f763b85497878db92 Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Wed, 15 Jul 2020 13:01:42 +0530 Subject: [PATCH 11/33] Removing sample app BrowserStack URLs from json files. --- android/examples/run_first_test/config.json | 2 +- android/examples/run_local_test/config.json | 2 +- android/examples/run_parallel_tests/config.json | 2 +- ios/examples/run_first_test/config.json | 2 +- ios/examples/run_local_test/config.json | 2 +- ios/examples/run_parallel_tests/config.json | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/android/examples/run_first_test/config.json b/android/examples/run_first_test/config.json index eebb25d..e6fe536 100644 --- a/android/examples/run_first_test/config.json +++ b/android/examples/run_first_test/config.json @@ -7,7 +7,7 @@ "build": "Python 3 Android", "name": "single_test", "browserstack.debug": true, - "app": "bs://d318ec55142bf92b1fec9fce6904109294db6678", + "app": "bs://", "device": "Google Pixel" } } \ No newline at end of file diff --git a/android/examples/run_local_test/config.json b/android/examples/run_local_test/config.json index bfadf73..3b6851f 100644 --- a/android/examples/run_local_test/config.json +++ b/android/examples/run_local_test/config.json @@ -7,7 +7,7 @@ "build": "Python 3 Android Local", "name": "local_test", "browserstack.debug": true, - "app": "bs://2628effb9a083f98a66db866cb4dbd2ee0311cbc", + "app": "bs://", "device": "Samsung Galaxy S7", "browserstack.local": true } diff --git a/android/examples/run_parallel_tests/config.json b/android/examples/run_parallel_tests/config.json index e86994e..6c21b3c 100644 --- a/android/examples/run_parallel_tests/config.json +++ b/android/examples/run_parallel_tests/config.json @@ -7,7 +7,7 @@ "build": "Python 3 Android Parallel", "name": "parallel_test", "browserstack.debug": true, - "app": "bs://d318ec55142bf92b1fec9fce6904109294db6678" + "app": "bs://" }, "environments": [{ diff --git a/ios/examples/run_first_test/config.json b/ios/examples/run_first_test/config.json index 9a70472..c92c66f 100644 --- a/ios/examples/run_first_test/config.json +++ b/ios/examples/run_first_test/config.json @@ -7,7 +7,7 @@ "build": "Python 3 iOS", "name": "single_test", "browserstack.debug": true, - "app": "bs://1e5f65dc1f0ebe44d78594f075324908e191f620", + "app": "bs://", "device": "iPhone 7" } } \ No newline at end of file diff --git a/ios/examples/run_local_test/config.json b/ios/examples/run_local_test/config.json index 011e0d8..8590f07 100644 --- a/ios/examples/run_local_test/config.json +++ b/ios/examples/run_local_test/config.json @@ -7,7 +7,7 @@ "build": "Python 3 iOS Local", "name": "local_test", "browserstack.debug": true, - "app": "bs://f88e466b82d604adffc3a065e483fabcb8ea9f38", + "app": "bs://", "device": "iPhone 7", "browserstack.local": true } diff --git a/ios/examples/run_parallel_tests/config.json b/ios/examples/run_parallel_tests/config.json index b636065..4458416 100644 --- a/ios/examples/run_parallel_tests/config.json +++ b/ios/examples/run_parallel_tests/config.json @@ -7,7 +7,7 @@ "build": "Python 3 iOS Parallel", "name": "parallel_test", "browserstack.debug": true, - "app": "bs://1e5f65dc1f0ebe44d78594f075324908e191f620" + "app": "bs://" }, "environments": [{ From 0d4dd0b44f435e97245b41e327ccffcc8e574237 Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Wed, 15 Jul 2020 13:52:01 +0530 Subject: [PATCH 12/33] Updated Github Readme Updated Github Readme with the following - Removed Documentation section - Updated Getting Started with new file structure and link to documentation --- README.md | 80 +++++++++++-------------------------------------------- 1 file changed, 15 insertions(+), 65 deletions(-) diff --git a/README.md b/README.md index 254a56b..51d6a93 100644 --- a/README.md +++ b/README.md @@ -2,21 +2,17 @@ This repository demonstrates how to run Appium Python mobile app tests on BrowserStack's real device cloud. -## Documentation - -Refer [Getting Started using Appium with Python](https://www.browserstack.com/app-automate/appium-python) - ## Installation ### Requirements -1. Python 3.5+ or Python 2.7+ (refer [python-2-master branch](https://github.com/browserstack/python-appium-app-browserstack/tree/python-2-master)) +1. Python 3.7+ or Python 2.7+ (refer [python-2-master branch](https://github.com/browserstack/python-appium-app-browserstack/tree/python-2-master)) - If Python is not installed, follow these instructions: - For Windows, download latest python version from [here](https://www.python.org/downloads/windows/) and run the installer exe - For Mac and Linux, run python --version to see what python version is pre-installed. If you want updated version download from [here](https://www.python.org/downloads/) -2. pip +2. Pip - If pip is not installed, follow these instructions: - Securely download get-pip.py by following this link: [get-pip.py](https://bootstrap.pypa.io/get-pip.py) or use following curl command: @@ -25,6 +21,8 @@ Refer [Getting Started using Appium with Python](https://www.browserstack.com/a curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py ``` + - After dowloading, run the file : + ```sh python get-pip.py ``` @@ -39,75 +37,27 @@ pip install -r android/requirements.txt or pip install -r ios/requirements.txt ## Getting Started -Getting Started with Python Appium tests on real BrowserStack devices couldn't be easier! - -### **Run first test in 3 simple steps :** - -1. #### Upload App - - - Upload your android app apk or iOS app ipa file, or upload one of the Browserstack’s sample app [WikipediaSampleAndroidApp](https://www.browserstack.com/app-automate/sample-apps/android/WikipediaSample.apk) | [BStackSampleiOSApp](https://www.browserstack.com/app-automate/sample-apps/ios/BStackSampleApp.ipa) - - Note: Update username and accesskey with BrowserStack credentials (Find your BrowserStack credentials [here](https://www.browserstack.com/accounts/settings)) - - ``` sh - curl -u "username:accesskey" -X POST "https://api.browserstack.com/app-automate/upload" -F "file=@/path/to/app/file/Application-debug.apk" - ``` - - - Copy the 'app_url' (bs://\) returned in the response and save it - -2. #### Configure and run tests - - - Open file android/BrowserStackAndroid.py to run android tests or ios/BrowserStackIOS.py to run iOS tests - - - Update BrowserStack credentials - userName & accessKey (Find your BrowserStack credentials [here](https://www.browserstack.com/accounts/settings)) - - - Update the desired_caps "app" capability with app_url (bs://\) received in upload app API response - - - If you have uploaded your app instead of BrowserStack sample app, update the tests accordingly - - - Run tests with following command - - ```sh - python android/BrowserStackAndroid.py or python ios/BrowserStackIOS.py - ``` - -3. #### Thats it! view your tests results on [BrowserStack App Automate dashboard](https://app-automate.browserstack.com/) - - Note: If you face any issues, refer [Getting Help section](#Getting-Help) - -### **Try BrowserStack Local Testing to test apps deployed on development or testing environment** - -1. #### Upload app - - - Upload your android app apk or iOS app ipa file, or upload one of the Browserstack’s sample app [LocalAndroidSample.apk](https://www.browserstack.com/app-automate/sample-apps/android/LocalSample.apk) | [LocaliOSSample.ipa](https://www.browserstack.com/app-automate/sample-apps/ios/LocalSample.ipa) - - Note: Update your BrowserStack credentials - username and accesskey (Find your BrowserStack credentials [here](https://www.browserstack.com/accounts/settings)) - - ``` sh - curl -u "username:accesskey" -X POST "https://api.browserstack.com/app-automate/upload" -F "file=@/path/to/app/file/Application-debug.apk" - ``` +Getting Started with Appium tests in Python on real BrowserStack devices couldn't be easier! - - Copy the 'app_url'(bs://\) returned in the response and save it +### **Run first test :** -2. #### Configure and run local tests +- Switch to 'run_first_test' directory under [android examples](android/examples/run_first_test) or [ios examples](ios/examples/run_first_test) - - Open file android/LocalSampleAndroid.py for android tests or ios/LocalSampleIOS.py for iOS tests +- Follow the steps outlined in the documentation [Getting Started with Appium in Python](https://www.browserstack.com/app-automate/appium-python) - - Update BrowserStack credentials - userName & accessKey (Find your BrowserStack credentials [here](https://www.browserstack.com/accounts/settings)) +### **Speed up test execution with parallel testing :** - - Update the desired_caps "app" capability with app_url (bs://\) received in upload app API response +- Switch to 'run_prarallel_tests' directory under [android examples](android/examples/run_parallel_tests) or [ios examples](ios/examples/run_parallel_tests) - - If you have uploaded your app instead of sample app, update the tests accordingly +- Follow the steps outlined in the documentation [Getting Started with Appium in Python](https://www.browserstack.com/app-automate/appium-python) - - Run tests with following command +### **Run Local tests for apps deployed in your development or testing environment :** - ```sh - python android/LocalSampleAndroid.py or python ios/LocalSampleIOS.py - ``` +- Switch to 'run_local_test' directory under [android examples](android/examples/run_local_test) or [ios examples](ios/examples/run_local_test) -3. #### Thats it! View your tests results on [BrowserStack App Automate dashboard](https://app-automate.browserstack.com/) +- Follow the steps outlined in the documentation [Getting Started with Appium in Python](https://www.browserstack.com/app-automate/appium-python) - Note: If you face any issues, refer [Getting Help section](#Getting-Help) +**Note**: If you face any issues, refer [Getting Help](#Getting-Help) ## Integration with other python frameworks From 61b0818345c566b2b6102ab64acdcadc6165e6f9 Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Thu, 16 Jul 2020 17:32:54 +0530 Subject: [PATCH 13/33] Updated directory names under examples, updated readme.md, support for Python2.7 --- README.md | 36 ++++++++++--------- .../config.json | 2 +- .../first_test.py | 0 .../config.json | 2 +- .../local_test.py | 0 .../config.json | 2 +- .../parallel_tests.py | 0 android/requirements.txt | 3 +- .../config.json | 2 +- .../first_test.py | 0 .../config.json | 2 +- .../local_test.py | 0 .../config.json | 2 +- .../parallel_test.py | 0 ios/requirements.txt | 4 ++- 15 files changed, 30 insertions(+), 25 deletions(-) rename android/examples/{run_first_test => run-first-test}/config.json (82%) rename android/examples/{run_first_test => run-first-test}/first_test.py (100%) rename android/examples/{run_local_test => run-local-test}/config.json (84%) rename android/examples/{run_local_test => run-local-test}/local_test.py (100%) rename android/examples/{run_parallel_tests => run-parallel-tests}/config.json (89%) rename android/examples/{run_parallel_tests => run-parallel-tests}/parallel_tests.py (100%) rename ios/examples/{run_first_test => run-first-test}/config.json (82%) rename ios/examples/{run_first_test => run-first-test}/first_test.py (100%) rename ios/examples/{run_local_test => run-local-test}/config.json (83%) rename ios/examples/{run_local_test => run-local-test}/local_test.py (100%) rename ios/examples/{run_parallel_tests => run-parallel-tests}/config.json (85%) rename ios/examples/{run_parallel_tests => run-parallel-tests}/parallel_test.py (100%) diff --git a/README.md b/README.md index 51d6a93..53fb012 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,21 @@ # python-appium-app-browserstack -This repository demonstrates how to run Appium Python mobile app tests on BrowserStack's real device cloud. +This repository demonstrates how to run Appium tests using Python on BrowserStack App Automate. -## Installation +## Setup ### Requirements -1. Python 3.7+ or Python 2.7+ (refer [python-2-master branch](https://github.com/browserstack/python-appium-app-browserstack/tree/python-2-master)) +1. Python 3.7+ or Python 2.7+ - If Python is not installed, follow these instructions: - - For Windows, download latest python version from [here](https://www.python.org/downloads/windows/) and run the installer exe - - For Mac and Linux, run python --version to see what python version is pre-installed. If you want updated version download from [here](https://www.python.org/downloads/) + - For Windows, download latest python version from [here](https://www.python.org/downloads/windows/) and run the installer executable + - For Mac and Linux, run `python --version` to see what python version is pre-installed. If you want a different version download from [here](https://www.python.org/downloads/) -2. Pip +2. Package Manager `pip` - - If pip is not installed, follow these instructions: - - Securely download get-pip.py by following this link: [get-pip.py](https://bootstrap.pypa.io/get-pip.py) or use following curl command: + - If `pip` is not installed, follow these instructions: + - Securely download get-pip.py by following this link: [get-pip.py](https://bootstrap.pypa.io/get-pip.py) or use following cURL command to download it: ```sh curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py @@ -24,15 +24,17 @@ This repository demonstrates how to run Appium Python mobile app tests on Browse - After dowloading, run the file : ```sh - python get-pip.py + python3(or python) get-pip.py ``` -### Dependencies + Note : `pip` comes installed with Python 2.7.9+ and python 3.4+ -- Depending on whether you are running android or iOS tests, run : +### Install the dependencies + +Depending on whether you are running Android or iOS tests, run : ```sh -pip install -r android/requirements.txt or pip install -r ios/requirements.txt +pip3(or pip) install -r android/requirements.txt or pip install -r ios/requirements.txt ``` ## Getting Started @@ -41,23 +43,23 @@ Getting Started with Appium tests in Python on real BrowserStack devices couldn' ### **Run first test :** -- Switch to 'run_first_test' directory under [android examples](android/examples/run_first_test) or [ios examples](ios/examples/run_first_test) +- Switch to `run-first-test` directory under [Android examples](android/examples/run-first-test) or [iOS examples](ios/examples/run-first-test) - Follow the steps outlined in the documentation [Getting Started with Appium in Python](https://www.browserstack.com/app-automate/appium-python) ### **Speed up test execution with parallel testing :** -- Switch to 'run_prarallel_tests' directory under [android examples](android/examples/run_parallel_tests) or [ios examples](ios/examples/run_parallel_tests) +- Switch to `run-prarallel-tests` directory under [Android examples](android/examples/run-parallel-tests) or [iOS examples](ios/examples/run-parallel-tests) - Follow the steps outlined in the documentation [Getting Started with Appium in Python](https://www.browserstack.com/app-automate/appium-python) -### **Run Local tests for apps deployed in your development or testing environment :** +### **Use Local testing for apps that access resources hosted in development or testing environments :** -- Switch to 'run_local_test' directory under [android examples](android/examples/run_local_test) or [ios examples](ios/examples/run_local_test) +- Switch to `run-local-test` directory under [Android examples](android/examples/run-local-test) or [iOS examples](ios/examples/run-local-test) - Follow the steps outlined in the documentation [Getting Started with Appium in Python](https://www.browserstack.com/app-automate/appium-python) -**Note**: If you face any issues, refer [Getting Help](#Getting-Help) +**Note**: If you face any issues, refer [Getting Help section](#Getting-Help) ## Integration with other python frameworks diff --git a/android/examples/run_first_test/config.json b/android/examples/run-first-test/config.json similarity index 82% rename from android/examples/run_first_test/config.json rename to android/examples/run-first-test/config.json index e6fe536..eebb25d 100644 --- a/android/examples/run_first_test/config.json +++ b/android/examples/run-first-test/config.json @@ -7,7 +7,7 @@ "build": "Python 3 Android", "name": "single_test", "browserstack.debug": true, - "app": "bs://", + "app": "bs://d318ec55142bf92b1fec9fce6904109294db6678", "device": "Google Pixel" } } \ No newline at end of file diff --git a/android/examples/run_first_test/first_test.py b/android/examples/run-first-test/first_test.py similarity index 100% rename from android/examples/run_first_test/first_test.py rename to android/examples/run-first-test/first_test.py diff --git a/android/examples/run_local_test/config.json b/android/examples/run-local-test/config.json similarity index 84% rename from android/examples/run_local_test/config.json rename to android/examples/run-local-test/config.json index 3b6851f..bfadf73 100644 --- a/android/examples/run_local_test/config.json +++ b/android/examples/run-local-test/config.json @@ -7,7 +7,7 @@ "build": "Python 3 Android Local", "name": "local_test", "browserstack.debug": true, - "app": "bs://", + "app": "bs://2628effb9a083f98a66db866cb4dbd2ee0311cbc", "device": "Samsung Galaxy S7", "browserstack.local": true } diff --git a/android/examples/run_local_test/local_test.py b/android/examples/run-local-test/local_test.py similarity index 100% rename from android/examples/run_local_test/local_test.py rename to android/examples/run-local-test/local_test.py diff --git a/android/examples/run_parallel_tests/config.json b/android/examples/run-parallel-tests/config.json similarity index 89% rename from android/examples/run_parallel_tests/config.json rename to android/examples/run-parallel-tests/config.json index 6c21b3c..e86994e 100644 --- a/android/examples/run_parallel_tests/config.json +++ b/android/examples/run-parallel-tests/config.json @@ -7,7 +7,7 @@ "build": "Python 3 Android Parallel", "name": "parallel_test", "browserstack.debug": true, - "app": "bs://" + "app": "bs://d318ec55142bf92b1fec9fce6904109294db6678" }, "environments": [{ diff --git a/android/examples/run_parallel_tests/parallel_tests.py b/android/examples/run-parallel-tests/parallel_tests.py similarity index 100% rename from android/examples/run_parallel_tests/parallel_tests.py rename to android/examples/run-parallel-tests/parallel_tests.py diff --git a/android/requirements.txt b/android/requirements.txt index 2aabad0..accdbc2 100644 --- a/android/requirements.txt +++ b/android/requirements.txt @@ -1,3 +1,4 @@ -Appium-Python-Client +Appium-Python-Client==0.52;python_version < '3.0' +Appium-Python-Client;python_version >= '3.0' browserstack-local selenium diff --git a/ios/examples/run_first_test/config.json b/ios/examples/run-first-test/config.json similarity index 82% rename from ios/examples/run_first_test/config.json rename to ios/examples/run-first-test/config.json index c92c66f..9a70472 100644 --- a/ios/examples/run_first_test/config.json +++ b/ios/examples/run-first-test/config.json @@ -7,7 +7,7 @@ "build": "Python 3 iOS", "name": "single_test", "browserstack.debug": true, - "app": "bs://", + "app": "bs://1e5f65dc1f0ebe44d78594f075324908e191f620", "device": "iPhone 7" } } \ No newline at end of file diff --git a/ios/examples/run_first_test/first_test.py b/ios/examples/run-first-test/first_test.py similarity index 100% rename from ios/examples/run_first_test/first_test.py rename to ios/examples/run-first-test/first_test.py diff --git a/ios/examples/run_local_test/config.json b/ios/examples/run-local-test/config.json similarity index 83% rename from ios/examples/run_local_test/config.json rename to ios/examples/run-local-test/config.json index 8590f07..011e0d8 100644 --- a/ios/examples/run_local_test/config.json +++ b/ios/examples/run-local-test/config.json @@ -7,7 +7,7 @@ "build": "Python 3 iOS Local", "name": "local_test", "browserstack.debug": true, - "app": "bs://", + "app": "bs://f88e466b82d604adffc3a065e483fabcb8ea9f38", "device": "iPhone 7", "browserstack.local": true } diff --git a/ios/examples/run_local_test/local_test.py b/ios/examples/run-local-test/local_test.py similarity index 100% rename from ios/examples/run_local_test/local_test.py rename to ios/examples/run-local-test/local_test.py diff --git a/ios/examples/run_parallel_tests/config.json b/ios/examples/run-parallel-tests/config.json similarity index 85% rename from ios/examples/run_parallel_tests/config.json rename to ios/examples/run-parallel-tests/config.json index 4458416..b636065 100644 --- a/ios/examples/run_parallel_tests/config.json +++ b/ios/examples/run-parallel-tests/config.json @@ -7,7 +7,7 @@ "build": "Python 3 iOS Parallel", "name": "parallel_test", "browserstack.debug": true, - "app": "bs://" + "app": "bs://1e5f65dc1f0ebe44d78594f075324908e191f620" }, "environments": [{ diff --git a/ios/examples/run_parallel_tests/parallel_test.py b/ios/examples/run-parallel-tests/parallel_test.py similarity index 100% rename from ios/examples/run_parallel_tests/parallel_test.py rename to ios/examples/run-parallel-tests/parallel_test.py diff --git a/ios/requirements.txt b/ios/requirements.txt index 2aabad0..1f7e0f6 100644 --- a/ios/requirements.txt +++ b/ios/requirements.txt @@ -1,3 +1,5 @@ -Appium-Python-Client +Appium-Python-Client==0.52;python_version < '3.0' +Appium-Python-Client;python_version >= '3.0' browserstack-local selenium + From f06861574e063771e4df2d19c8b66823a456371d Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Fri, 17 Jul 2020 02:08:08 +0530 Subject: [PATCH 14/33] Updating name of first test as "first_test" in config files --- android/examples/run-first-test/config.json | 2 +- ios/examples/run-first-test/config.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/android/examples/run-first-test/config.json b/android/examples/run-first-test/config.json index eebb25d..70569b4 100644 --- a/android/examples/run-first-test/config.json +++ b/android/examples/run-first-test/config.json @@ -5,7 +5,7 @@ "capabilities": { "project": "First Python Android Project", "build": "Python 3 Android", - "name": "single_test", + "name": "first_test", "browserstack.debug": true, "app": "bs://d318ec55142bf92b1fec9fce6904109294db6678", "device": "Google Pixel" diff --git a/ios/examples/run-first-test/config.json b/ios/examples/run-first-test/config.json index 9a70472..0e4c61d 100644 --- a/ios/examples/run-first-test/config.json +++ b/ios/examples/run-first-test/config.json @@ -5,7 +5,7 @@ "capabilities": { "project": "First Python iOS Project", "build": "Python 3 iOS", - "name": "single_test", + "name": "first_test", "browserstack.debug": true, "app": "bs://1e5f65dc1f0ebe44d78594f075324908e191f620", "device": "iPhone 7" From c9bb28f4655ce5413ae7efca42b5885cbf561177 Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Fri, 17 Jul 2020 12:53:37 +0530 Subject: [PATCH 15/33] Updated Readme to decouple instructions for installation of dependencies for Android and iOS --- README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 53fb012..ada0d54 100644 --- a/README.md +++ b/README.md @@ -31,10 +31,16 @@ This repository demonstrates how to run Appium tests using Python on BrowserStac ### Install the dependencies -Depending on whether you are running Android or iOS tests, run : +To install the dependencies for Android tests, run : ```sh -pip3(or pip) install -r android/requirements.txt or pip install -r ios/requirements.txt +pip3(or pip) install -r android/requirements.txt +``` + +To install the dependencies for iOS tests, run : + +```sh +pip3(or pip) install -r ios/requirements.txt ``` ## Getting Started From 0a709482dcff66b3a4b777694b5cd1f770f48134 Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Fri, 17 Jul 2020 17:32:22 +0530 Subject: [PATCH 16/33] Small typo fix in Github readme --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index ada0d54..45d5fdd 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,8 @@ To install the dependencies for Android tests, run : pip3(or pip) install -r android/requirements.txt ``` +Or, + To install the dependencies for iOS tests, run : ```sh From 27fa7ed876fb21827ef1f6712d077bed9b9cd82b Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Fri, 17 Jul 2020 20:28:33 +0530 Subject: [PATCH 17/33] Solving threading issue while running parallel tests and updated comments --- android/examples/run-first-test/config.json | 2 +- android/examples/run-first-test/first_test.py | 2 +- android/examples/run-local-test/config.json | 2 +- android/examples/run-local-test/local_test.py | 4 +--- android/examples/run-parallel-tests/config.json | 6 +++--- .../examples/run-parallel-tests/parallel_tests.py | 12 +++++++----- ios/examples/run-first-test/config.json | 4 ++-- ios/examples/run-first-test/first_test.py | 2 +- ios/examples/run-local-test/config.json | 2 +- ios/examples/run-local-test/local_test.py | 4 +--- ios/examples/run-parallel-tests/config.json | 4 ++-- ios/examples/run-parallel-tests/parallel_test.py | 9 ++++++--- 12 files changed, 27 insertions(+), 26 deletions(-) diff --git a/android/examples/run-first-test/config.json b/android/examples/run-first-test/config.json index 70569b4..bebb346 100644 --- a/android/examples/run-first-test/config.json +++ b/android/examples/run-first-test/config.json @@ -4,7 +4,7 @@ "capabilities": { "project": "First Python Android Project", - "build": "Python 3 Android", + "build": "Python Android", "name": "first_test", "browserstack.debug": true, "app": "bs://d318ec55142bf92b1fec9fce6904109294db6678", diff --git a/android/examples/run-first-test/first_test.py b/android/examples/run-first-test/first_test.py index f24963a..2bca9b6 100644 --- a/android/examples/run-first-test/first_test.py +++ b/android/examples/run-first-test/first_test.py @@ -6,7 +6,7 @@ import os, json config_file_path = os.path.join(os.path.dirname(__file__), "config.json") -print("Config file = %s" % (config_file_path)) +print("Config file path = %s" % (config_file_path)) with open(config_file_path) as config_file: CONFIG = json.load(config_file) diff --git a/android/examples/run-local-test/config.json b/android/examples/run-local-test/config.json index bfadf73..22ca5c7 100644 --- a/android/examples/run-local-test/config.json +++ b/android/examples/run-local-test/config.json @@ -4,7 +4,7 @@ "capabilities": { "project": "First Python Android Project", - "build": "Python 3 Android Local", + "build": "Python Android Local", "name": "local_test", "browserstack.debug": true, "app": "bs://2628effb9a083f98a66db866cb4dbd2ee0311cbc", diff --git a/android/examples/run-local-test/local_test.py b/android/examples/run-local-test/local_test.py index dfe91c6..e89585c 100644 --- a/android/examples/run-local-test/local_test.py +++ b/android/examples/run-local-test/local_test.py @@ -7,15 +7,13 @@ import os, json config_file_path = os.path.join(os.path.dirname(__file__), "config.json") -print("Config file = %s" % (config_file_path)) +print("Config file path = %s" % (config_file_path)) with open(config_file_path) as config_file: CONFIG = json.load(config_file) BROWSERSTACK_USERNAME = os.environ['BROWSERSTACK_USERNAME'] if 'BROWSERSTACK_USERNAME' in os.environ else CONFIG['username'] BROWSERSTACK_ACCESS_KEY = os.environ['BROWSERSTACK_ACCESS_KEY'] if 'BROWSERSTACK_ACCESS_KEY' in os.environ else CONFIG['access_key'] -bs_local = None - def start_local(): global bs_local bs_local = Local() diff --git a/android/examples/run-parallel-tests/config.json b/android/examples/run-parallel-tests/config.json index e86994e..7e7d1e3 100644 --- a/android/examples/run-parallel-tests/config.json +++ b/android/examples/run-parallel-tests/config.json @@ -1,10 +1,10 @@ { - "username":"BROWSERSTACK_USERNAME", - "access_key":"BROWSERSTACK_ACCESS_KEY", + "username":"neerajkumar42", + "access_key":"MXmmyxNzZTYmXyyA8xyB", "capabilities": { "project": "First Python Android Project", - "build": "Python 3 Android Parallel", + "build": "Python Android Parallel", "name": "parallel_test", "browserstack.debug": true, "app": "bs://d318ec55142bf92b1fec9fce6904109294db6678" diff --git a/android/examples/run-parallel-tests/parallel_tests.py b/android/examples/run-parallel-tests/parallel_tests.py index 4679fe9..97c9c6b 100644 --- a/android/examples/run-parallel-tests/parallel_tests.py +++ b/android/examples/run-parallel-tests/parallel_tests.py @@ -7,7 +7,7 @@ config_file_path = os.path.join(os.path.dirname(__file__), "config.json") -print("Config file = %s" % (config_file_path)) +print("Config file path = %s" % (config_file_path)) with open(config_file_path) as config_file: CONFIG = json.load(config_file) @@ -22,10 +22,9 @@ def test(device_index): desired_capabilities = CONFIG['capabilities'] desired_capabilities['device'] = CONFIG['environments'][device_index]['device'] - - + driver = webdriver.Remote( - desired_capabilities = desired_capabilities, + desired_capabilities = dict(desired_capabilities), command_executor = "http://%s:%s@hub-cloud.browserstack.com/wd/hub" % (BROWSERSTACK_USERNAME, BROWSERSTACK_ACCESS_KEY) ) @@ -55,4 +54,7 @@ def test(device_index): for i in range(4): p = threading.Thread(target=test,args=(i,)) jobs.append(p) - p.start() \ No newline at end of file + p.start() + + for thread in jobs: + thread.join() \ No newline at end of file diff --git a/ios/examples/run-first-test/config.json b/ios/examples/run-first-test/config.json index 0e4c61d..842c617 100644 --- a/ios/examples/run-first-test/config.json +++ b/ios/examples/run-first-test/config.json @@ -4,10 +4,10 @@ "capabilities": { "project": "First Python iOS Project", - "build": "Python 3 iOS", + "build": "Python iOS", "name": "first_test", "browserstack.debug": true, - "app": "bs://1e5f65dc1f0ebe44d78594f075324908e191f620", + "app": "bs://a2c4c0bd114ce9765af0988a632982cb42688b81", "device": "iPhone 7" } } \ No newline at end of file diff --git a/ios/examples/run-first-test/first_test.py b/ios/examples/run-first-test/first_test.py index 7c7e540..1ef0ea5 100644 --- a/ios/examples/run-first-test/first_test.py +++ b/ios/examples/run-first-test/first_test.py @@ -6,7 +6,7 @@ import os, json config_file_path = os.path.join(os.path.dirname(__file__), "config.json") -print("Config file = %s" % (config_file_path)) +print("Config file path= %s" % (config_file_path)) with open(config_file_path) as config_file: CONFIG = json.load(config_file) diff --git a/ios/examples/run-local-test/config.json b/ios/examples/run-local-test/config.json index 011e0d8..69eb70a 100644 --- a/ios/examples/run-local-test/config.json +++ b/ios/examples/run-local-test/config.json @@ -4,7 +4,7 @@ "capabilities": { "project": "First Python iOS Project", - "build": "Python 3 iOS Local", + "build": "Python iOS Local", "name": "local_test", "browserstack.debug": true, "app": "bs://f88e466b82d604adffc3a065e483fabcb8ea9f38", diff --git a/ios/examples/run-local-test/local_test.py b/ios/examples/run-local-test/local_test.py index 63b5a95..d1f2b3a 100644 --- a/ios/examples/run-local-test/local_test.py +++ b/ios/examples/run-local-test/local_test.py @@ -7,15 +7,13 @@ import os, json config_file_path = os.path.join(os.path.dirname(__file__), "config.json") -print("Config file = %s" % (config_file_path)) +print("Config file path = %s" % (config_file_path)) with open(config_file_path) as config_file: CONFIG = json.load(config_file) BROWSERSTACK_USERNAME = os.environ['BROWSERSTACK_USERNAME'] if 'BROWSERSTACK_USERNAME' in os.environ else CONFIG['username'] BROWSERSTACK_ACCESS_KEY = os.environ['BROWSERSTACK_ACCESS_KEY'] if 'BROWSERSTACK_ACCESS_KEY' in os.environ else CONFIG['access_key'] -bs_local = None - def start_local(): global bs_local bs_local = Local() diff --git a/ios/examples/run-parallel-tests/config.json b/ios/examples/run-parallel-tests/config.json index b636065..e3af16e 100644 --- a/ios/examples/run-parallel-tests/config.json +++ b/ios/examples/run-parallel-tests/config.json @@ -4,10 +4,10 @@ "capabilities": { "project": "First Python iOS Project", - "build": "Python 3 iOS Parallel", + "build": "Python iOS Parallel", "name": "parallel_test", "browserstack.debug": true, - "app": "bs://1e5f65dc1f0ebe44d78594f075324908e191f620" + "app": "bs://a2c4c0bd114ce9765af0988a632982cb42688b81" }, "environments": [{ diff --git a/ios/examples/run-parallel-tests/parallel_test.py b/ios/examples/run-parallel-tests/parallel_test.py index fa37893..5ab1ffe 100644 --- a/ios/examples/run-parallel-tests/parallel_test.py +++ b/ios/examples/run-parallel-tests/parallel_test.py @@ -7,7 +7,7 @@ config_file_path = os.path.join(os.path.dirname(__file__), "config.json") -print("Config file = %s" % (config_file_path)) +print("Config file path= %s" % (config_file_path)) with open(config_file_path) as config_file: CONFIG = json.load(config_file) @@ -25,7 +25,7 @@ def test(device_index): driver = webdriver.Remote( - desired_capabilities = desired_capabilities, + desired_capabilities = dict(desired_capabilities), command_executor = "http://%s:%s@hub-cloud.browserstack.com/wd/hub" % (BROWSERSTACK_USERNAME, BROWSERSTACK_ACCESS_KEY) ) @@ -59,4 +59,7 @@ def test(device_index): for i in range(2): p = threading.Thread(target=test,args=(i,)) jobs.append(p) - p.start() \ No newline at end of file + p.start() + + for thread in jobs: + thread.join() \ No newline at end of file From a4899f640f937f65ce057735fd0a3d26feb12536 Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Fri, 17 Jul 2020 20:35:38 +0530 Subject: [PATCH 18/33] Update Github readme content and links to new documentation --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 45d5fdd..55f8691 100644 --- a/README.md +++ b/README.md @@ -53,19 +53,19 @@ Getting Started with Appium tests in Python on real BrowserStack devices couldn' - Switch to `run-first-test` directory under [Android examples](android/examples/run-first-test) or [iOS examples](ios/examples/run-first-test) -- Follow the steps outlined in the documentation [Getting Started with Appium in Python](https://www.browserstack.com/app-automate/appium-python) +- Follow the steps outlined in the documentation [Getting Started with your first test on App Automate](https://www.browserstack.com/docs/app-automate/appium/getting-started/python) ### **Speed up test execution with parallel testing :** - Switch to `run-prarallel-tests` directory under [Android examples](android/examples/run-parallel-tests) or [iOS examples](ios/examples/run-parallel-tests) -- Follow the steps outlined in the documentation [Getting Started with Appium in Python](https://www.browserstack.com/app-automate/appium-python) +- Follow the steps outlined in the documentation [Getting Started with Parallel testing on App Automate](https://www.browserstack.com/docs/app-automate/appium/getting-started/python/parallelize-tests) ### **Use Local testing for apps that access resources hosted in development or testing environments :** - Switch to `run-local-test` directory under [Android examples](android/examples/run-local-test) or [iOS examples](ios/examples/run-local-test) -- Follow the steps outlined in the documentation [Getting Started with Appium in Python](https://www.browserstack.com/app-automate/appium-python) +- Follow the steps outlined in the documentation [Getting Started with Local testing on App Automate](https://www.browserstack.com/docs/app-automate/appium/getting-started/python/local-testing) **Note**: If you face any issues, refer [Getting Help section](#Getting-Help) From c570250c7a987d1071d040ce5542a207f0569750 Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Sat, 18 Jul 2020 01:17:10 +0530 Subject: [PATCH 19/33] Updating readme with minimum Python supported version as Python 3.6 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 55f8691..f257150 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ This repository demonstrates how to run Appium tests using Python on BrowserStac ### Requirements -1. Python 3.7+ or Python 2.7+ +1. Python 3.6+ or Python 2.7+ - If Python is not installed, follow these instructions: - For Windows, download latest python version from [here](https://www.python.org/downloads/windows/) and run the installer executable From 5109ccd6d199be9b85765905f2e54cddbf11cd35 Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Sat, 18 Jul 2020 03:27:16 +0530 Subject: [PATCH 20/33] Added note about pip coming pre-installed in some Python versions in Readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f257150..52e4dcf 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,8 @@ This repository demonstrates how to run Appium tests using Python on BrowserStac 2. Package Manager `pip` + Note : `pip` comes installed with Python 2.7.9+ and python 3.4+ + - If `pip` is not installed, follow these instructions: - Securely download get-pip.py by following this link: [get-pip.py](https://bootstrap.pypa.io/get-pip.py) or use following cURL command to download it: @@ -27,8 +29,6 @@ This repository demonstrates how to run Appium tests using Python on BrowserStac python3(or python) get-pip.py ``` - Note : `pip` comes installed with Python 2.7.9+ and python 3.4+ - ### Install the dependencies To install the dependencies for Android tests, run : From 8ed2769769cdc721498102939ba6443e8ee9526c Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Sat, 18 Jul 2020 15:07:03 +0530 Subject: [PATCH 21/33] Adding app URL placeholder test in config files --- android/examples/run-first-test/config.json | 2 +- android/examples/run-local-test/config.json | 2 +- android/examples/run-parallel-tests/config.json | 2 +- ios/examples/run-first-test/config.json | 2 +- ios/examples/run-local-test/config.json | 2 +- ios/examples/run-parallel-tests/config.json | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/android/examples/run-first-test/config.json b/android/examples/run-first-test/config.json index bebb346..57f15a6 100644 --- a/android/examples/run-first-test/config.json +++ b/android/examples/run-first-test/config.json @@ -7,7 +7,7 @@ "build": "Python Android", "name": "first_test", "browserstack.debug": true, - "app": "bs://d318ec55142bf92b1fec9fce6904109294db6678", + "app": "bs://", "device": "Google Pixel" } } \ No newline at end of file diff --git a/android/examples/run-local-test/config.json b/android/examples/run-local-test/config.json index 22ca5c7..916acad 100644 --- a/android/examples/run-local-test/config.json +++ b/android/examples/run-local-test/config.json @@ -7,7 +7,7 @@ "build": "Python Android Local", "name": "local_test", "browserstack.debug": true, - "app": "bs://2628effb9a083f98a66db866cb4dbd2ee0311cbc", + "app": "bs://", "device": "Samsung Galaxy S7", "browserstack.local": true } diff --git a/android/examples/run-parallel-tests/config.json b/android/examples/run-parallel-tests/config.json index 7e7d1e3..1394a05 100644 --- a/android/examples/run-parallel-tests/config.json +++ b/android/examples/run-parallel-tests/config.json @@ -7,7 +7,7 @@ "build": "Python Android Parallel", "name": "parallel_test", "browserstack.debug": true, - "app": "bs://d318ec55142bf92b1fec9fce6904109294db6678" + "app": "bs://" }, "environments": [{ diff --git a/ios/examples/run-first-test/config.json b/ios/examples/run-first-test/config.json index 842c617..76d05d5 100644 --- a/ios/examples/run-first-test/config.json +++ b/ios/examples/run-first-test/config.json @@ -7,7 +7,7 @@ "build": "Python iOS", "name": "first_test", "browserstack.debug": true, - "app": "bs://a2c4c0bd114ce9765af0988a632982cb42688b81", + "app": "bs://", "device": "iPhone 7" } } \ No newline at end of file diff --git a/ios/examples/run-local-test/config.json b/ios/examples/run-local-test/config.json index 69eb70a..72a91d0 100644 --- a/ios/examples/run-local-test/config.json +++ b/ios/examples/run-local-test/config.json @@ -7,7 +7,7 @@ "build": "Python iOS Local", "name": "local_test", "browserstack.debug": true, - "app": "bs://f88e466b82d604adffc3a065e483fabcb8ea9f38", + "app": "bs://", "device": "iPhone 7", "browserstack.local": true } diff --git a/ios/examples/run-parallel-tests/config.json b/ios/examples/run-parallel-tests/config.json index e3af16e..d5fa207 100644 --- a/ios/examples/run-parallel-tests/config.json +++ b/ios/examples/run-parallel-tests/config.json @@ -7,7 +7,7 @@ "build": "Python iOS Parallel", "name": "parallel_test", "browserstack.debug": true, - "app": "bs://a2c4c0bd114ce9765af0988a632982cb42688b81" + "app": "bs://" }, "environments": [{ From c85e0c4491371e3db89cc95735398e5cdfd31aa4 Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Sat, 18 Jul 2020 16:11:44 +0530 Subject: [PATCH 22/33] Adding placeholders for App URL in Android parallel testing config file --- android/examples/run-parallel-tests/config.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/android/examples/run-parallel-tests/config.json b/android/examples/run-parallel-tests/config.json index 1394a05..81eabd9 100644 --- a/android/examples/run-parallel-tests/config.json +++ b/android/examples/run-parallel-tests/config.json @@ -1,6 +1,6 @@ { - "username":"neerajkumar42", - "access_key":"MXmmyxNzZTYmXyyA8xyB", + "username":"BROWSERSTACK_USERNAME", + "access_key":"BROWSERSTACK_ACCESS_KEY", "capabilities": { "project": "First Python Android Project", From e8733a2d043ce01d5ecbf1ce933aff1872523c33 Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Mon, 20 Jul 2020 11:08:39 +0530 Subject: [PATCH 23/33] Updated developer documentation URL in Readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 52e4dcf..3249bdd 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ For other Python frameworks samples, refer to following repositories : - [Behave](https://github.com/browserstack/behave-appium-app-browserstack) - [Lettuce](https://github.com/browserstack/lettuce-appium-app-browserstack) -Note: For other test frameworks supported by App-Automate refer [App-Automate testing frameworks documentation](https://www.browserstack.com/docs?product=app-automate) +Note: For other test frameworks supported by App-Automate refer our [Developer documentation](https://www.browserstack.com/docs/) ## Getting Help From ee928062dafb4b00649dbb82db9222aede7f2f89 Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Tue, 21 Jul 2020 12:18:38 +0530 Subject: [PATCH 24/33] Decoupling python3 and python2 installation commands --- README.md | 43 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 3249bdd..49c4e55 100644 --- a/README.md +++ b/README.md @@ -25,25 +25,50 @@ This repository demonstrates how to run Appium tests using Python on BrowserStac - After dowloading, run the file : - ```sh - python3(or python) get-pip.py - ``` + - For Python 3 + + ```sh + python3 get-pip.py + ``` + + - For Python 2 + + ```sh + python2 get-pip.py + ``` ### Install the dependencies To install the dependencies for Android tests, run : -```sh -pip3(or pip) install -r android/requirements.txt -``` +- For Python 3 + + ```sh + pip3 install -r android/requirements.txt + ``` + +- For Python 2 + + ```sh + pip2 install -r android/requirements.txt + ``` Or, To install the dependencies for iOS tests, run : -```sh -pip3(or pip) install -r ios/requirements.txt -``` +- For Python 3 + + ```sh + pip3 install -r ios/requirements.txt + ``` + +- For Python 2 + + ```sh + pip2 install -r ios/requirements.txt + ``` + ## Getting Started From 8a2ea09ce518ad7a4955bc992c0e4636dadf4983 Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Wed, 5 Aug 2020 10:54:40 +0530 Subject: [PATCH 25/33] Updated print statement Co-authored-by: Rishav Kumar --- android/examples/run-first-test/first_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/android/examples/run-first-test/first_test.py b/android/examples/run-first-test/first_test.py index 2bca9b6..720b00b 100644 --- a/android/examples/run-first-test/first_test.py +++ b/android/examples/run-first-test/first_test.py @@ -6,7 +6,7 @@ import os, json config_file_path = os.path.join(os.path.dirname(__file__), "config.json") -print("Config file path = %s" % (config_file_path)) +print("Config file path: %s" % (config_file_path)) with open(config_file_path) as config_file: CONFIG = json.load(config_file) @@ -48,4 +48,4 @@ def test(): if __name__ == "__main__": - test() \ No newline at end of file + test() From 3a769f332c9a34d152d03687d52c8ae7d9d4b6f7 Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Wed, 5 Aug 2020 10:56:51 +0530 Subject: [PATCH 26/33] Updated print statement Co-authored-by: Rishav Kumar --- android/examples/run-parallel-tests/parallel_tests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/android/examples/run-parallel-tests/parallel_tests.py b/android/examples/run-parallel-tests/parallel_tests.py index 97c9c6b..4ce312d 100644 --- a/android/examples/run-parallel-tests/parallel_tests.py +++ b/android/examples/run-parallel-tests/parallel_tests.py @@ -7,7 +7,7 @@ config_file_path = os.path.join(os.path.dirname(__file__), "config.json") -print("Config file path = %s" % (config_file_path)) +print("Config file path: %s" % (config_file_path)) with open(config_file_path) as config_file: CONFIG = json.load(config_file) @@ -57,4 +57,4 @@ def test(device_index): p.start() for thread in jobs: - thread.join() \ No newline at end of file + thread.join() From f8b7ae6b327b7d8650d214bde564da2635be8063 Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Wed, 5 Aug 2020 10:57:53 +0530 Subject: [PATCH 27/33] Updated print statement Co-authored-by: Rishav Kumar --- android/examples/run-local-test/local_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/android/examples/run-local-test/local_test.py b/android/examples/run-local-test/local_test.py index e89585c..0dadd23 100644 --- a/android/examples/run-local-test/local_test.py +++ b/android/examples/run-local-test/local_test.py @@ -7,7 +7,7 @@ import os, json config_file_path = os.path.join(os.path.dirname(__file__), "config.json") -print("Config file path = %s" % (config_file_path)) +print("Config file path: %s" % (config_file_path)) with open(config_file_path) as config_file: CONFIG = json.load(config_file) @@ -67,4 +67,4 @@ def test(): if __name__ == "__main__": - test() \ No newline at end of file + test() From f3993bd1946ca01a20e314ee0356d2a5c26753f0 Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Wed, 5 Aug 2020 10:58:27 +0530 Subject: [PATCH 28/33] Updated print statement Co-authored-by: Rishav Kumar --- ios/examples/run-local-test/local_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ios/examples/run-local-test/local_test.py b/ios/examples/run-local-test/local_test.py index d1f2b3a..53ed2f9 100644 --- a/ios/examples/run-local-test/local_test.py +++ b/ios/examples/run-local-test/local_test.py @@ -7,7 +7,7 @@ import os, json config_file_path = os.path.join(os.path.dirname(__file__), "config.json") -print("Config file path = %s" % (config_file_path)) +print("Config file path: %s" % (config_file_path)) with open(config_file_path) as config_file: CONFIG = json.load(config_file) @@ -66,4 +66,4 @@ def test(): if __name__ == "__main__": - test() \ No newline at end of file + test() From 241d1742bcacdba996bffe15c66130c06ef57089 Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Wed, 5 Aug 2020 10:58:56 +0530 Subject: [PATCH 29/33] Updated print statement Co-authored-by: Rishav Kumar --- ios/examples/run-parallel-tests/parallel_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ios/examples/run-parallel-tests/parallel_test.py b/ios/examples/run-parallel-tests/parallel_test.py index 5ab1ffe..15f5916 100644 --- a/ios/examples/run-parallel-tests/parallel_test.py +++ b/ios/examples/run-parallel-tests/parallel_test.py @@ -7,7 +7,7 @@ config_file_path = os.path.join(os.path.dirname(__file__), "config.json") -print("Config file path= %s" % (config_file_path)) +print("Config file path: %s" % (config_file_path)) with open(config_file_path) as config_file: CONFIG = json.load(config_file) @@ -62,4 +62,4 @@ def test(device_index): p.start() for thread in jobs: - thread.join() \ No newline at end of file + thread.join() From 50c85bc918253183ed45210040fe499643e51ab9 Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Wed, 5 Aug 2020 12:13:38 +0530 Subject: [PATCH 30/33] Adding new line to search input Co-authored-by: Rishav Kumar --- android/examples/run-parallel-tests/parallel_tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/examples/run-parallel-tests/parallel_tests.py b/android/examples/run-parallel-tests/parallel_tests.py index 4ce312d..c6f9d17 100644 --- a/android/examples/run-parallel-tests/parallel_tests.py +++ b/android/examples/run-parallel-tests/parallel_tests.py @@ -38,7 +38,7 @@ def test(device_index): EC.element_to_be_clickable((MobileBy.ID, "org.wikipedia.alpha:id/search_src_text")) ) - search_input.send_keys("BrowserStack") + search_input.send_keys("BrowserStack" + "\n") time.sleep(5) From 5e7dfba48b09f6acf85708cefedd320e404fd6bb Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Wed, 5 Aug 2020 12:14:08 +0530 Subject: [PATCH 31/33] Adding new line to search input Co-authored-by: Rishav Kumar --- android/examples/run-first-test/first_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/examples/run-first-test/first_test.py b/android/examples/run-first-test/first_test.py index 720b00b..6f6d89b 100644 --- a/android/examples/run-first-test/first_test.py +++ b/android/examples/run-first-test/first_test.py @@ -36,7 +36,7 @@ def test(): EC.element_to_be_clickable((MobileBy.ID, "org.wikipedia.alpha:id/search_src_text")) ) - search_input.send_keys("BrowserStack") + search_input.send_keys("BrowserStack" + "\n") time.sleep(5) From 0e6ba9b6734e73d1fa16d6181e594127dd678c88 Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Wed, 5 Aug 2020 12:15:02 +0530 Subject: [PATCH 32/33] Resolving PR comments --- android/examples/run-first-test/config.json | 8 +++++--- android/examples/run-first-test/first_test.py | 3 ++- android/examples/run-local-test/config.json | 5 +++-- android/examples/run-local-test/local_test.py | 2 +- android/examples/run-parallel-tests/config.json | 15 +++++---------- .../examples/run-parallel-tests/parallel_tests.py | 11 ++++++----- android/requirements.txt | 6 +++--- ios/examples/run-first-test/config.json | 5 +++-- ios/examples/run-first-test/first_test.py | 4 ++-- ios/examples/run-local-test/config.json | 5 +++-- ios/examples/run-local-test/local_test.py | 2 +- ios/examples/run-parallel-tests/config.json | 9 +++++---- ios/examples/run-parallel-tests/parallel_test.py | 10 +++++----- ios/requirements.txt | 7 +++---- 14 files changed, 47 insertions(+), 45 deletions(-) diff --git a/android/examples/run-first-test/config.json b/android/examples/run-first-test/config.json index 57f15a6..685e02f 100644 --- a/android/examples/run-first-test/config.json +++ b/android/examples/run-first-test/config.json @@ -1,4 +1,5 @@ { + "server": "hub-cloud.browserstack.com", "username":"BROWSERSTACK_USERNAME", "access_key":"BROWSERSTACK_ACCESS_KEY", @@ -7,7 +8,8 @@ "build": "Python Android", "name": "first_test", "browserstack.debug": true, - "app": "bs://", - "device": "Google Pixel" + "app": "bs://d318ec55142bf92b1fec9fce6904109294db6678", + "device": "Google Pixel 3", + "os_version": "9.0" } -} \ No newline at end of file +} diff --git a/android/examples/run-first-test/first_test.py b/android/examples/run-first-test/first_test.py index 720b00b..67dad0c 100644 --- a/android/examples/run-first-test/first_test.py +++ b/android/examples/run-first-test/first_test.py @@ -6,7 +6,7 @@ import os, json config_file_path = os.path.join(os.path.dirname(__file__), "config.json") -print("Config file path: %s" % (config_file_path)) +print("Path to the config file: %s" % (config_file_path)) with open(config_file_path) as config_file: CONFIG = json.load(config_file) @@ -49,3 +49,4 @@ def test(): if __name__ == "__main__": test() + diff --git a/android/examples/run-local-test/config.json b/android/examples/run-local-test/config.json index 916acad..d660e2d 100644 --- a/android/examples/run-local-test/config.json +++ b/android/examples/run-local-test/config.json @@ -8,7 +8,8 @@ "name": "local_test", "browserstack.debug": true, "app": "bs://", - "device": "Samsung Galaxy S7", + "device": "Google Pixel 3", + "os_version": "9.0", "browserstack.local": true } -} \ No newline at end of file +} diff --git a/android/examples/run-local-test/local_test.py b/android/examples/run-local-test/local_test.py index 0dadd23..3e6b1ad 100644 --- a/android/examples/run-local-test/local_test.py +++ b/android/examples/run-local-test/local_test.py @@ -7,7 +7,7 @@ import os, json config_file_path = os.path.join(os.path.dirname(__file__), "config.json") -print("Config file path: %s" % (config_file_path)) +print("Path to the config file: %s" % (config_file_path)) with open(config_file_path) as config_file: CONFIG = json.load(config_file) diff --git a/android/examples/run-parallel-tests/config.json b/android/examples/run-parallel-tests/config.json index 81eabd9..d133d63 100644 --- a/android/examples/run-parallel-tests/config.json +++ b/android/examples/run-parallel-tests/config.json @@ -11,16 +11,11 @@ }, "environments": [{ - "device": "Samsung Galaxy S8" + "device": "Google Pixel 3", + "os_version": "9.0" }, { - "device": "Samsung Galaxy S7" - }, - { - "device": "Google Nexus 5" - }, - { - "device": "Google Pixel" + "device": "Samsung Galaxy S10e", + "os_version": "9.0" }] - -} \ No newline at end of file +} diff --git a/android/examples/run-parallel-tests/parallel_tests.py b/android/examples/run-parallel-tests/parallel_tests.py index 4ce312d..2f0d33f 100644 --- a/android/examples/run-parallel-tests/parallel_tests.py +++ b/android/examples/run-parallel-tests/parallel_tests.py @@ -7,7 +7,7 @@ config_file_path = os.path.join(os.path.dirname(__file__), "config.json") -print("Config file path: %s" % (config_file_path)) +print("Path to the config file: %s" % (config_file_path)) with open(config_file_path) as config_file: CONFIG = json.load(config_file) @@ -51,10 +51,11 @@ def test(device_index): if __name__ == "__main__": jobs = [] - for i in range(4): - p = threading.Thread(target=test,args=(i,)) - jobs.append(p) - p.start() + for index in range(2): + thread = threading.Thread(target=test,args=(index,)) + jobs.append(thread) + thread.start() for thread in jobs: thread.join() + diff --git a/android/requirements.txt b/android/requirements.txt index accdbc2..7becfd4 100644 --- a/android/requirements.txt +++ b/android/requirements.txt @@ -1,4 +1,4 @@ Appium-Python-Client==0.52;python_version < '3.0' -Appium-Python-Client;python_version >= '3.0' -browserstack-local -selenium +Appium-Python-Client==1.0.2;python_version >= '3.0' +browserstack-local==1.2.2 +selenium==3.14.0 diff --git a/ios/examples/run-first-test/config.json b/ios/examples/run-first-test/config.json index 76d05d5..4283be8 100644 --- a/ios/examples/run-first-test/config.json +++ b/ios/examples/run-first-test/config.json @@ -8,6 +8,7 @@ "name": "first_test", "browserstack.debug": true, "app": "bs://", - "device": "iPhone 7" + "device": "iPhone 11 Pro", + "os_version": "13" } -} \ No newline at end of file +} diff --git a/ios/examples/run-first-test/first_test.py b/ios/examples/run-first-test/first_test.py index 1ef0ea5..07c42e1 100644 --- a/ios/examples/run-first-test/first_test.py +++ b/ios/examples/run-first-test/first_test.py @@ -6,7 +6,7 @@ import os, json config_file_path = os.path.join(os.path.dirname(__file__), "config.json") -print("Config file path= %s" % (config_file_path)) +print("Path to the config file: %s" % (config_file_path)) with open(config_file_path) as config_file: CONFIG = json.load(config_file) @@ -52,4 +52,4 @@ def test(): if __name__ == "__main__": - test() \ No newline at end of file + test() diff --git a/ios/examples/run-local-test/config.json b/ios/examples/run-local-test/config.json index 72a91d0..bef191e 100644 --- a/ios/examples/run-local-test/config.json +++ b/ios/examples/run-local-test/config.json @@ -8,7 +8,8 @@ "name": "local_test", "browserstack.debug": true, "app": "bs://", - "device": "iPhone 7", + "device": "iPhone 11 Pro", + "os_version": "13", "browserstack.local": true } -} \ No newline at end of file +} diff --git a/ios/examples/run-local-test/local_test.py b/ios/examples/run-local-test/local_test.py index 53ed2f9..f88203f 100644 --- a/ios/examples/run-local-test/local_test.py +++ b/ios/examples/run-local-test/local_test.py @@ -7,7 +7,7 @@ import os, json config_file_path = os.path.join(os.path.dirname(__file__), "config.json") -print("Config file path: %s" % (config_file_path)) +print("Path to the config file: %s" % (config_file_path)) with open(config_file_path) as config_file: CONFIG = json.load(config_file) diff --git a/ios/examples/run-parallel-tests/config.json b/ios/examples/run-parallel-tests/config.json index d5fa207..7d5db10 100644 --- a/ios/examples/run-parallel-tests/config.json +++ b/ios/examples/run-parallel-tests/config.json @@ -11,9 +11,10 @@ }, "environments": [{ - "device": "iPhone 7" + "device": "iPhone 11 Pro", + "os_version": "13" }, { - "device": "iPhone 7 Plus" + "device": "iPhone 11 Pro Max", + "os_version": "13" }] - -} \ No newline at end of file +} diff --git a/ios/examples/run-parallel-tests/parallel_test.py b/ios/examples/run-parallel-tests/parallel_test.py index 15f5916..6137a6c 100644 --- a/ios/examples/run-parallel-tests/parallel_test.py +++ b/ios/examples/run-parallel-tests/parallel_test.py @@ -7,7 +7,7 @@ config_file_path = os.path.join(os.path.dirname(__file__), "config.json") -print("Config file path: %s" % (config_file_path)) +print("Path to the config file: %s" % (config_file_path)) with open(config_file_path) as config_file: CONFIG = json.load(config_file) @@ -56,10 +56,10 @@ def test(device_index): if __name__ == "__main__": jobs = [] - for i in range(2): - p = threading.Thread(target=test,args=(i,)) - jobs.append(p) - p.start() + for index in range(2): + thread = threading.Thread(target=test,args=(index,)) + jobs.append(thread) + thread.start() for thread in jobs: thread.join() diff --git a/ios/requirements.txt b/ios/requirements.txt index 1f7e0f6..7becfd4 100644 --- a/ios/requirements.txt +++ b/ios/requirements.txt @@ -1,5 +1,4 @@ Appium-Python-Client==0.52;python_version < '3.0' -Appium-Python-Client;python_version >= '3.0' -browserstack-local -selenium - +Appium-Python-Client==1.0.2;python_version >= '3.0' +browserstack-local==1.2.2 +selenium==3.14.0 From 062861bff60f15b1f4f8a42abf54b42ed475c0c9 Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Date: Wed, 5 Aug 2020 14:28:43 +0530 Subject: [PATCH 33/33] Added specific versions for dependencies, updated config files --- android/examples/run-first-test/config.json | 2 +- android/examples/run-first-test/first_test.py | 2 +- android/examples/run-local-test/config.json | 1 + android/examples/run-local-test/local_test.py | 2 +- android/examples/run-parallel-tests/config.json | 1 + android/examples/run-parallel-tests/parallel_tests.py | 5 ++--- ios/examples/run-first-test/config.json | 1 + ios/examples/run-first-test/first_test.py | 2 +- ios/examples/run-local-test/config.json | 1 + ios/examples/run-local-test/local_test.py | 2 +- ios/examples/run-parallel-tests/config.json | 1 + ios/examples/run-parallel-tests/parallel_test.py | 2 +- 12 files changed, 13 insertions(+), 9 deletions(-) diff --git a/android/examples/run-first-test/config.json b/android/examples/run-first-test/config.json index 685e02f..1ed5a60 100644 --- a/android/examples/run-first-test/config.json +++ b/android/examples/run-first-test/config.json @@ -8,7 +8,7 @@ "build": "Python Android", "name": "first_test", "browserstack.debug": true, - "app": "bs://d318ec55142bf92b1fec9fce6904109294db6678", + "app": "bs://", "device": "Google Pixel 3", "os_version": "9.0" } diff --git a/android/examples/run-first-test/first_test.py b/android/examples/run-first-test/first_test.py index 337ddec..ef2e0dd 100644 --- a/android/examples/run-first-test/first_test.py +++ b/android/examples/run-first-test/first_test.py @@ -23,7 +23,7 @@ def test(): driver = webdriver.Remote( desired_capabilities = desired_capabilities, - command_executor = "http://%s:%s@hub-cloud.browserstack.com/wd/hub" % (BROWSERSTACK_USERNAME, BROWSERSTACK_ACCESS_KEY) + command_executor = "http://%s:%s@%s/wd/hub" % (BROWSERSTACK_USERNAME, BROWSERSTACK_ACCESS_KEY, CONFIG['server']) ) search_element = WebDriverWait(driver, 30).until ( diff --git a/android/examples/run-local-test/config.json b/android/examples/run-local-test/config.json index d660e2d..f370371 100644 --- a/android/examples/run-local-test/config.json +++ b/android/examples/run-local-test/config.json @@ -1,4 +1,5 @@ { + "server": "hub-cloud.browserstack.com", "username":"BROWSERSTACK_USERNAME", "access_key":"BROWSERSTACK_ACCESS_KEY", diff --git a/android/examples/run-local-test/local_test.py b/android/examples/run-local-test/local_test.py index 3e6b1ad..7a05e5a 100644 --- a/android/examples/run-local-test/local_test.py +++ b/android/examples/run-local-test/local_test.py @@ -36,7 +36,7 @@ def test(): driver = webdriver.Remote( desired_capabilities = desired_capabilities, - command_executor = "http://%s:%s@hub-cloud.browserstack.com/wd/hub" % (BROWSERSTACK_USERNAME, BROWSERSTACK_ACCESS_KEY) + command_executor = "http://%s:%s@%s/wd/hub" % (BROWSERSTACK_USERNAME, BROWSERSTACK_ACCESS_KEY, CONFIG['server']) ) test_button = WebDriverWait(driver, 30).until( diff --git a/android/examples/run-parallel-tests/config.json b/android/examples/run-parallel-tests/config.json index d133d63..b26fa16 100644 --- a/android/examples/run-parallel-tests/config.json +++ b/android/examples/run-parallel-tests/config.json @@ -1,4 +1,5 @@ { + "server": "hub-cloud.browserstack.com", "username":"BROWSERSTACK_USERNAME", "access_key":"BROWSERSTACK_ACCESS_KEY", diff --git a/android/examples/run-parallel-tests/parallel_tests.py b/android/examples/run-parallel-tests/parallel_tests.py index 44e5d59..327131d 100644 --- a/android/examples/run-parallel-tests/parallel_tests.py +++ b/android/examples/run-parallel-tests/parallel_tests.py @@ -25,7 +25,7 @@ def test(device_index): driver = webdriver.Remote( desired_capabilities = dict(desired_capabilities), - command_executor = "http://%s:%s@hub-cloud.browserstack.com/wd/hub" % (BROWSERSTACK_USERNAME, BROWSERSTACK_ACCESS_KEY) + command_executor = "http://%s:%s@%s/wd/hub" % (BROWSERSTACK_USERNAME, BROWSERSTACK_ACCESS_KEY, CONFIG['server']) ) search_element = WebDriverWait(driver, 30).until ( @@ -37,8 +37,7 @@ def test(device_index): search_input = WebDriverWait(driver, 30).until ( EC.element_to_be_clickable((MobileBy.ID, "org.wikipedia.alpha:id/search_src_text")) ) - - search_input.send_keys("BrowserStack" + "\n") + search_input.send_keys("BrowserStack" + "\n") time.sleep(5) diff --git a/ios/examples/run-first-test/config.json b/ios/examples/run-first-test/config.json index 4283be8..f651a6e 100644 --- a/ios/examples/run-first-test/config.json +++ b/ios/examples/run-first-test/config.json @@ -1,4 +1,5 @@ { + "server": "hub-cloud.browserstack.com", "username":"BROWSERSTACK_USERNAME", "access_key":"BROWSERSTACK_ACCESS_KEY", diff --git a/ios/examples/run-first-test/first_test.py b/ios/examples/run-first-test/first_test.py index 07c42e1..aeba666 100644 --- a/ios/examples/run-first-test/first_test.py +++ b/ios/examples/run-first-test/first_test.py @@ -23,7 +23,7 @@ def test(): driver = webdriver.Remote( desired_capabilities = desired_capabilities, - command_executor = "http://%s:%s@hub-cloud.browserstack.com/wd/hub" % (BROWSERSTACK_USERNAME, BROWSERSTACK_ACCESS_KEY) + command_executor = "http://%s:%s@%s/wd/hub" % (BROWSERSTACK_USERNAME, BROWSERSTACK_ACCESS_KEY, CONFIG['server']) ) text_button = WebDriverWait(driver, 30).until( diff --git a/ios/examples/run-local-test/config.json b/ios/examples/run-local-test/config.json index bef191e..cf12095 100644 --- a/ios/examples/run-local-test/config.json +++ b/ios/examples/run-local-test/config.json @@ -1,4 +1,5 @@ { + "server": "hub-cloud.browserstack.com", "username":"BROWSERSTACK_USERNAME", "access_key":"BROWSERSTACK_ACCESS_KEY", diff --git a/ios/examples/run-local-test/local_test.py b/ios/examples/run-local-test/local_test.py index f88203f..1d7cb2a 100644 --- a/ios/examples/run-local-test/local_test.py +++ b/ios/examples/run-local-test/local_test.py @@ -40,7 +40,7 @@ def test(): driver = webdriver.Remote( desired_capabilities = desired_capabilities, - command_executor = "http://%s:%s@hub-cloud.browserstack.com/wd/hub" % (BROWSERSTACK_USERNAME, BROWSERSTACK_ACCESS_KEY) + command_executor = "http://%s:%s@%s/wd/hub" % (BROWSERSTACK_USERNAME, BROWSERSTACK_ACCESS_KEY, CONFIG['server']) ) test_button = WebDriverWait(driver, 30).until( diff --git a/ios/examples/run-parallel-tests/config.json b/ios/examples/run-parallel-tests/config.json index 7d5db10..a8e2fa1 100644 --- a/ios/examples/run-parallel-tests/config.json +++ b/ios/examples/run-parallel-tests/config.json @@ -1,4 +1,5 @@ { + "server": "hub-cloud.browserstack.com", "username":"BROWSERSTACK_USERNAME", "access_key":"BROWSERSTACK_ACCESS_KEY", diff --git a/ios/examples/run-parallel-tests/parallel_test.py b/ios/examples/run-parallel-tests/parallel_test.py index 6137a6c..af4b3f2 100644 --- a/ios/examples/run-parallel-tests/parallel_test.py +++ b/ios/examples/run-parallel-tests/parallel_test.py @@ -26,7 +26,7 @@ def test(device_index): driver = webdriver.Remote( desired_capabilities = dict(desired_capabilities), - command_executor = "http://%s:%s@hub-cloud.browserstack.com/wd/hub" % (BROWSERSTACK_USERNAME, BROWSERSTACK_ACCESS_KEY) + command_executor = "http://%s:%s@%s/wd/hub" % (BROWSERSTACK_USERNAME, BROWSERSTACK_ACCESS_KEY, CONFIG['server']) ) text_button = WebDriverWait(driver, 30).until(