From 38a827fee15735645bdc6f6795d7674f1313146e Mon Sep 17 00:00:00 2001 From: butomo1989 Date: Mon, 30 Jan 2017 15:29:47 +0100 Subject: [PATCH] Added examples UI tests for msite --- example/android/python/msite_simple_chrome.py | 30 +++++++++++++++++++ .../python/msite_simple_default_browser.py | 27 +++++++++++++++++ .../android/python/msite_simple_firefox.py | 30 +++++++++++++++++++ example/android/python/requirements.txt | 2 +- 4 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 example/android/python/msite_simple_chrome.py create mode 100644 example/android/python/msite_simple_default_browser.py create mode 100644 example/android/python/msite_simple_firefox.py diff --git a/example/android/python/msite_simple_chrome.py b/example/android/python/msite_simple_chrome.py new file mode 100644 index 0000000..8a42814 --- /dev/null +++ b/example/android/python/msite_simple_chrome.py @@ -0,0 +1,30 @@ +import unittest + +from appium import webdriver + + +class MSiteChromeAndroidUITests(unittest.TestCase): + + def setUp(self): + desired_caps = { + 'platformName': 'Android', + 'deviceName': 'Android Emulator', + 'platformVersion': '4.2', + # For emulator type armeabi, please use browser apk : + # /root/browser_apk/chrome_55.0.2883.91-288309100_min_android4.1_armeabi-v7a.apk + 'app': '/root/browser_apk/chrome_55.0.2883.91_min_android4.1_x86.apk', + 'appPackage': 'com.android.chrome', + 'appActivity': 'com.google.android.apps.chrome.Main', + 'avd': 'emulator_4.2.2' + } + self.driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps) + + def test_open_google(self): + self.driver.get('http://targeturl.com') + + def tearDown(self): + self.driver.quit() + +if __name__ == '__main__': + suite = unittest.TestLoader().loadTestsFromTestCase(MSiteChromeAndroidUITests) + unittest.TextTestRunner(verbosity=2).run(suite) diff --git a/example/android/python/msite_simple_default_browser.py b/example/android/python/msite_simple_default_browser.py new file mode 100644 index 0000000..d60509e --- /dev/null +++ b/example/android/python/msite_simple_default_browser.py @@ -0,0 +1,27 @@ +import unittest + +from appium import webdriver + + +class MSiteDefaultBrowserAndroidUITests(unittest.TestCase): + + def setUp(self): + desired_caps = { + 'platformName': 'Android', + 'deviceName': 'Android Emulator', + 'platformVersion': '4.2', + 'appPackage': 'com.android.browser', + 'appActivity': 'com.android.browser.BrowserActivity', + 'avd': 'emulator_4.2.2' + } + self.driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps) + + def test_open_google(self): + self.driver.get('http://targeturl.com') + + def tearDown(self): + self.driver.quit() + +if __name__ == '__main__': + suite = unittest.TestLoader().loadTestsFromTestCase(MSiteDefaultBrowserAndroidUITests) + unittest.TextTestRunner(verbosity=2).run(suite) diff --git a/example/android/python/msite_simple_firefox.py b/example/android/python/msite_simple_firefox.py new file mode 100644 index 0000000..ace68ed --- /dev/null +++ b/example/android/python/msite_simple_firefox.py @@ -0,0 +1,30 @@ +import unittest + +from appium import webdriver + + +class MSiteFirefoxAndroidUITests(unittest.TestCase): + + def setUp(self): + desired_caps = { + 'platformName': 'Android', + 'deviceName': 'Android Emulator', + 'platformVersion': '4.2', + # For emulator type armeabi, please use browser apk : + # /root/browser_apk/firefox_51.0-2015466281_min_android4.0.3_armeabi-v7a.apk + 'app': '/root/browser_apk/firefox_51.0-2015466284_min_android4.0.3_x86.apk', + 'appPackage': 'org.mozilla.firefox', + 'appActivity': 'org.mozilla.gecko.LauncherActivity', + 'avd': 'emulator_4.2.2' + } + self.driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps) + + def test_open_google(self): + self.driver.get('http://targeturl.com') + + def tearDown(self): + self.driver.quit() + +if __name__ == '__main__': + suite = unittest.TestLoader().loadTestsFromTestCase(MSiteFirefoxAndroidUITests) + unittest.TextTestRunner(verbosity=2).run(suite) diff --git a/example/android/python/requirements.txt b/example/android/python/requirements.txt index 4b63864..5c071b9 100644 --- a/example/android/python/requirements.txt +++ b/example/android/python/requirements.txt @@ -1 +1 @@ -Appium-Python-Client==0.23 +Appium-Python-Client==0.24