Turn off appium server by default

This commit is contained in:
butomo1989 2017-04-21 15:18:01 +02:00
parent 7ce3cfba96
commit e59c28ebd8
4 changed files with 8 additions and 6 deletions

View file

@ -51,7 +51,7 @@ Quick Start
2. Run docker-android 2. Run docker-android
```bash ```bash
docker run --privileged -d -p 6080:6080 -p 4723:4723 -p 5554:5554 -p 5555:5555 -e DEVICE="Samsung Galaxy S6" -e APPIUM=False --name android-container butomo1989/docker-android-x86-5.0.1 docker run --privileged -d -p 6080:6080 -p 4723:4723 -p 5554:5554 -p 5555:5555 -e DEVICE="Samsung Galaxy S6" --name android-container butomo1989/docker-android-x86-5.0.1
``` ```
**Optional arguments** **Optional arguments**

View file

@ -1,7 +1,7 @@
Docker-Android-Appium Sample Docker-Android Sample UITests with Appium
---------------------------- -----------------------------------------
Example UI test to use docker-appium. Example UI test with [Appium] to use docker-android.
Requirements Requirements
============ ============
@ -12,3 +12,5 @@ Quick Start
=========== ===========
1. pip install -r requirements.txt 1. pip install -r requirements.txt
2. python app_simple.py 2. python app_simple.py
[Appium]: <https://appium.io>

View file

@ -167,7 +167,7 @@ def run():
cmd = 'emulator -avd {name}'.format(name=avd_name) cmd = 'emulator -avd {name}'.format(name=avd_name)
subprocess.Popen(cmd.split()) subprocess.Popen(cmd.split())
appium = str_to_bool(str(os.getenv('APPIUM', True))) appium = str_to_bool(str(os.getenv('APPIUM', False)))
if appium: if appium:
logger.info('Run appium server...') logger.info('Run appium server...')
appium_run(avd_name) appium_run(avd_name)

View file

@ -37,6 +37,7 @@ class TestApp(TestCase):
@mock.patch('subprocess.Popen') @mock.patch('subprocess.Popen')
def test_run_with_appium(self, mocked_avd, mocked_subprocess): def test_run_with_appium(self, mocked_avd, mocked_subprocess):
with mock.patch('src.app.appium_run') as mocked_appium: with mock.patch('src.app.appium_run') as mocked_appium:
os.environ['APPIUM'] = str(True)
app.run() app.run()
self.assertTrue(mocked_avd.called) self.assertTrue(mocked_avd.called)
self.assertTrue(mocked_subprocess.called) self.assertTrue(mocked_subprocess.called)
@ -46,7 +47,6 @@ class TestApp(TestCase):
@mock.patch('subprocess.Popen') @mock.patch('subprocess.Popen')
def test_run_withhout_appium(self, mocked_avd, mocked_subprocess): def test_run_withhout_appium(self, mocked_avd, mocked_subprocess):
with mock.patch('src.app.appium_run') as mocked_appium: with mock.patch('src.app.appium_run') as mocked_appium:
os.environ['APPIUM'] = str(False)
app.run() app.run()
self.assertTrue(mocked_avd.called) self.assertTrue(mocked_avd.called)
self.assertTrue(mocked_subprocess.called) self.assertTrue(mocked_subprocess.called)