mirror of
https://github.com/budtmo/docker-android.git
synced 2026-07-31 04:07:25 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d2843d7260 | ||
|
|
67726cf735 | ||
|
|
e59c28ebd8 | ||
|
|
7ce3cfba96 | ||
|
|
63e64d219b | ||
|
|
2ef82e3894 |
+6
-6
@@ -51,7 +51,7 @@ WORKDIR /root
|
||||
# ubuntu-vm-builder
|
||||
# bridge-utils
|
||||
#==================
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
RUN apt-get -qqy update && apt-get -qqy install --no-install-recommends \
|
||||
wget \
|
||||
unzip \
|
||||
curl \
|
||||
@@ -79,11 +79,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
#=======
|
||||
ENV NOVNC_SHA="b403cb92fb8de82d04f305b4f14fa978003890d7" \
|
||||
WEBSOCKIFY_SHA="558a6439f14b0d85a31145541745e25c255d576b"
|
||||
RUN wget -O noVNC.zip "https://github.com/kanaka/noVNC/archive/${NOVNC_SHA}.zip" \
|
||||
RUN wget -nv -O noVNC.zip "https://github.com/kanaka/noVNC/archive/${NOVNC_SHA}.zip" \
|
||||
&& unzip -x noVNC.zip \
|
||||
&& rm noVNC.zip \
|
||||
&& mv noVNC-${NOVNC_SHA} noVNC \
|
||||
&& wget -O websockify.zip "https://github.com/kanaka/websockify/archive/${WEBSOCKIFY_SHA}.zip" \
|
||||
&& wget -nv -O websockify.zip "https://github.com/kanaka/websockify/archive/${WEBSOCKIFY_SHA}.zip" \
|
||||
&& unzip -x websockify.zip \
|
||||
&& mv websockify-${WEBSOCKIFY_SHA} ./noVNC/utils/websockify \
|
||||
&& rm websockify.zip \
|
||||
@@ -97,7 +97,7 @@ ENV PATH ${PATH}:${JAVA_HOME}/bin
|
||||
|
||||
ENV SDK_VERSION=25.2.3 \
|
||||
ANDROID_HOME=/root
|
||||
RUN wget -O android.zip https://dl.google.com/android/repository/tools_r${SDK_VERSION}-linux.zip \
|
||||
RUN wget -nv -O android.zip https://dl.google.com/android/repository/tools_r${SDK_VERSION}-linux.zip \
|
||||
&& unzip android.zip && rm android.zip
|
||||
ENV PATH ${PATH}:${ANDROID_HOME}/tools
|
||||
RUN echo y | android update sdk --no-ui -a --filter platform-tools
|
||||
@@ -107,7 +107,7 @@ ENV PATH ${PATH}:${ANDROID_HOME}/platform-tools
|
||||
# Install latest nodejs, npm, appium
|
||||
#====================================
|
||||
RUN curl -sL https://deb.nodesource.com/setup_7.x | bash - \
|
||||
&& apt-get update && apt-get install -y nodejs && rm -rf /var/lib/apt/lists/*
|
||||
&& apt-get -qqy update && apt-get -qqy install nodejs && rm -rf /var/lib/apt/lists/*
|
||||
ENV APPIUM_VERSION 1.6.3
|
||||
RUN npm install -g appium@$APPIUM_VERSION && npm cache clean
|
||||
|
||||
@@ -129,7 +129,7 @@ ENV PATH ${PATH}:${ANDROID_HOME}/build-tools
|
||||
|
||||
RUN rm ${ANDROID_HOME}/tools/emulator \
|
||||
&& ln -s ${ANDROID_HOME}/tools/emulator64-${PROCESSOR} ${ANDROID_HOME}/tools/emulator
|
||||
RUN echo y | android update sdk --no-ui -a -t android-${API_LEVEL},sys-img-${SYS_IMG}-android-${API_LEVEL}
|
||||
RUN echo y | android update sdk --no-ui -a -t android-${API_LEVEL},sys-img-${SYS_IMG}-google_apis-${API_LEVEL}
|
||||
|
||||
#================================================
|
||||
# noVNC Default Configurations
|
||||
|
||||
@@ -35,13 +35,13 @@ List of Docker images
|
||||
|Linux|5.0.1|21|butomo1989/docker-android-x86-5.0.1|[](https://microbadger.com/images/butomo1989/docker-android-x86-5.0.1 "Get your own image badge on microbadger.com")|
|
||||
|Linux|5.1.1|22|butomo1989/docker-android-x86-5.1.1|[](https://microbadger.com/images/butomo1989/docker-android-x86-5.1.1 "Get your own image badge on microbadger.com")|
|
||||
|Linux|6.0|23|butomo1989/docker-android-x86-6.0|[](https://microbadger.com/images/butomo1989/docker-android-x86-6.0 "Get your own image badge on microbadger.com")|
|
||||
|Linux|7.0|24|*TODO* because still have a Bug||
|
||||
|Linux|7.1.1|25|*TODO* because still have a Bug||
|
||||
|Linux|7.0|24|butomo1989/docker-android-x86-7.0|[](https://microbadger.com/images/butomo1989/docker-android-x86-7.0 "Get your own image badge on microbadger.com")|
|
||||
|Linux|7.1.1|25|butomo1989/docker-android-x86-7.1.1|[](https://microbadger.com/images/butomo1989/docker-android-x86-7.1.1 "Get your own image badge on microbadger.com")|
|
||||
|OSX / Windows|5.0.1|21|butomo1989/docker-android-arm-5.0.1|[](https://microbadger.com/images/butomo1989/docker-android-arm-5.0.1 "Get your own image badge on microbadger.com")|
|
||||
|OSX / Windows|5.1.1|22|butomo1989/docker-android-arm-5.1.1|[](https://microbadger.com/images/butomo1989/docker-android-arm-5.1.1 "Get your own image badge on microbadger.com")|
|
||||
|OSX / Windows|6.0|23|butomo1989/docker-android-arm-6.0|[](https://microbadger.com/images/butomo1989/docker-android-arm-6.0 "Get your own image badge on microbadger.com")|
|
||||
|OSX / Windows|7.0|24|*TODO* because still have a Bug||
|
||||
|OSX / Windows|7.1.1|25|*TODO* because still have a Bug||
|
||||
|OSX / Windows|7.0|24|butomo1989/docker-android-arm-7.0|[](https://microbadger.com/images/butomo1989/docker-android-arm-7.0 "Get your own image badge on microbadger.com")|
|
||||
|OSX / Windows|7.1.1|25|butomo1989/docker-android-arm-7.1.1|[](https://microbadger.com/images/butomo1989/docker-android-arm-7.1.1 "Get your own image badge on microbadger.com")|
|
||||
|
||||
Quick Start
|
||||
-----------
|
||||
@@ -51,12 +51,12 @@ Quick Start
|
||||
2. Run docker-android
|
||||
|
||||
```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**
|
||||
|
||||
-v <android_project_or_apk>:/root : You need to share volume or apk file if for example you want to build the android project inside docker container or you want to run UI test by using appium.
|
||||
-v <android_project_or_apk>:/root/tmp : You need to share volume or apk file if for example you want to build the android project inside docker container or you want to run UI test by using appium.
|
||||
-e APPIUM=True: If you want to use appium as UI test framework to test mobile website or android application
|
||||
|
||||
3. Verify the ip address of docker-machine.
|
||||
|
||||
@@ -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
|
||||
============
|
||||
@@ -12,3 +12,5 @@ Quick Start
|
||||
===========
|
||||
1. pip install -r requirements.txt
|
||||
2. python app_simple.py
|
||||
|
||||
[Appium]: <https://appium.io>
|
||||
|
||||
@@ -9,8 +9,8 @@ class SimpleAndroidUITests(unittest.TestCase):
|
||||
desired_caps = {
|
||||
'platformName': 'Android',
|
||||
'deviceName': 'Android Emulator',
|
||||
'app': '/root/sample_apk_debug.apk',
|
||||
'avd': 'nexus_5_5.0'
|
||||
'app': '/root/tmp/sample_apk_debug.apk',
|
||||
'avd': 'samsung_galaxy_s6_5.0.1'
|
||||
}
|
||||
self.driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
import unittest
|
||||
|
||||
from appium import webdriver
|
||||
|
||||
|
||||
class MSiteChromeAndroidUITests(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
desired_caps = {
|
||||
'platformName': 'Android',
|
||||
'deviceName': 'Android Emulator',
|
||||
'appPackage': 'com.android.chrome',
|
||||
'appActivity': 'com.google.android.apps.chrome.Main',
|
||||
'avd': 'samsung_galaxy_s6_5.0.1'
|
||||
}
|
||||
self.driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)
|
||||
|
||||
def test_open_url(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)
|
||||
@@ -11,7 +11,7 @@ class MSiteDefaultBrowserAndroidUITests(unittest.TestCase):
|
||||
'deviceName': 'Android Emulator',
|
||||
'appPackage': 'com.android.browser',
|
||||
'appActivity': 'com.android.browser.BrowserActivity',
|
||||
'avd': 'nexus_5_5.0'
|
||||
'avd': 'samsung_galaxy_s6_5.0.1'
|
||||
}
|
||||
self.driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)
|
||||
|
||||
|
||||
+3
-1
@@ -11,7 +11,7 @@ else
|
||||
fi
|
||||
|
||||
if [ -z "$2" ]; then
|
||||
read -p "Android version (5.0.1|5.1.1|6.0|all): " ANDROID_VERSION
|
||||
read -p "Android version (5.0.1|5.1.1|6.0|7.0|7.1.1|all): " ANDROID_VERSION
|
||||
else
|
||||
ANDROID_VERSION=$2
|
||||
fi
|
||||
@@ -32,6 +32,8 @@ declare -A list_of_levels=(
|
||||
[5.0.1]=21
|
||||
[5.1.1]=22
|
||||
[6.0]=23
|
||||
[7.0]=24
|
||||
[7.1.1]=25
|
||||
)
|
||||
|
||||
declare -A list_of_processors=(
|
||||
|
||||
+2
-2
@@ -59,7 +59,7 @@ def prepare_avd(device: str, avd_name: str):
|
||||
:param device: Device name
|
||||
:param avd_name: Name of android virtual device / emulator
|
||||
"""
|
||||
cmd = 'echo no | android create avd -f -n {name} -t android-{api} -b {sys_img}'.format(
|
||||
cmd = 'echo no | android create avd -f -n {name} -t android-{api} -b google_apis/{sys_img}'.format(
|
||||
name=avd_name, api=API_LEVEL, sys_img=SYS_IMG)
|
||||
|
||||
# Link emulator skins
|
||||
@@ -167,7 +167,7 @@ def run():
|
||||
cmd = 'emulator -avd {name}'.format(name=avd_name)
|
||||
subprocess.Popen(cmd.split())
|
||||
|
||||
appium = str_to_bool(str(os.getenv('APPIUM', True)))
|
||||
appium = str_to_bool(str(os.getenv('APPIUM', False)))
|
||||
if appium:
|
||||
logger.info('Run appium server...')
|
||||
appium_run(avd_name)
|
||||
|
||||
@@ -37,6 +37,7 @@ class TestApp(TestCase):
|
||||
@mock.patch('subprocess.Popen')
|
||||
def test_run_with_appium(self, mocked_avd, mocked_subprocess):
|
||||
with mock.patch('src.app.appium_run') as mocked_appium:
|
||||
os.environ['APPIUM'] = str(True)
|
||||
app.run()
|
||||
self.assertTrue(mocked_avd.called)
|
||||
self.assertTrue(mocked_subprocess.called)
|
||||
|
||||
Reference in New Issue
Block a user