Merge pull request #111 from devilankur18/custom_args
Able to pass custom arguments to Emulator
This commit is contained in:
commit
9a714e5fb3
|
@ -122,6 +122,13 @@ To run tests for mobile browser, following parameter can be passed:
|
||||||
```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=true -e CONNECT_TO_GRID=true -e APPIUM_HOST="127.0.0.1" -e APPIUM_PORT=4723 -e SELENIUM_HOST="172.17.0.1" -e SELENIUM_PORT=4444 -e MOBILE_WEB_TEST=true --name android-container butomo1989/docker-android-x86-8.1
|
docker run --privileged -d -p 6080:6080 -p 4723:4723 -p 5554:5554 -p 5555:5555 -e DEVICE="Samsung Galaxy S6" -e APPIUM=true -e CONNECT_TO_GRID=true -e APPIUM_HOST="127.0.0.1" -e APPIUM_PORT=4723 -e SELENIUM_HOST="172.17.0.1" -e SELENIUM_PORT=4444 -e MOBILE_WEB_TEST=true --name android-container butomo1989/docker-android-x86-8.1
|
||||||
```
|
```
|
||||||
|
### Custom Emulator Arguments
|
||||||
|
|
||||||
|
If you want to add more arguments for running emulator, you can ***pass an evnironemnt variable EMULATOR_ARGS*** while running docker command.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run --privileged -d -p 6080:6080 -p 4723:4723 -p 5554:5554 -p 5555:5555 -e DEVICE="Samsung Galaxy S6" -e EMULATOR_ARGS="-no-snapshot-load -partition-size 512" -e APPIUM=true -e CONNECT_TO_GRID=true -e APPIUM_HOST="127.0.0.1" -e APPIUM_PORT=4723 -e SELENIUM_HOST="172.17.0.1" -e SELENIUM_PORT=4444 -e MOBILE_WEB_TEST=true --name android-container butomo1989/docker-android-x86-8.1
|
||||||
|
```
|
||||||
|
|
||||||
### Back & Restore
|
### Back & Restore
|
||||||
If you want to backup/reuse the avds created with furture upgrades or for replication, run the container with two extra mounts
|
If you want to backup/reuse the avds created with furture upgrades or for replication, run the container with two extra mounts
|
||||||
|
|
|
@ -186,8 +186,8 @@ def run():
|
||||||
"""Run app."""
|
"""Run app."""
|
||||||
device = os.getenv('DEVICE', 'Nexus 5')
|
device = os.getenv('DEVICE', 'Nexus 5')
|
||||||
logger.info('Device: {device}'.format(device=device))
|
logger.info('Device: {device}'.format(device=device))
|
||||||
device_id = os.getenv('DEVICE_ID', str(uuid.uuid4()))
|
custom_args=os.getenv('EMULATOR_ARGS', '')
|
||||||
logger.info('Device Id: {device_id}'.format(device_id=device_id))
|
logger.info('Custom Args: {custom_args}'.format(custom_args=custom_args))
|
||||||
|
|
||||||
avd_name = '{device}_{version}'.format(device=device.replace(' ', '_').lower(), version=ANDROID_VERSION)
|
avd_name = '{device}_{version}'.format(device=device.replace(' ', '_').lower(), version=ANDROID_VERSION)
|
||||||
logger.info('AVD name: {avd}'.format(avd=avd_name))
|
logger.info('AVD name: {avd}'.format(avd=avd_name))
|
||||||
|
@ -203,9 +203,9 @@ def run():
|
||||||
cfg.write('\ndisk.dataPartition.size={dp}'.format(dp=dp_size))
|
cfg.write('\ndisk.dataPartition.size={dp}'.format(dp=dp_size))
|
||||||
|
|
||||||
if is_first_run:
|
if is_first_run:
|
||||||
cmd = 'emulator/emulator @{name} -gpu off -prop emu.uuid={uuid} -verbose -wipe-data'.format(name=avd_name, uuid=device_id)
|
cmd = 'emulator/emulator @{name} -gpu off -verbose -wipe-data {custom_args}'.format(name=avd_name, custom_args=custom_args)
|
||||||
else:
|
else:
|
||||||
cmd = 'emulator/emulator @{name} -gpu off -prop emu.uuid={uuid} -verbose'.format(name=avd_name, uuid=device_id)
|
cmd = 'emulator/emulator @{name} -gpu off -verbose {custom_args}'.format(name=avd_name, custom_args=custom_args)
|
||||||
appium = convert_str_to_bool(str(os.getenv('APPIUM', False)))
|
appium = convert_str_to_bool(str(os.getenv('APPIUM', False)))
|
||||||
if appium:
|
if appium:
|
||||||
subprocess.Popen(cmd.split())
|
subprocess.Popen(cmd.split())
|
||||||
|
|
Loading…
Reference in a new issue