mirror of
https://github.com/budtmo/docker-android.git
synced 2026-07-31 04:07:25 +00:00
Possibility to run appium with custom chromedriver executable (#12)
* Possibility to run appium with custom chromedriver executable * Unit test added * README update
This commit is contained in:
@@ -102,6 +102,10 @@ def appium_run(avd_name: str):
|
||||
cmd = 'appium'
|
||||
local_ip = os.popen('ifconfig eth0 | grep \'inet addr:\' | cut -d: -f2 | awk \'{ print $1}\'').read().strip()
|
||||
|
||||
chromedriver_executable = os.getenv('CHROMEDRIVER_EXECUTABLE', False)
|
||||
if chromedriver_executable:
|
||||
cmd += ' --chromedriver-executable {executable}'.format(executable=chromedriver_executable)
|
||||
|
||||
grid_connect = convert_str_to_bool(str(os.getenv('CONNECT_TO_GRID', False)))
|
||||
logger.info('Connect to selenium grid? {connect}'.format(connect=grid_connect))
|
||||
if grid_connect:
|
||||
|
||||
@@ -12,8 +12,20 @@ class TestAppium(TestCase):
|
||||
|
||||
def setUp(self):
|
||||
os.environ['CONNECT_TO_GRID'] = str(True)
|
||||
os.environ['CHROMEDRIVER_EXECUTABLE'] = str(False)
|
||||
self.avd_name = 'test_avd'
|
||||
|
||||
@mock.patch('os.popen')
|
||||
@mock.patch('subprocess.check_call')
|
||||
def test_with_chromedriver_executable(self, mocked_os, mocked_subprocess):
|
||||
os.environ['CONNECT_TO_GRID'] = str(False)
|
||||
os.environ['CHROMEDRIVER_EXECUTABLE'] = '/root/chromedriver'
|
||||
self.assertFalse(mocked_os.called)
|
||||
self.assertFalse(mocked_subprocess.called)
|
||||
app.appium_run(self.avd_name)
|
||||
self.assertTrue(mocked_os.called)
|
||||
self.assertTrue(mocked_subprocess.called)
|
||||
|
||||
@mock.patch('os.popen')
|
||||
@mock.patch('subprocess.check_call')
|
||||
def test_without_selenium_grid(self, mocked_os, mocked_subprocess):
|
||||
|
||||
Reference in New Issue
Block a user