Big restructuring by moving to python

This commit is contained in:
budtmo
2023-05-09 19:34:44 +02:00
parent abcdf3f4d1
commit 6767970307
448 changed files with 2493 additions and 5679 deletions
-16
View File
@@ -1,16 +0,0 @@
Docker-Android Sample UITests with Appium
-----------------------------------------
Example UI test with [Appium] to use docker-android.
Requirements
============
1. docker-appium
2. python
Quick Start
===========
1. pip install -r requirements.txt
2. python app_simple.py
[Appium]: <https://appium.io>
-35
View File
@@ -1,35 +0,0 @@
import unittest
from appium import webdriver
class SimpleAndroidUITests(unittest.TestCase):
def setUp(self):
desired_caps = {
'platformName': 'Android',
'deviceName': 'Android Emulator',
'automationName': 'UIAutomator2',
'app': '/root/tmp/sample_apk_debug.apk',
'browserName': 'android',
'avd': 'nexus_5_7.1.1'
}
self.driver = webdriver.Remote('http://127.0.0.1:4444/wd/hub', desired_caps)
def tearDown(self):
self.driver.quit()
def test_calculation(self):
text_fields = self.driver.find_elements_by_class_name('android.widget.EditText')
text_fields[0].send_keys(4)
text_fields[1].send_keys(6)
btn_calculate = self.driver.find_element_by_class_name('android.widget.Button')
btn_calculate.click()
self.assertEqual('10', text_fields[2].text)
if __name__ == '__main__':
suite = unittest.TestLoader().loadTestsFromTestCase(SimpleAndroidUITests)
unittest.TextTestRunner(verbosity=2).run(suite)
@@ -1,42 +0,0 @@
import unittest
from time import sleep
from appium import webdriver
class MSiteChromeAndroidUITests(unittest.TestCase):
def setUp(self):
# Default google chrome does not exist for android < 6.0
desired_caps = {
'platformName': 'Android',
'deviceName': 'Android Emulator',
'appPackage': 'com.android.chrome',
'appActivity': 'com.google.android.apps.chrome.Main',
'browserName': 'chrome'
}
self.driver = webdriver.Remote('http://127.0.0.1:4444/wd/hub', desired_caps)
def test_open_url(self):
self.driver.get('http://google.com')
# Handle Welcome Home
self.driver.switch_to.context('NATIVE_APP')
self.driver.find_element_by_id('terms_accept').click()
self.driver.find_element_by_id('negative_button').click()
# Search for Github
self.driver.switch_to.context('CHROMIUM')
search = self.driver.find_element_by_name('q')
search.send_keys('butomo1989 docker-android')
search.submit()
sleep(2)
def tearDown(self):
self.driver.quit()
if __name__ == '__main__':
suite = unittest.TestLoader().loadTestsFromTestCase(MSiteChromeAndroidUITests)
unittest.TextTestRunner(verbosity=2).run(suite)
@@ -1,35 +0,0 @@
import unittest
from time import sleep
from appium import webdriver
class MSiteDefaultBrowserAndroidUITests(unittest.TestCase):
def setUp(self):
# Default browser does not exist for android >= 6.0
desired_caps = {
'platformName': 'Android',
'deviceName': 'Android Emulator',
'appPackage': 'com.android.browser',
'appActivity': 'com.android.browser.BrowserActivity',
'browserName': 'browser'
}
self.driver = webdriver.Remote('http://127.0.0.1:4444/wd/hub', desired_caps)
def test_open_url(self):
self.driver.get('http://google.com')
search = self.driver.find_element_by_name('q')
search.send_keys('butomo1989 docker-android')
search.submit()
sleep(2)
def tearDown(self):
self.driver.quit()
if __name__ == '__main__':
suite = unittest.TestLoader().loadTestsFromTestCase(MSiteDefaultBrowserAndroidUITests)
unittest.TextTestRunner(verbosity=2).run(suite)
-1
View File
@@ -1 +0,0 @@
Appium-Python-Client==0.24
+55
View File
@@ -0,0 +1,55 @@
[
{
"name": "device1",
"region": "eu-west-1",
"ami": "ami-68d78411",
"instance_type": "t2.small",
"ingress_rules": [
{
"from_port": 22,
"to_port": 22,
"protocol": "tcp",
"cidr_blocks": ["0.0.0.0/0"]
},
{
"from_port": 80,
"to_port": 80,
"protocol": "tcp",
"cidr_blocks": ["0.0.0.0/0"]
},
{
"from_port": 443,
"to_port": 443,
"protocol": "tcp",
"cidr_blocks": ["0.0.0.0/0"]
},
{
"from_port": 51000,
"to_port": 51100,
"protocol": "tcp",
"cidr_blocks": ["0.0.0.0/0"]
},
{
"from_port": 51000,
"to_port": 51100,
"protocol": "udp",
"cidr_blocks": ["0.0.0.0/0"]
}
],
"egress_rules": [
{
"from_port": 0,
"to_port": 65535,
"protocol": "udp",
"cidr_blocks": ["0.0.0.0/0"]
}
]
},
{
"name": "device2",
"region": "eu-west-1",
"ami": "ami-68d78411",
"instance_type": "t2.small",
"security_group": "<your_existing_sg>"
}
]
+10
View File
@@ -0,0 +1,10 @@
[
{
"name": "SamsungS7V6",
"template": "a2a0c86c-7572-45fe-98d0-66f8efed9fa0",
"local_port": 51345
},
{
"template": "80a67ae9-430c-4824-a386-befbb19518b9"
}
]
Binary file not shown.