diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..531d1f9 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,19 @@ +# Git +.git/ + +# IDE +**/*.idea +backup + +# Python +**/*.egg-info +**/*.pyc +**/__pycache__ +**/venv + +# Unit Test +**/.coverage +**/coverage.xml +**/xunit.xml +**/coverage +tmp/ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index f8ff2b5..0000000 --- a/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -*.mp4 filter=lfs diff=lfs merge=lfs -text diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml old mode 100755 new mode 100644 index 1473e9e..8250174 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,17 +1,3 @@ -# These are supported funding model platforms - -# Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] github: [budtmo] - -patreon: # Replace with a single Patreon username -open_collective: # Replace with a single Open Collective username -ko_fi: # Replace with a single Ko-fi username -tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel -community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry -liberapay: # Replace with a single Liberapay username -issuehunt: # Replace with a single IssueHunt username -otechie: # Replace with a single Otechie username - -# Bitcoin (BTC) custom: -- "paypal.me/budtmo" \ No newline at end of file +- "paypal.me/budtmo" diff --git a/.github/ISSUE_TEMPLATE/bug.md b/.github/ISSUE_TEMPLATE/bug.md deleted file mode 100755 index 8d46468..0000000 --- a/.github/ISSUE_TEMPLATE/bug.md +++ /dev/null @@ -1,28 +0,0 @@ ---- - -name: 🐛 Bug report -about: Report a bug to improve the tool ---- - -## 🐛 Bug Report - -Operating System: - - -Docker Image: - - -Docker Version: - - -Docker-compose version (Only if you use it): - - -Docker Command to start docker-android: - - -## Expected Behavior - - -## Actual Behavior - diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml new file mode 100644 index 0000000..de5e04a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -0,0 +1,45 @@ +name: 🐛 Bug Report +description: File a bug report +title: "[🐛 Bug ]: " +labels: [bug] +body: + - type: input + id: operating-system + attributes: + label: Operating System + description: Which host operating system do you use? + placeholder: e.g. OSX Yosemite / Ubuntu 20.04 / Windows 10 etc + validations: + required: true + - type: input + id: docker-image + attributes: + label: Docker Image + description: Which docker image do you use? + placeholder: e.g. budtmo/docker-android:emulator_10.0_v2.0 / budtmo/docker-android:genymotion_v2.0 etc + validations: + required: true + - type: textarea + id: expected-behaviour + attributes: + label: Expected behaviour + description: | + What behaviour that you expected? + validations: + required: true + - type: textarea + id: actual-behaviour + attributes: + label: Actual behaviour + description: | + What is the actual behaviour? + validations: + required: true + - type: textarea + id: logs + attributes: + label: Logs + description: | + Please provide logs here + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/bug_pro_version.yml b/.github/ISSUE_TEMPLATE/bug_pro_version.yml new file mode 100644 index 0000000..789c54f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_pro_version.yml @@ -0,0 +1,45 @@ +name: 🐛 [Pro version] Bug Report +description: File a bug report +title: "[🐛 PRO | Bug ]: " +labels: [bug, pro] +body: + - type: input + id: operating-system + attributes: + label: Operating System + description: Which host operating system do you use? + placeholder: e.g. OSX Yosemite / Ubuntu 20.04 / Windows 10 etc + validations: + required: true + - type: input + id: docker-image + attributes: + label: Docker Image + description: Which docker image do you use? + placeholder: e.g. budtmo/docker-android-pro:emulator_10.0_v2.0 / budtmo/docker-android-pro:emulator_headless_10.0_v2.0 etc + validations: + required: true + - type: textarea + id: expected-behaviour + attributes: + label: Expected behaviour + description: | + What behaviour that you expected? + validations: + required: true + - type: textarea + id: actual-behaviour + attributes: + label: Actual behaviour + description: | + What is the actual behaviour? + validations: + required: true + - type: textarea + id: logs + attributes: + label: Logs + description: | + Please provide logs here + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..46f571e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: false +contact_links: + - name: 📖 Docker-Android Documentation + url: https://github.com/budtmo/docker-android + about: Please read the whole project README before filling out an issue. diff --git a/.github/ISSUE_TEMPLATE/feature.md b/.github/ISSUE_TEMPLATE/feature.md deleted file mode 100755 index 32903ee..0000000 --- a/.github/ISSUE_TEMPLATE/feature.md +++ /dev/null @@ -1,16 +0,0 @@ ---- - -name: 🚀 Feature Request -about: Submit your idea to have cool features ---- - -## 🚀 Feature Request - -Idea: - - -Problems that want to be solved: - - -Note: - diff --git a/.github/ISSUE_TEMPLATE/feature.yml b/.github/ISSUE_TEMPLATE/feature.yml new file mode 100644 index 0000000..e50d72c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature.yml @@ -0,0 +1,29 @@ +name: 🚀 Feature Request +description: Submit your idea to have cool feature(s) +title: "[🚀 Feature Request ]: " +labels: [feature-request] +body: + - type: textarea + id: idea + attributes: + label: Idea + description: | + What is the idea that you want to share to improve the project? + validations: + required: true + - type: textarea + id: problem + attributes: + label: Probelm to solve + description: | + What is the problem that you want to solve with requested feature? + validations: + required: true + - type: textarea + id: Note + attributes: + label: Additional Note + description: | + Please share any additional information here if needed + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md deleted file mode 100755 index 879a96a..0000000 --- a/.github/ISSUE_TEMPLATE/question.md +++ /dev/null @@ -1,9 +0,0 @@ ---- - -name: 💬 Questions / Help -about: If you have questions, please check the group chat ---- - -## 💬 Questions and Help - -**Please make sure that it is an issue / a feature request. If it is a question / help wanted, please visit [our group chat](https://gitter.im/budtmo/docker-android). Thank you!** diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md old mode 100755 new mode 100644 index 987ca4c..7ed28fd --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,12 +1,8 @@ -### Purpose of changes - - ### Types of changes _Put an `x` in the boxes that apply_ - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) -- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) -### How has this been tested? - +### Purpose of changes + diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..0ee291b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,82 @@ +name: Release + +on: + push: + tags: + - 'v*.*-*' + +jobs: + run_test: + runs-on: ubuntu-20.04 + strategy: + matrix: + python-version: ["3.8"] + steps: + - name: Checkout the repo + uses: actions/checkout@v3 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + cd cli + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + + - name: Run test + run: | + cd cli && nosetests -v + + release_base: + runs-on: ubuntu-20.04 + needs: run_test + steps: + - name: Checkout the repo + uses: actions/checkout@v3 + + - name: Get release version + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + + - name: Build and push base image (${RELEASE_VERSION}) + run: | + docker login -u=${{secrets.DOCKER_USERNAME}} -p=${{secrets.DOCKER_PASSWORD}} + ./app.sh push base ${RELEASE_VERSION} + docker logout + + release_emulator: + runs-on: ubuntu-20.04 + needs: release_base + strategy: + matrix: + android: ["9.0", "10.0", "11.0", "12.0", "13.0"] + steps: + - name: Checkout the repo + uses: actions/checkout@v3 + + - name: Get release version + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + + - name: Build and push emulator image ${{ matrix.android }} (${RELEASE_VERSION}) + run: | + docker login -u=${{secrets.DOCKER_USERNAME}} -p=${{secrets.DOCKER_PASSWORD}} + ./app.sh push emulator ${RELEASE_VERSION} ${{ matrix.android }} + docker logout + + release_genymotion: + runs-on: ubuntu-20.04 + needs: release_base + steps: + - name: Checkout the repo + uses: actions/checkout@v3 + + - name: Get release version + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + + - name: Build and push genymotion image (${RELEASE_VERSION}) + run: | + docker login -u=${{secrets.DOCKER_USERNAME}} -p=${{secrets.DOCKER_PASSWORD}} + ./app.sh push genymotion ${RELEASE_VERSION} + docker logout diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..b7debba --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,25 @@ +name: Run Test + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + build_and_test: + runs-on: ubuntu-20.04 + steps: + - name: Checkout the repo + uses: actions/checkout@v3 + + - name: Build base image + run: script -e -c "./app.sh build base test" + + - name: Build emulator image and run unit-test + run: script -e -c "./app.sh test emulator test 11.0 && sudo mv tmp/* . && ls -al" + + - name: Publish test result + run: script -e -c "bash <(curl -s https://codecov.io/bash)" diff --git a/.gitignore b/.gitignore index 887dc44..e225c6f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,20 @@ -.idea/* -.DS_Store -*.pyc +# IDE +**/*.idea +backup -# Coverage -.coverage -coverage.xml -xunit.xml -coverage/* +# Python +**/*.egg-info +**/*.pyc +**/__pycache__ +**/venv + +# Unit Test +**/.coverage +**/coverage.xml +**/xunit.xml +**/coverage +tmp/ + +# Dev-files +n*.txt +test-*.sh diff --git a/Analytics.md b/Analytics.md deleted file mode 100644 index b88592a..0000000 --- a/Analytics.md +++ /dev/null @@ -1,37 +0,0 @@ -# Docker-Android's Anonymous Aggregate User Behaviour Analytics -Docker-Android has begun gathering anonymous aggregate user behaviour analytics and reporting these to Google Analytics. You are notified about this when you start Docker-Android. - -## Why? -Docker-Android is provided free of charge for our internal and external users and we don't have direct communication with its users nor time resources to ask directly for their feedback. As a result, we now use anonymous aggregate user analytics to help us understand how Docker-Android is being used, the most common used features based on how, where and when people use it. With this information we can prioritize some features over other ones. - -## What? -Docker-Android's analytics record some shared information for every event: - -- The Google Analytics version i.e. `1` (https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#v) -- The Google Analytics anonymous IP setting is enabled i.e. `1` (https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#aip) -- The Docker-Android analytics tracking ID e.g. `UA-133466903-1` (https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#tid) -- The release version of machine, e.g. `Linux_version_4.4.16-boot2docker_(gcc_version_4.9.2_(Debian_4.9.2-10)_)_#1_SMP_Fri_Jul_29_00:13:24_UTC_2016` This does not allow us to track individual users but does enable us to accurately measure user counts vs. event counts (https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#cid) -- Docker-Android analytics hit type, e.g. `event` (https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#t) -- Application type, e.g. `Emulator` (https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#ec) -- Description will contains information about Emulator configuration, e.g. `Processor type`. (https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#el) -- Docker-Android application name, e.g. `docker-android` (https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#an) -- Docker-Android application version, e.g. `1.5-p0` (https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#av) - -With the recorded information, it is not possible for us to match any particular real user. - -As far as we can tell it would be impossible for Google to match the randomly generated analytics user ID to any other Google Analytics user ID. If Google turned evil the only thing they could do would be to lie about anonymising IP addresses and attempt to match users based on IP addresses. - -## When/Where? -Docker-Android's analytics are sent throughout Docker-Android's execution to Google Analytics over HTTPS. - -## Who? -Docker-Android's analytics are accessible to Docker-Android's current maintainers. Contact [@budtmo](https://github.com/budtmo) if you are a maintainer and need access. - -## How? -The code is viewable in [this script](./src/appium.sh). - -## Opting out before starting Docker-Android -Docker-Android analytics helps us, maintainers and leaving it on is appreciated. However, if you want to opt out and not send any information, you can do this by using passing environment variable GA=false to the Docker container. - -## Disclaimer -This document and the implementation are based on the great idea implemented by [Homebrew](https://github.com/Homebrew/brew/blob/master/docs/Analytics.md) diff --git a/LICENSE.md b/LICENSE.md index 2bd77f1..0c2a555 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ ## License Information -Copyright 2016 budi utomo +Copyright 2023 budi utomo This program is subject to the terms of the Apache License, Version 2.0 AND the following amendments on forks and data processing. Thus, this is a Custom Apache 2.0 License, NOT a dual-license model you may choose from. @@ -12,10 +12,10 @@ Unless required by applicable law or agreed to in writing, software distributed ## Forks -Additionally to Apache-2.0, when you fork this repo you are required to either remove our Google Analytics tracking ID: UA-133466903-1 or stop usage gathering completely. +Additionally to Apache-2.0, when you fork this repo you are required to either remove our Google Form ID: 1FAIpQLSdrKWQdMh6Nt8v8NQdYvTIntohebAgqWCpXT3T9NofAoxcpkw or stop usage gathering completely. ## Data processing agreement -By using this software you agree that the following non-PII (non personally identifiable information) data will be collected, processed and used by the maintainers for the purpose of improving the docker-android project. Anonymisation with respect of the IP address means that only the first two octets of the IP address are collected. +By using this software you agree that the following non-PII (non personally identifiable information) data will be collected, processed and used by the maintainers for the purpose of improving the docker-android project. By using this software you also grant us a nonexclusive, irrevocable, world-wide, perpetual royalty-free permission to use, modify and publish these data for all purposes, internally or publicly, including the right to sub-license said permission rights. @@ -23,14 +23,24 @@ By using this software you also grant us a nonexclusive, irrevocable, world-wide We collect, process and use the following data: -* Release version of Docker-Android -* Anonymized IP address (only first two octets) -* Country and city * Date and time when Docker-Android started -* User (it will collect the information about Release Version of Machine) -* Application type, e.g. Emulator or Device or Genymotion -* Emulator configuration, e.g. Processor type, Device name, Appium mode, Selenium grid mode and mobile test mode +* User (it will collect the information about Release Version of Machine), e.g. Linux-5.4.0-146-generic-x86_64-with-glibc2.29_#163-Ubuntu_SMP_Fri_Mar_17_18:26:02_UTC_2023. This does not allow us to track individual users but does enable us to accurately measure user counts +* City (the information come from https://ipinfo.io) +* Region (the information come from https://ipinfo.io) +* Country (the information come from https://ipinfo.io) +* Release version of Docker-Android +* Appium (Whether user use Appium or not - The possible value will be "true" or "false") +* Appium Additional Arguments +* Web-Log (Whether user use Web-Log feature or not - The possible value will be "true" or "false") +* Web-Vnc (Whether user use Web-Vnc feature or not - The possible value will be "true" or "false") +* Screen-Resolution +* Device Type (Which docker image is used - The possible value will be "emulator" or "geny_cloud" or "geny_aws") +* Emulator Device (Which device profile and skin is used if the user use device_type "emulator") +* Emulator Android Version (Which Android version is used if the user use device_type "emulator" +* Emulator No-Skin feature (Whether user use no-skin feature or not - The possible value will be "true" or "false") +* Emulator Data Partition +* Emulator Additional Arguments ## End of License Information -More information about anonymized data collection can be seen [here](Analytics.md) +More information about anonymized data collection can be seen [here](./documentations/USER_BEHAVIOR_ANALYTICS.md) diff --git a/MAINTAINERS b/MAINTAINERS.md similarity index 100% rename from MAINTAINERS rename to MAINTAINERS.md diff --git a/README.md b/README.md index dca83a4..f24ae22 100644 --- a/README.md +++ b/README.md @@ -1,60 +1,32 @@ +

- +

-[![Analytics](https://ga-beacon.appspot.com/UA-133466903-1/github/budtmo/docker-android/README.md)](https://github.com/igrigorik/ga-beacon "Analytics") -[![Join the chat at https://gitter.im/budtmo/docker-android](https://badges.gitter.im/budtmo/docker-android.svg)](https://gitter.im/budtmo/docker-android?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -[![Build Status](https://dev.azure.com/budtmoos/budtmoos/_apis/build/status/budtmo.docker-android.test?branchName=master)](https://dev.azure.com/budtmoos/budtmoos/_build/latest?definitionId=7&branchName=master) -[![codecov](https://codecov.io/gh/budtmo/docker-android/branch/master/graph/badge.svg)](https://codecov.io/gh/budtmo/docker-android) -[![Codacy Badge](https://api.codacy.com/project/badge/Grade/3f000ffb97db45a59161814e1434c429)](https://www.codacy.com/app/butomo1989/docker-appium?utm_source=github.com&utm_medium=referral&utm_content=butomo1989/docker-appium&utm_campaign=Badge_Grade) -[![GitHub release](https://img.shields.io/github/release/budtmo/docker-android.svg)](https://github.com/budtmo/docker-android/releases) -[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fbudtmo%2Fdocker-android.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fbudtmo%2Fdocker-android?ref=badge_shield) -[![Paypal Donate](https://img.shields.io/badge/paypal-donate-blue.svg)](http://paypal.me/budtmo) -[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) +[![Paypal Donate](https://img.shields.io/badge/paypal-donate-blue.svg)](http://paypal.me/budtmo) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) [![Join the chat at https://gitter.im/budtmo/docker-android](https://badges.gitter.im/budtmo/docker-android.svg)](https://gitter.im/budtmo/docker-android?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![codecov](https://codecov.io/gh/budtmo/docker-android/branch/master/graph/badge.svg)](https://codecov.io/gh/budtmo/docker-android) [![GitHub release](https://img.shields.io/github/release/budtmo/docker-android.svg)](https://github.com/budtmo/docker-android/releases) -Docker-Android is a docker image built to be used for everything related to mobile website testing and Android project. +Docker-Android is a docker image built to be used for everything related to Android. It can be used for Application development and testing (native, web and hybrid-app). -Emulator - Samsung Device | Emulator - Nexus Device | Real Device -:---------------------------:|:---------------------------:|:---------------------------: -![][emulator samsung] |![][emulator nexus] |![][real device] - -Purposes --------- - -1. Run UI tests for mobile websites with [appium] -2. Build Android project and run unit tests with the latest build-tools -3. Run UI tests for Android applications with different frameworks ([appium], [espresso], [robotium], etc.) -4. Run monkey / stress tests -5. SMS testing - -Advantages compare with other docker-android projects ------------------------------------------------------ - -1. noVNC to see what happen inside docker container -2. Emulator for different devices / skins, such as Samsung Galaxy S6, LG Nexus 4, HTC Nexus One and more. -3. Ability to connect to Selenium Grid +Advantages of using this projects +--------------------------------- +1. Emulator with different device profile and skins, such as Samsung Galaxy S6, LG Nexus 4, HTC Nexus One and more. +2. Support vnc to be able to see what happen inside docker container +3. Support log sharing feature where all logs can be accessed from web-UI 4. Ability to control emulator from outside container by using adb connect -5. Support real devices with screen mirroring -6. Ability to record video during test execution for debugging -7. Integrated with other cloud solutions, e.g. [Genymotion Cloud](https://www.genymotion.com/cloud/) -8. Open source with more features coming +5. Integrated with other cloud solutions, e.g. [Genymotion Cloud](https://www.genymotion.com/cloud/) +6. It can be used to build Android project +7. It can be used to run unit and UI-Test with different test-frameworks, e.g. Appium, Espresso, etc. -List of Docker images +List of Docker-Images --------------------- - -|OS |Android |API |Browser |Browser version |Chromedriver |Image |Size | -|:---|:---|:---|:---|:---|:---|:---|:---| -|Linux|6.0|23|browser|44.0|2.18|budtmo/docker-android-x86-6.0|[![](https://images.microbadger.com/badges/image/budtmo/docker-android-x86-6.0.svg)](https://microbadger.com/images/budtmo/docker-android-x86-6.0 "Get your own image badge on microbadger.com")| -|Linux|7.0|24|chrome|51.0|2.23|budtmo/docker-android-x86-7.0|[![](https://images.microbadger.com/badges/image/budtmo/docker-android-x86-7.0.svg)](https://microbadger.com/images/budtmo/docker-android-x86-7.0 "Get your own image badge on microbadger.com")| -|Linux|7.1.1|25|chrome|55.0|2.28|budtmo/docker-android-x86-7.1.1|[![](https://images.microbadger.com/badges/image/budtmo/docker-android-x86-7.1.1.svg)](https://microbadger.com/images/budtmo/docker-android-x86-7.1.1 "Get your own image badge on microbadger.com")| -|Linux|8.0|26|chrome|58.0|2.31|budtmo/docker-android-x86-8.0|[![](https://images.microbadger.com/badges/image/budtmo/docker-android-x86-8.0.svg)](https://microbadger.com/images/budtmo/docker-android-x86-8.0 "Get your own image badge on microbadger.com")| -|Linux|8.1|27|chrome|61.0|2.33|budtmo/docker-android-x86-8.1|[![](https://images.microbadger.com/badges/image/budtmo/docker-android-x86-8.1.svg)](https://microbadger.com/images/budtmo/docker-android-x86-8.1 "Get your own image badge on microbadger.com")| -|Linux|9.0|28|chrome|66.0|2.40|budtmo/docker-android-x86-9.0|[![](https://images.microbadger.com/badges/image/budtmo/docker-android-x86-9.0.svg)](https://microbadger.com/images/budtmo/docker-android-x86-9.0 "Get your own image badge on microbadger.com")| -|Linux|10.0|29|chrome|74.0|74.0.3729.6|budtmo/docker-android-x86-10.0|[![](https://images.microbadger.com/badges/image/budtmo/docker-android-x86-10.0.svg)](https://microbadger.com/images/budtmo/docker-android-x86-10.0 "Get your own image badge on microbadger.com")| -|Linux|11.0|30|chrome|83.0|83.0.4103.39|budtmo/docker-android-x86-11.0|[![](https://images.microbadger.com/badges/image/budtmo/docker-android-x86-11.0.svg)](https://microbadger.com/images/budtmo/docker-android-x86-11.0 "Get your own image badge on microbadger.com")| -|Linux|12.0|31|chrome|93.0|93.0.4577.15|budtmo/docker-android-x86-12.0|[![](https://images.microbadger.com/badges/image/budtmo/docker-android-x86-12.0.svg)](https://microbadger.com/images/budtmo/docker-android-x86-12.0 "Get your own image badge on microbadger.com")| -|All |-|-|-|-|-|budtmo/docker-android-real-device|[![](https://images.microbadger.com/badges/image/budtmo/docker-android-real-device.svg)](https://microbadger.com/images/budtmo/docker-android-real-device "Get your own image badge on microbadger.com")| -|All|All|All|All|All|All|budtmo/docker-android-genymotion|[![](https://images.microbadger.com/badges/image/budtmo/docker-android-genymotion.svg)](https://microbadger.com/images/budtmo/docker-android-genymotion "Get your own image badge on microbadger.com")| +|Android |API |Image with latest release version |Image with specific release version| +|:---|:---|:---|:---| +|9.0|28|budtmo/docker-android:emulator_9.0|budtmo/docker-android:emulator_9.0_| +|10.0|29|budtmo/docker-android:emulator_10.0|budtmo/docker-android:emulator_10.0_| +|11.0|30|budtmo/docker-android:emulator_11.0|budtmo/docker-android:emulator_11.0_| +|12.0|32|budtmo/docker-android:emulator_12.0|budtmo/docker-android:emulator_12.0_| +|13.0|33|budtmo/docker-android:emulator_13.0|budtmo/docker-android:emulator_13.0_| +|-|-|budtmo/docker-android:genymotion|budtmo/docker-android:genymotion_| List of Devices --------------- @@ -76,162 +48,45 @@ Tablet | Nexus 7 Requirements ------------ -Docker is installed in your system. +1. Docker is installed on your system. Quick Start ----------- -1. Your machine need to support virtualization. To check it: +1. If you use ***Ubuntu OS*** on your host machine, you can skip this step. For ***OSX*** and ***Windows OS*** user, you need to use Virtual Machine that support Virtualization with Ubuntu OS because the image can be run under ***Ubuntu OS only***. - ``` - sudo apt install cpu-checker - kvm-ok - ``` - -2. Run Docker-Android - - - For ***Linux OS***, please use image name that contains "x86" - - ```bash - docker run --privileged -d -p 6080:6080 -p 5554:5554 -p 5555:5555 -e DEVICE="Samsung Galaxy S6" --name android-container budtmo/docker-android-x86-8.1 - ``` - - - For ***OSX*** and ***Windows OS***, please use Virtual Machine that support Virtualization with Ubuntu OS - - -3. Verify the ip address of docker host. - - - For OSX, you can find out by using following command: - - ```bash - docker-machine ip default - ``` - - - For different OS, localhost should work. - -4. Open ***http://docker-host-ip-address:6080*** from web browser. Note: Adding ```?view_only=true``` will give user only view only permission. - -Custom configurations ---------------------- - -[This document](README_CUSTOM_CONFIG.md) contains custom configurations of Docker-Android that you might need, e.g. Proxy, Changing language on fly, etc. - -Build Android project ---------------------- - -Docker-Android can be used for building Android project and executing its unit test. This following steps will illustrate how to build Android project: - -1. Clone [this sample test project](https://github.com/android/testing-samples). - - ```bash - git clone git@github.com:android/testing-samples.git +2. Your machine should support virtualization. To check if the virtualization is enabled is: + ``` + sudo apt install cpu-checker + kvm-ok ``` -2. Build the project - - ```bash - docker run -it --rm -v $PWD/testing-samples/ui/espresso/BasicSample:/tmp -w /tmp budtmo/docker-android-x86-8.1 /tmp/gradlew build +3. Run Docker-Android container + ``` + docker run -d -p 6080:6080 -e EMULATOR_DEVICE="Samsung Galaxy S10" -e WEB_VNC=true --device /dev/kvm --name android-container budtmo/docker-android:emulator_11.0 ``` -Control Android connected to host (Emulator or Real Device) ------------------------------------------------------------ -1. Create a docker container with this command +4. Open ***http://localhost:6080*** to see inside running container. - ``` - $ docker run --privileged -d -p 6080:6080 -p 5554:5554 -p 5555:5555 -p 4723:4723 --name android-container-appium budtmo/docker-android-real-device - ``` +5. To check the status of the emulator + ``` + docker exec -it android-container cat device_status + ``` -2. Open noVNC [http://localhost:6080](http://localhost:6080) +Use-Cases +--------- -3. Open terminal by clicking right on **noVNC** window >> **Terminal emulator** +1. [Build Android project](./documentations/USE_CASE_BUILD_ANDROID_PROJECT.md) +2. [UI-Test with Appium](./documentations/USE_CASE_APPIUM.md) +3. [Control Android emulator on host machine](./documentations/USE_CASE_CONTROL_EMULATOR.md) +4. [SMS Simulation](./documentations/USE_CASE_SMS.md) +5. [Jenkins](./documentations/USE_CASE_JENKINS.md) +6. [Deploying on cloud (Azure, AWS, GCP)](./documentations/USE_CASE_CLOUD.md) -4. To connect to host's adb (make sure your host have adb and connected to the device.) +Custom-Configurations +--------------------- - ``` - $ adb -H host.docker.internal devices - ``` - - To specify port, just add `-P port_number` - - ``` - $ adb -H host.docker.internal -P 5037 devices - ``` - -5. Now your container can access your host devices. But, you need to add `remoteAdbHost` and `adbPort` desired capabilities to make **Appium** can recognise those devices. - - -Appium and Selenium Grid ------------------------- - -If you want to use Appium and Selenium Grid, you can follow [this document](README_APPIUM_AND_SELENIUM.md). It also contains sample and use cases. - -Control android emulator outside container ------------------------------------------- - -```bash -adb connect :5555 -``` - -![][adb_connection] - -**Note:** You need to have Android Debug Bridge (adb) installed in your host machine. - -SMS Simulation --------------- - -1. Using telnet - - Find the auth_token and copy it. - - ```bash - docker exec -it android-container cat /root/.emulator_console_auth_token - ``` - - - Access emulator using telnet and login with auth_token - - ```bash - telnet 5554 - ``` - - - Login with given auth_token from 1.step - - ```bash - auth - ``` - - - Send the sms - - ```bash - sms send - ``` - -2. Using adb - - ```bash - docker exec -it android-container adb emu sms send - ``` - -3. You can also integrate it inside project using adb library. - -![][sms] - -Google Play Services and Google Play Store ------------------------------------------- -Not installed at this time. - -Jenkins -------- - -This [document](README_JENKINS.md) gives you information about custom plugin that supports Docker-Android. - -VMWARE ------- - -This [document](README_VMWARE.md) shows you how to configure Virtual Machine on VMWARE to be able to run Docker-Android. - -Cloud ------ - -This [document](README_CLOUD.md) contains information about deploying Docker-Android on cloud services. +This [document](./documentations/CUSTOM_CONFIGURATIONS.md) contains information about configurations that can be used to enable some features, e.g. log-sharing, etc. Genymotion ---------- @@ -240,52 +95,34 @@ Genymotion

-For you who do not have ressources to maintain the simulator or to buy machines or need different device profiles, you need to give a try to [Genymotion Cloud](https://www.genymotion.com/cloud/). Docker-Android is integrated with Genymotion on different cloud services, e.g. Genymotion Cloud, AWS, GCP, Alibaba Cloud. Please follow [this document](README_GENYMOTION.md) or [this blog](https://medium.com/genymobile/run-your-appium-tests-using-docker-android-genymotion-cloud-e4817132ccd8) for more detail. - -Troubleshooting ---------------- -All logs inside container are stored under folder **/var/log/supervisor**. you can print out log file by using **docker exec**. Example: - -```bash -docker exec -it android-container tail -f /var/log/supervisor/docker-android.stdout.log -``` +For you who do not have ressources to maintain the simulator or to buy machines or need different device profiles, you can give a try by using [Genymotion SAAS](https://cloud.geny.io/). Docker-Android is [integrated with Genymotion](https://www.genymotion.com/blog/partner_tag/docker/) on different cloud services, e.g. Genymotion SAAS, AWS, GCP, Alibaba Cloud. Please follow [this document](./documentations/THIRD_PARTY_GENYMOTION.md) for more detail. Emulator Skins -------------- The Emulator skins are taken from [Android Studio IDE](https://developer.android.com/studio) and [Samsung Developer Website](https://developer.samsung.com/) -Monitoring ----------- -You can use [cadvisor](https://github.com/google/cadvisor) combined with influxdb / prometheus and grafana if needed to monitor each running container. +PRO VERSION +----------- -Users ------ -Docker-Android are being used by 100+ countries around the world. +Due to high requests for help and to be able to actively maintain the projects, the creator has decided to create docker-android-pro. Docker-Android-Pro is a sponsor based project which mean that the docker image of pro-version can be pulled only by [active sponsor](https://github.com/sponsors/budtmo). -[![ga-datastudio-docker-android](./images/docker-android_users.png)](https://datastudio.google.com/s/ht7HVKHKAQE) +The differences between normal version and pro version are: -Stargazers over time --------------------- +|Feature |Normal |Pro |Comment| +|:---|:---|:---|:---| +|user-behavior-analytics|Yes|No|-| +|proxy|No|Yes|Set up company proxy on Android emulator on fly| +|language|No|Yes|Set up language on Android emulator on fly| +|root-privileged|No|Yes|Able to run command with security privileged| +|headless-mode|No|Yes|Save resources by using headless mode| +|multiple Android-Simulators|No|Yes (soon)|Save resources by having multiple Android-Simulators on one docker-container| +|Google Play Store|No|Yes (soon)|-| +|Video Recording|No|Yes (soon)|Helpful for debugging| -[![Stargazers over time](https://starchart.cc/budtmo/docker-android.svg)](https://starchart.cc/budtmo/docker-android) +This [document](./documentations/DOCKER-ANDROID-PRO.md) contains detail information about how to use docker-android-pro. -Special Thanks --------------- -- [Gian Christanto] for creating a great logo! LICENSE --------------- +------- See [License](LICENSE.md) - -[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fbudtmo%2Fdocker-android.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fbudtmo%2Fdocker-android?ref=badge_large) - -[appium]: -[espresso]: -[robotium]: -[emulator samsung]: -[emulator nexus]: -[real device]: -[adb_connection]: -[sms]: -[gian christanto]: diff --git a/README_APPIUM_AND_SELENIUM.md b/README_APPIUM_AND_SELENIUM.md deleted file mode 100644 index 0d60993..0000000 --- a/README_APPIUM_AND_SELENIUM.md +++ /dev/null @@ -1,56 +0,0 @@ -Run Appium Server ------------------ - -Appium is automation test framework to test mobile website and mobile application, including Android. To be able to use Appium, you need to run appium-server. You run Appium-Server inside docker-android container by ***opening port 4723*** and ***passing an environment variable APPIUM=true***. - -```bash -docker run --privileged -d -p 6080:6080 -p 5554:5554 -p 5555:5555 -p 4723:4723 -e DEVICE="Samsung Galaxy S6" -e APPIUM=true --name android-container budtmo/docker-android-x86-8.1 -``` - -### Share Volume - -If you want to use appium to test UI of your android application, you need to share volume where the APK is located to folder ***/root/tmp***. - -```bash -docker run --privileged -d -p 6080:6080 -p 4723:4723 -p 5554:5554 -p 5555:5555 -v $PWD/example/sample_apk:/root/tmp -e DEVICE="Nexus 5" -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 --name android-container budtmo/docker-android-x86-8.1 -``` - -### Connect to Selenium Grid - -It is also possible to connect appium server that run inside docker-android with selenium grid by passing following environment variables: - -- CONNECT\_TO\_GRID=true -- APPIUM_HOST="\" -- APPIUM_PORT=\ -- SELENIUM_HOST="\" -- SELENIUM_PORT=\ -- SELENIUM_TIMEOUT=\ -- SELENIUM_PROXY_CLASS=\ - -To run tests for mobile browser, following parameter can be passed: - -- MOBILE\_WEB\_TEST=true - -```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 budtmo/docker-android-x86-8.1 -``` - -### Video Recording - -You can deactivate auto_record by changing the value to "False" in docker-compose file. e.g. change value to "False" in this [line](docker-compose.yml#L70). - -### Relaxed Security - -Pass environment variable RELAXED_SECURITY=true to disable additional security check to use some advanced features. - -### Docker-Compose - -![][compose] - -There is [example of compose file](docker-compose.yml) to run complete selenium grid and docker-android container as nodes. [docker-compose](https://docs.docker.com/compose/install/) version [1.13.0](https://github.com/docker/compose/releases/tag/1.13.0) or higher is required to be able to execute that compose file. - -```bash -docker-compose up -d -``` - -[compose]: diff --git a/README_CUSTOM_CONFIG.md b/README_CUSTOM_CONFIG.md deleted file mode 100644 index 07cb0b1..0000000 --- a/README_CUSTOM_CONFIG.md +++ /dev/null @@ -1,88 +0,0 @@ -VNC pass --------- - -Passing ```VNC_PASSWORD="your_pass_here"``` will secure your vnc connection. - -Proxy ------ - -You can enable proxy inside container and Android emulator by passing following environment variables: - -- HTTP_PROXY="http://\:" -- HTTPS_PROXY=""http://\:" -- NO_PROXY="localhost" -- ENABLE_PROXY_ON_EMULATOR=true - -Proxy with authentication ----- - -You can set proxy with authentication by passing following environment variable: - -- HTTP_PROXY_USER="\" -- HTTP_PROXY_PASSWORD="\" - - -Language --------- - -You can change the language setting of Android Emulator on the fly by passing following environment variable: - -- LANGUAGE="\" -- COUNTRY="\" - -Data partition size -------------------- - -The size of the data partition can be set by passing the following environment variable: - -- DATAPARTITION="\" - -The value can be specified in the same format that is used by the emulator config file (`disk.dataPartition.size`), e.g. `800m`. - -Camera ------- - -Passing following environment variable to be able to connect laptop / pc camera to Android emulator: - -- EMULATOR_ARGS="-camera-back webcam0" - -Custom Avd name Arguments -------------------------- - -Passing following environment variable to set a custom avd name - -- AVD_NAME="customName" - - -Custom Emulator Arguments -------------------------- - -If you want to add more arguments for running emulator, you can ***pass an environment 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" --name android-container budtmo/docker-android-x86-8.1 -``` - -SaltStack ---------- - -You can enable [SaltStack](https://github.com/saltstack/salt) to control running containers by passing environment variable SALT_MASTER=. - -Back & Restore --------------- - -If you want to backup/reuse the avds created with furture upgrades or for replication, run the container with two extra mounts - -- -v local_backup/.android:/root/.android -- -v local_backup/android_emulator:/root/android_emulator - -```bash -docker run --privileged -d -p 6080:6080 -p 4723:4723 -p 5554:5554 -p 5555:5555 -v local_backup/.android:/root/.android -v local_backup/android_emulator:/root/android_emulator -e DEVICE="Nexus 5" --name android-container budtmo/docker-android-x86-8.1 -``` - -For the first run, this will create a new avd and all the changes will be accessible in the `local_backup` directory. Now for all future runs, it will reuse the avds. Even this should work with new releases of `docker-android` - -Nginx ------ - -Sample nginx configuration can be found [here](nginx) diff --git a/README_GENYMOTION.md b/README_GENYMOTION.md deleted file mode 100644 index 7a986bf..0000000 --- a/README_GENYMOTION.md +++ /dev/null @@ -1,41 +0,0 @@ -Genymotion Cloud ----------------- - -![Genymotion](images/logo_genymotion.png) - -You can easily scale your Appium tests on Genymotion Android virtual devices in the cloud. They are available on [SaaS](http://bit.ly/2YP0P1l) or as virtual images on AWS, GCP or Alibaba Cloud. - -1. On SaaS
- Use [device.json](genymotion/example/sample_devices/devices.json) to define the device to start. You can specify the port on which the device will start so you don't need to change the device name in your tests every time you need to run those tests. Then run following command - - ```bash - export USER="xxx" - export PASS="xxx" - - docker run -it --rm -p 4723:4723 -v $PWD/genymotion/example/sample_devices:/root/tmp -e TYPE=SaaS -e USER=$USER -e PASS=$PASS budtmo/docker-android-genymotion - ``` - - In case you are interesed to play around with Genymotion on SaaS, you can register to [this link](http://bit.ly/2YP0P1l) to get 1000 free minutes for free. - -2. On PaaS (AWS)
- Use [aws.json](genymotion/example/sample_devices/aws.json) to define configuration of EC2 instance and run following command: - - ```bash - docker run -it --rm -p 4723:4723 -v $PWD/genymotion/example/sample_devices:/root/tmp -v ~/.aws:/root/.aws -e TYPE=aws budtmo/docker-android-genymotion - ``` - - Existing security group and subnet can be used: - - ```json - [ - { - "region": "us-west-2", - "instance": "t2.small", - "AMI": "ami-0673cbd39ef84d97c", - "SG": "sg-000aaa", - "subnet_id": "subnet-000aaa" - } - ] - ``` - -You can also use [this docker-compose file](genymotion/example/geny.yml). diff --git a/README_VMWARE.md b/README_VMWARE.md deleted file mode 100644 index cd7f59b..0000000 --- a/README_VMWARE.md +++ /dev/null @@ -1,85 +0,0 @@ -VMWare Fusion on OSX --------------------- - -The following instructions are used for OS X. You'll need [docker-machine-parallels](https://github.com/Parallels/docker-machine-parallels) to create a virtual machine (vm) with tiny core linux for running docker images. After that, you may start the vm you created for VMWare Fusion or Parallels Desktop and run a docker container inside this vm. If you're going to use the android docker of emulator with x86 processor, setup this vm for nested virtualization and kvm support before you run a docker container. - -1. Install docker-machine-parallels via Homebrew: - ```bash - $ brew install docker-machine-parallels - ``` - -2. Create a virtual machine for running docker images based on the virtual machine tool you use - - 2.1. Create a virtual machine of VMWare Fusion - ```bash - $ docker-machine create --driver=vmwarefusion vmware-dev - ``` - - 2.2. Create a virtual machine of Parallels Desktop - ```bash - $ docker-machine create --driver=parallels prl-dev - ``` - - This utility `docker-machine-parallels` will fetch boot2docker.iso to create a vm of VMWare fusion or Parallels Desktop. When the vm is created, you'll see it's booted with VMWare fusion or Parallels Desktop where the network of vm is set to NAT and one IP is assigned. You'll be able to connect to vnc service inside the docker image through that IP. Say it's `10.211.55.3` and we'll use it later. - -3. Setup the virtual machine for nested virtualization support - - 3.1. Shutdown the vm by running the command below in the boot2docker vm before you setup it. - ```bash - # shutdown -h now - ``` - - If you use VMWare Fusion, go to menu bar > Vitual Machine > Settings > Processors and Memory, expand Advanced options, and select `Enable hypervisor applications in this virtual machine`. - - ![Enable nested virtualization for VMWare Fusion](images/vmwarefusion_enable_nested_virtualization.png) - - If you use Parallels Desktop, open settings screen of that vm and go to `CPU & Memory` under `hardware` tab, expand Advanced settings and select `Enable nested virtualization`. - - ![Enable nested virtualization for Parallels Desktop](images/parallels_enable_nested_virtualization.png) - -4. Enable kvm inside virtual machine - - 4.0 SSH to the machine - ```bash - docker-machine ssh vmware-dev - ``` - - 4.1 Check kvm version - ```bash - # version - $ 10.1 - ``` - - Go to http://tinycorelinux.net/10.x/x86_64/tcz/ and check your kvm version, for version 10.1 is kvm-4.19.10-tinycore64.tcz - - 4.2. Run as an account other than root to install kvm packages using tce-load. - ```bash - # su docker - $ tce-load -wi kvm-4.19.10-tinycore64.tcz - ``` - - 4.3. Run as root to load kvm module after kvm packages install. - ```bash - $ sudo modprobe kvm_intel - ``` - - 4.4. Check if the kvm device is loaded. - ```bash - $ ls /dev/kvm - ``` - - 4.5. Check if your CPU supports hardware virtualization now - ```bash - $ egrep -c '(vmx|svm)' /proc/cpuinfo - ``` - - If **0** it means that your CPU doesn't support hardware virtualization. - If **1** or more it does - but you still need to make sure that virtualization is enabled in the BIOS. - -5. You may now run a docker container - 5.1. Let's run a docker image for an emulator with x86 processor. - ```bash - docker run --privileged -d -p 6080:6080 -p 5554:5554 -p 5555:5555 -e DEVICE="Samsung Galaxy S6" --name android-container budtmo/docker-android-x86-8.1 - ``` - - When the services inside this docker container are running, connect to http://10.211.55.3:6080/vnc.html (the IP we got when the docker machine was created) and login. The emulator with x86 processor should be running on screen. diff --git a/aks-terraform/README.md b/aks-terraform/README.md deleted file mode 100644 index f112453..0000000 --- a/aks-terraform/README.md +++ /dev/null @@ -1,86 +0,0 @@ -# Kubernetes & Azure (AKS, Terraform, Kompose, Kubectl, Azure CLI) - - - Azure CLI configuration - - Infrastructure as code for Azure - - Generating Kubernetes configuration files with Kompose (Services, Deployments, Pods & Persistent volumes) - - Terraform with Azure Provider - - Kubectl configuration - -## Setting up Azure CLI - - - Install Azure CLI -> https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest - - Execute ```sh $ az login ``` and authenticate with your Azure account - - Execute ```sh $ az account show --query "{subscriptionId:id, tenantId:tenantId" ``` . Then copy subscriptionId and tenantId - - Execute ```sh $ az account set --subscription="${SUBSCRIPTION_ID}" ``` . Replace ${SUBSCRIPTION_ID} for your subscriptionId copied - -## Create infrastucture in Azure (AKS Service with node master) - -Terraform version >= v0.11.7 - - - Install Terraform -> https://www.terraform.io/downloads.html - - Edit vars with Azure Account values in ```sh terraform.tfvars ``` - - After that: - - ```sh - $ terraform init - $ terraform plan - $ terraform apply - ``` - -## Setting up Kubectl with Azure account - - - For apply Kubernetes files: - - First configurate azure-cli with Azure account and install kubernetes tools with az: - - ```sh - $ az aks install-cli - ``` - - Then log in in to the Azure Container Registry (if you're using it, but dockerhub or other): - - ```sh - $ az acr login - ``` - - After that, connect to cluster with Kubectl: - - ```sh - $ az aks get-credentials --resource-group docker-android --name k8s-docker-android - ``` - -## Running with custom K8s files (Recommended) - - - You can use this approach or Kompose (Next 2 steps) - - ```sh - $ kubectl create -f volumes.yaml - $ kubectl create -f services_deployments.yaml - ``` - -## Generate Kube files with Kompose - - - Install Kompose -> https://github.com/kubernetes/kompose - - Kompose version: >= 1.1.0 - - - For convert to Kompose: - - ```sh - $ cd kompose - $ kompose convert -f ../kompose.yml - ``` - -## Execute Kube files (Kompose) - - - First create Persistent Volume Claims, then Services; finally Deployments files. For example: - - ```sh - $ cd kompose - $ kubectl create -f nexus-7.1.1-claim0-persistentvolumeclaim.yaml - $ kubectl create -f nexus-7.1.1-claim1-persistentvolumeclaim.yaml - $ kubectl create -f nexus-7.1.1-service.yaml - $ kubectl create -f nexus-7.1.1-deployment.yaml - ``` - - diff --git a/aks-terraform/kompose.yml b/aks-terraform/kompose.yml deleted file mode 100755 index 989e0f5..0000000 --- a/aks-terraform/kompose.yml +++ /dev/null @@ -1,114 +0,0 @@ -# Note: It requires docker-compose 1.13.0 -# -# Usage: docker-compose up -d -version: "3" - -services: - # Selenium hub - selenium_hub: - image: selenium/hub:3.14.0-curium - ports: - - 4444:4444 - - # There is a bug for using appium. Issue: https://github.com/butomo1989/docker-android/issues/73 - # Real devices - #real_device: - # image: butomo1989/docker-android-real-device - # privileged: true - # depends_on: - # - selenium_hub - # ports: - # - 6080:6080 - # volumes: - # - ./video-real-device:/tmp/video - # - /dev/bus/usb:/dev/bus/usb - # - ~/.android:/root/.android - # environment: - # - CONNECT_TO_GRID=true - # - APPIUM=true - # - SELENIUM_HOST=selenium_hub - # - AUTO_RECORD=true - # - BROWSER_NAME=chrome - - # Using Appium Docker Android - real_device: - image: appium/appium - depends_on: - - selenium_hub - network_mode: "service:selenium_hub" - privileged: true - volumes: - - /dev/bus/usb:/dev/bus/usb - - ~/.android:/root/.android - - ../example/sample_apk:/root/tmp - environment: - - CONNECT_TO_GRID=true - - SELENIUM_HOST=selenium_hub - # Enable it for msite testing - #- BROWSER_NAME=chrome - - # Docker-Android for Android application testing - nexus_7.1.1: - image: butomo1989/docker-android-x86-7.1.1 - privileged: true - # Increase scale number if needed - #scale: 1 - depends_on: - - selenium_hub - - real_device - ports: - - 6080 - # Change path of apk that you want to test. I use sample_apk that I provide in folder "example" - volumes: - - ../example/sample_apk:/root/tmp/sample_apk - - ../video-nexus_7.1.1:/tmp/video - environment: - - DEVICE=Nexus 5 - - CONNECT_TO_GRID=true - - APPIUM=true - - SELENIUM_HOST=selenium_hub - - AUTO_RECORD=true - - # Docker-Android for mobile website testing with chrome browser - # Chrome browser exists only for version 7.0 and 7.1.1 - samsung_galaxy_web_7.1.1: - image: butomo1989/docker-android-x86-8.1 - privileged: true - # Increase scale number if needed - #scale: 1 - depends_on: - - selenium_hub - - real_device - ports: - - 6080 - volumes: - - ../video-samsung_7.1.1:/tmp/video - environment: - - DEVICE=Samsung Galaxy S6 - - CONNECT_TO_GRID=true - - APPIUM=true - - SELENIUM_HOST=selenium_hub - - MOBILE_WEB_TEST=true - - AUTO_RECORD=true - - # Docker-Android for mobile website testing with default browser - # Default browser exists only for version 5.0.1, 5.1.1 and 6.0 - samsung_galaxy_web_5.1.1: - image: butomo1989/docker-android-x86-5.1.1 - privileged: true - # Increase scale number if needed - #scale: 1 - depends_on: - - selenium_hub - - real_device - ports: - - 6080 - volumes: - - ../video-samsung_5.1.1:/tmp/video - environment: - - DEVICE=Samsung Galaxy S6 - - CONNECT_TO_GRID=true - - APPIUM=true - - SELENIUM_HOST=selenium_hub - - MOBILE_WEB_TEST=true - - AUTO_RECORD=true diff --git a/aks-terraform/kompose/nexus-7.1.1-claim0-persistentvolumeclaim.yaml b/aks-terraform/kompose/nexus-7.1.1-claim0-persistentvolumeclaim.yaml deleted file mode 100644 index 56514d0..0000000 --- a/aks-terraform/kompose/nexus-7.1.1-claim0-persistentvolumeclaim.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - creationTimestamp: null - labels: - io.kompose.service: nexus-7.1.1-claim0 - name: nexus-7.1.1-claim0 -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 100Mi -status: {} diff --git a/aks-terraform/kompose/nexus-7.1.1-claim1-persistentvolumeclaim.yaml b/aks-terraform/kompose/nexus-7.1.1-claim1-persistentvolumeclaim.yaml deleted file mode 100644 index f4aac02..0000000 --- a/aks-terraform/kompose/nexus-7.1.1-claim1-persistentvolumeclaim.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - creationTimestamp: null - labels: - io.kompose.service: nexus-7.1.1-claim1 - name: nexus-7.1.1-claim1 -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 100Mi -status: {} diff --git a/aks-terraform/kompose/nexus-7.1.1-deployment.yaml b/aks-terraform/kompose/nexus-7.1.1-deployment.yaml deleted file mode 100644 index 9fc756d..0000000 --- a/aks-terraform/kompose/nexus-7.1.1-deployment.yaml +++ /dev/null @@ -1,53 +0,0 @@ -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - annotations: - kompose.cmd: kompose convert -f ../kompose.yml - kompose.version: 1.1.0 (36652f6) - creationTimestamp: null - labels: - io.kompose.service: nexus-7.1.1 - name: nexus-7.1.1 -spec: - replicas: 1 - strategy: - type: Recreate - template: - metadata: - creationTimestamp: null - labels: - io.kompose.service: nexus-7.1.1 - spec: - containers: - - env: - - name: APPIUM - value: "true" - - name: AUTO_RECORD - value: "true" - - name: CONNECT_TO_GRID - value: "true" - - name: DEVICE - value: Nexus 5 - - name: SELENIUM_HOST - value: selenium_hub - image: butomo1989/docker-android-x86-7.1.1 - name: nexus-7.1.1 - ports: - - containerPort: 6080 - resources: {} - securityContext: - privileged: true - volumeMounts: - - mountPath: /root/tmp/sample_apk - name: nexus-7.1.1-claim0 - - mountPath: /tmp/video - name: nexus-7.1.1-claim1 - restartPolicy: Always - volumes: - - name: nexus-7.1.1-claim0 - persistentVolumeClaim: - claimName: nexus-7.1.1-claim0 - - name: nexus-7.1.1-claim1 - persistentVolumeClaim: - claimName: nexus-7.1.1-claim1 -status: {} diff --git a/aks-terraform/kompose/nexus-7.1.1-service.yaml b/aks-terraform/kompose/nexus-7.1.1-service.yaml deleted file mode 100644 index b420215..0000000 --- a/aks-terraform/kompose/nexus-7.1.1-service.yaml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - annotations: - kompose.cmd: kompose convert -f ../kompose.yml - kompose.version: 1.1.0 (36652f6) - creationTimestamp: null - labels: - io.kompose.service: nexus-7.1.1 - name: nexus-7.1.1 -spec: - ports: - - name: "6080" - port: 6080 - targetPort: 6080 - selector: - io.kompose.service: nexus-7.1.1 -status: - loadBalancer: {} diff --git a/aks-terraform/kompose/real-device-claim0-persistentvolumeclaim.yaml b/aks-terraform/kompose/real-device-claim0-persistentvolumeclaim.yaml deleted file mode 100644 index 4cb6bea..0000000 --- a/aks-terraform/kompose/real-device-claim0-persistentvolumeclaim.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - creationTimestamp: null - labels: - io.kompose.service: real-device-claim0 - name: real-device-claim0 -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 100Mi -status: {} diff --git a/aks-terraform/kompose/real-device-claim1-persistentvolumeclaim.yaml b/aks-terraform/kompose/real-device-claim1-persistentvolumeclaim.yaml deleted file mode 100644 index af5e3cb..0000000 --- a/aks-terraform/kompose/real-device-claim1-persistentvolumeclaim.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - creationTimestamp: null - labels: - io.kompose.service: real-device-claim1 - name: real-device-claim1 -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 100Mi -status: {} diff --git a/aks-terraform/kompose/real-device-claim2-persistentvolumeclaim.yaml b/aks-terraform/kompose/real-device-claim2-persistentvolumeclaim.yaml deleted file mode 100644 index 7edeece..0000000 --- a/aks-terraform/kompose/real-device-claim2-persistentvolumeclaim.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - creationTimestamp: null - labels: - io.kompose.service: real-device-claim2 - name: real-device-claim2 -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 100Mi -status: {} diff --git a/aks-terraform/kompose/real-device-deployment.yaml b/aks-terraform/kompose/real-device-deployment.yaml deleted file mode 100644 index bc43a73..0000000 --- a/aks-terraform/kompose/real-device-deployment.yaml +++ /dev/null @@ -1,50 +0,0 @@ -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - annotations: - kompose.cmd: kompose convert -f ../kompose.yml - kompose.version: 1.1.0 (36652f6) - creationTimestamp: null - labels: - io.kompose.service: real-device - name: real-device -spec: - replicas: 1 - strategy: - type: Recreate - template: - metadata: - creationTimestamp: null - labels: - io.kompose.service: real-device - spec: - containers: - - env: - - name: CONNECT_TO_GRID - value: "true" - - name: SELENIUM_HOST - value: selenium_hub - image: appium/appium - name: real-device - resources: {} - securityContext: - privileged: true - volumeMounts: - - mountPath: /dev/bus/usb - name: real-device-claim0 - - mountPath: /root/.android - name: real-device-claim1 - - mountPath: /root/tmp - name: real-device-claim2 - restartPolicy: Always - volumes: - - name: real-device-claim0 - persistentVolumeClaim: - claimName: real-device-claim0 - - name: real-device-claim1 - persistentVolumeClaim: - claimName: real-device-claim1 - - name: real-device-claim2 - persistentVolumeClaim: - claimName: real-device-claim2 -status: {} diff --git a/aks-terraform/kompose/real-device-service.yaml b/aks-terraform/kompose/real-device-service.yaml deleted file mode 100644 index 626e8cb..0000000 --- a/aks-terraform/kompose/real-device-service.yaml +++ /dev/null @@ -1,20 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - annotations: - kompose.cmd: kompose convert -f ../kompose.yml - kompose.version: 1.1.0 (36652f6) - creationTimestamp: null - labels: - io.kompose.service: real-device - name: real-device -spec: - clusterIP: None - ports: - - name: headless - port: 55555 - targetPort: 0 - selector: - io.kompose.service: real-device -status: - loadBalancer: {} diff --git a/aks-terraform/kompose/samsung-galaxy-web-5.1.1-claim0-persistentvolumeclaim.yaml b/aks-terraform/kompose/samsung-galaxy-web-5.1.1-claim0-persistentvolumeclaim.yaml deleted file mode 100644 index e5fa5b1..0000000 --- a/aks-terraform/kompose/samsung-galaxy-web-5.1.1-claim0-persistentvolumeclaim.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - creationTimestamp: null - labels: - io.kompose.service: samsung-galaxy-web-5.1.1-claim0 - name: samsung-galaxy-web-5.1.1-claim0 -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 100Mi -status: {} diff --git a/aks-terraform/kompose/samsung-galaxy-web-5.1.1-deployment.yaml b/aks-terraform/kompose/samsung-galaxy-web-5.1.1-deployment.yaml deleted file mode 100644 index 17376a2..0000000 --- a/aks-terraform/kompose/samsung-galaxy-web-5.1.1-deployment.yaml +++ /dev/null @@ -1,50 +0,0 @@ -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - annotations: - kompose.cmd: kompose convert -f ../kompose.yml - kompose.version: 1.1.0 (36652f6) - creationTimestamp: null - labels: - io.kompose.service: samsung-galaxy-web-5.1.1 - name: samsung-galaxy-web-5.1.1 -spec: - replicas: 1 - strategy: - type: Recreate - template: - metadata: - creationTimestamp: null - labels: - io.kompose.service: samsung-galaxy-web-5.1.1 - spec: - containers: - - env: - - name: APPIUM - value: "true" - - name: AUTO_RECORD - value: "true" - - name: CONNECT_TO_GRID - value: "true" - - name: DEVICE - value: Samsung Galaxy S6 - - name: MOBILE_WEB_TEST - value: "true" - - name: SELENIUM_HOST - value: selenium_hub - image: butomo1989/docker-android-x86-5.1.1 - name: samsung-galaxy-web-5.1.1 - ports: - - containerPort: 6080 - resources: {} - securityContext: - privileged: true - volumeMounts: - - mountPath: /tmp/video - name: samsung-galaxy-web-5.1.1-claim0 - restartPolicy: Always - volumes: - - name: samsung-galaxy-web-5.1.1-claim0 - persistentVolumeClaim: - claimName: samsung-galaxy-web-5.1.1-claim0 -status: {} diff --git a/aks-terraform/kompose/samsung-galaxy-web-5.1.1-service.yaml b/aks-terraform/kompose/samsung-galaxy-web-5.1.1-service.yaml deleted file mode 100644 index 6f9605d..0000000 --- a/aks-terraform/kompose/samsung-galaxy-web-5.1.1-service.yaml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - annotations: - kompose.cmd: kompose convert -f ../kompose.yml - kompose.version: 1.1.0 (36652f6) - creationTimestamp: null - labels: - io.kompose.service: samsung-galaxy-web-5.1.1 - name: samsung-galaxy-web-5.1.1 -spec: - ports: - - name: "6080" - port: 6080 - targetPort: 6080 - selector: - io.kompose.service: samsung-galaxy-web-5.1.1 -status: - loadBalancer: {} diff --git a/aks-terraform/kompose/samsung-galaxy-web-7.1.1-claim0-persistentvolumeclaim.yaml b/aks-terraform/kompose/samsung-galaxy-web-7.1.1-claim0-persistentvolumeclaim.yaml deleted file mode 100644 index e1381b6..0000000 --- a/aks-terraform/kompose/samsung-galaxy-web-7.1.1-claim0-persistentvolumeclaim.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - creationTimestamp: null - labels: - io.kompose.service: samsung-galaxy-web-7.1.1-claim0 - name: samsung-galaxy-web-7.1.1-claim0 -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 100Mi -status: {} diff --git a/aks-terraform/kompose/samsung-galaxy-web-7.1.1-deployment.yaml b/aks-terraform/kompose/samsung-galaxy-web-7.1.1-deployment.yaml deleted file mode 100644 index d9e2d64..0000000 --- a/aks-terraform/kompose/samsung-galaxy-web-7.1.1-deployment.yaml +++ /dev/null @@ -1,50 +0,0 @@ -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - annotations: - kompose.cmd: kompose convert -f ../kompose.yml - kompose.version: 1.1.0 (36652f6) - creationTimestamp: null - labels: - io.kompose.service: samsung-galaxy-web-7.1.1 - name: samsung-galaxy-web-7.1.1 -spec: - replicas: 1 - strategy: - type: Recreate - template: - metadata: - creationTimestamp: null - labels: - io.kompose.service: samsung-galaxy-web-7.1.1 - spec: - containers: - - env: - - name: APPIUM - value: "true" - - name: AUTO_RECORD - value: "true" - - name: CONNECT_TO_GRID - value: "true" - - name: DEVICE - value: Samsung Galaxy S6 - - name: MOBILE_WEB_TEST - value: "true" - - name: SELENIUM_HOST - value: selenium_hub - image: butomo1989/docker-android-x86-8.1 - name: samsung-galaxy-web-7.1.1 - ports: - - containerPort: 6080 - resources: {} - securityContext: - privileged: true - volumeMounts: - - mountPath: /tmp/video - name: samsung-galaxy-web-7.1.1-claim0 - restartPolicy: Always - volumes: - - name: samsung-galaxy-web-7.1.1-claim0 - persistentVolumeClaim: - claimName: samsung-galaxy-web-7.1.1-claim0 -status: {} diff --git a/aks-terraform/kompose/samsung-galaxy-web-7.1.1-service.yaml b/aks-terraform/kompose/samsung-galaxy-web-7.1.1-service.yaml deleted file mode 100644 index e727b6e..0000000 --- a/aks-terraform/kompose/samsung-galaxy-web-7.1.1-service.yaml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - annotations: - kompose.cmd: kompose convert -f ../kompose.yml - kompose.version: 1.1.0 (36652f6) - creationTimestamp: null - labels: - io.kompose.service: samsung-galaxy-web-7.1.1 - name: samsung-galaxy-web-7.1.1 -spec: - ports: - - name: "6080" - port: 6080 - targetPort: 6080 - selector: - io.kompose.service: samsung-galaxy-web-7.1.1 -status: - loadBalancer: {} diff --git a/aks-terraform/kompose/selenium-hub-deployment.yaml b/aks-terraform/kompose/selenium-hub-deployment.yaml deleted file mode 100644 index 92ae25e..0000000 --- a/aks-terraform/kompose/selenium-hub-deployment.yaml +++ /dev/null @@ -1,27 +0,0 @@ -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - annotations: - kompose.cmd: kompose convert -f ../kompose.yml - kompose.version: 1.1.0 (36652f6) - creationTimestamp: null - labels: - io.kompose.service: selenium-hub - name: selenium-hub -spec: - replicas: 1 - strategy: {} - template: - metadata: - creationTimestamp: null - labels: - io.kompose.service: selenium-hub - spec: - containers: - - image: selenium/hub:3.14.0-curium - name: selenium-hub - ports: - - containerPort: 4444 - resources: {} - restartPolicy: Always -status: {} diff --git a/aks-terraform/kompose/selenium-hub-service.yaml b/aks-terraform/kompose/selenium-hub-service.yaml deleted file mode 100644 index 4816896..0000000 --- a/aks-terraform/kompose/selenium-hub-service.yaml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - annotations: - kompose.cmd: kompose convert -f ../kompose.yml - kompose.version: 1.1.0 (36652f6) - creationTimestamp: null - labels: - io.kompose.service: selenium-hub - name: selenium-hub -spec: - ports: - - name: "4444" - port: 4444 - targetPort: 4444 - selector: - io.kompose.service: selenium-hub -status: - loadBalancer: {} diff --git a/aks-terraform/main.tf b/aks-terraform/main.tf deleted file mode 100644 index 0932185..0000000 --- a/aks-terraform/main.tf +++ /dev/null @@ -1,48 +0,0 @@ - -resource "azurerm_container_service" "container_service" { - name = "k8s-docker-android" - resource_group_name = "${var.resource_group_name}" - location = "${var.resource_group_location}" - orchestration_platform = "Kubernetes" - - master_profile { - count = "${var.master_count}" - dns_prefix = "${var.dns_name_prefix}-master" - } - - agent_pool_profile { - name = "agentpools" - count = "${var.linux_agent_count}" - dns_prefix = "${var.dns_name_prefix}-agent" - vm_size = "${var.linux_agent_vm_size}" - } - - linux_profile { - admin_username = "${var.linux_admin_username}" - - ssh_key { - key_data = "${var.linux_admin_ssh_publickey}" - } - } - - service_principal { - client_id = "${var.service_principal_client_id}" - client_secret = "${var.service_principal_client_secret}" - } - - diagnostics_profile { - enabled = false - } - - tags { - Source = "K8s with Terraform" - } -} - -output "master_fqdn" { - value = "${azurerm_container_service.container_service.master_profile.fqdn}" -} - -output "ssh_command_master0" { - value = "ssh ${var.linux_admin_username}@${azurerm_container_service.container_service.master_profile.fqdn} -A -p 22" -} \ No newline at end of file diff --git a/aks-terraform/provider.tf b/aks-terraform/provider.tf deleted file mode 100644 index e0f336c..0000000 --- a/aks-terraform/provider.tf +++ /dev/null @@ -1,11 +0,0 @@ - -# Use this if you can't specify your credentials in file but you need ingress in the UI console. -provider "azurerm" {} - -#Use this if you can specify your credentials and no more configuration is necessary - #provider "azurerm" { - # subscription_id = "${var.subscription_id}" - # client_id = "${var.service_principal_client_id}" - # client_secret = "${var.service_principal_client_secret}" - # tenant_id = "${var.tenant_id}" - #} \ No newline at end of file diff --git a/aks-terraform/services_deployments.yaml b/aks-terraform/services_deployments.yaml deleted file mode 100644 index 45c788b..0000000 --- a/aks-terraform/services_deployments.yaml +++ /dev/null @@ -1,147 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: selenium -spec: - ports: - - name: "4444" - port: 4444 - targetPort: 4444 - selector: - app: selenium - type: LoadBalancer ---- -apiVersion: v1 -kind: Deployment -metadata: - name: selenium-deployment - labels: - app: selenium -spec: - replicas: 1 - template: - metadata: - labels: - app: selenium - spec: - containers: - - image: selenium/hub:3.14.0-curium - name: selenium-hub - ports: - - containerPort: 4444 - resources: {} - restartPolicy: Always ---- -apiVersion: v1 -kind: Service -metadata: - name: real-device -spec: - clusterIP: None - ports: - - name: headless - port: 55555 - targetPort: 0 - selector: - app: real-device - type: LoadBalancer ---- -apiVersion: v1 -kind: Deployment -metadata: - labels: - app: real-device - name: real-device -spec: - replicas: 1 - template: - metadata: - labels: - app: real-device - spec: - containers: - - env: - - name: CONNECT_TO_GRID - value: "true" - - name: SELENIUM_HOST - value: selenium_hub - image: appium/appium - name: real-device - securityContext: - privileged: true - volumeMounts: - - mountPath: /dev/bus/usb - name: real-device-claim0 - - mountPath: /root/.android - name: real-device-claim1 - - mountPath: /root/tmp - name: real-device-claim2 - restartPolicy: Always - volumes: - - name: real-device-claim0 - persistentVolumeClaim: - claimName: real-device-claim0 - - name: real-device-claim1 - persistentVolumeClaim: - claimName: real-device-claim1 - - name: real-device-claim2 - persistentVolumeClaim: - claimName: real-device-claim2 ---- -apiVersion: v1 -kind: Service -metadata: - name: nexus-7.1.1 -spec: - ports: - - name: "6080" - port: 6080 - targetPort: 6080 - selector: - app: nexus-7.1.1 - type: LoadBalancer ---- -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - labels: - app: nexus-7.1.1 - name: nexus-7.1.1 -spec: - replicas: 1 - template: - metadata: - labels: - app: nexus-7.1.1 - spec: - containers: - - env: - - name: APPIUM - value: "true" - - name: AUTO_RECORD - value: "true" - - name: CONNECT_TO_GRID - value: "true" - - name: DEVICE - value: Nexus 5 - - name: SELENIUM_HOST - value: selenium_hub - image: butomo1989/docker-android-x86-7.1.1 - name: nexus-7.1.1 - ports: - - containerPort: 6080 - securityContext: - privileged: true - volumeMounts: - - mountPath: /root/tmp/sample_apk - name: nexus-7.1.1-claim0 - - mountPath: /tmp/video - name: nexus-7.1.1-claim1 - restartPolicy: Always - volumes: - - name: nexus-7.1.1-claim0 - persistentVolumeClaim: - claimName: nexus-7.1.1-claim0 - - name: nexus-7.1.1-claim1 - persistentVolumeClaim: - claimName: nexus-7.1.1-claim1 \ No newline at end of file diff --git a/aks-terraform/terraform.tfvars b/aks-terraform/terraform.tfvars deleted file mode 100644 index 954c9c7..0000000 --- a/aks-terraform/terraform.tfvars +++ /dev/null @@ -1,19 +0,0 @@ - -resource_group_name = "docker-android" -resource_group_location = "West US" -dns_name_prefix = "docker-android" -linux_agent_count = "1" - -#Only use Dv3 or Ev3 series -linux_agent_vm_size = "Standard_D2_v3" - -linux_admin_username = "(Insert any username here!)" -linux_admin_ssh_publickey = "(Insert ssh key here!)" -master_count = "1" - - -# Azure credentials -service_principal_client_id = "(Insert principal key client id here!)" -service_principal_client_secret = "(Insert principal key client secret here!)" -subscription_id = "(Insert subscription id here!)" -tenant_id = "(Insert tenant id here!)" \ No newline at end of file diff --git a/aks-terraform/variables.tf b/aks-terraform/variables.tf deleted file mode 100644 index 997b959..0000000 --- a/aks-terraform/variables.tf +++ /dev/null @@ -1,62 +0,0 @@ -variable "resource_group_name" { - type = "string" - description = "Name of the azure resource group." -} - -variable "resource_group_location" { - type = "string" - description = "Location of the azure resource group." -} - -variable "dns_name_prefix" { - type = "string" - description = "Sets the domain name prefix for the cluster. The suffix 'master' will be added to address the master agents and the suffix 'agent' will be added to address the linux agents." -} - -variable "linux_agent_count" { - type = "string" - default = "1" - description = "The number of Kubernetes linux agents in the cluster. Allowed values are 1-100 (inclusive). The default value is 1." -} - -variable "linux_agent_vm_size" { - type = "string" - default = "Standard_D2_v2" - description = "The size of the virtual machine used for the Kubernetes linux agents in the cluster." -} - -variable "linux_admin_username" { - type = "string" - description = "User name for authentication to the Kubernetes linux agent virtual machines in the cluster." -} - -variable "linux_admin_ssh_publickey" { - type = "string" - description = "Configure all the linux virtual machines in the cluster with the SSH RSA public key string. The key should include three parts, for example 'ssh-rsa AAAAB...snip...UcyupgH azureuser@linuxvm'" -} - -variable "master_count" { - type = "string" - default = "1" - description = "The number of Kubernetes masters for the cluster. Allowed values are 1, 3, and 5. The default value is 1." -} - -variable "service_principal_client_id" { - type = "string" - description = "The client id of the azure service principal used by Kubernetes to interact with Azure APIs." -} - -variable "service_principal_client_secret" { - type = "string" - description = "The client secret of the azure service principal used by Kubernetes to interact with Azure APIs." -} - -variable "subscription_id" { - type = "string" - description = "Your Azure subscription" -} - -variable "tenant_id" { - type = "string" - description = "Your Azure Tenant id" -} \ No newline at end of file diff --git a/aks-terraform/volumes.yaml b/aks-terraform/volumes.yaml deleted file mode 100644 index 7bf17f6..0000000 --- a/aks-terraform/volumes.yaml +++ /dev/null @@ -1,69 +0,0 @@ -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - creationTimestamp: null - labels: - app: real-device-claim0 - name: real-device-claim0 -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 100Mi ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - creationTimestamp: null - labels: - app: real-device-claim1 - name: real-device-claim1 -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 100Mi ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - creationTimestamp: null - labels: - app: real-device-claim2 - name: real-device-claim2 -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 100Mi ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - creationTimestamp: null - labels: - app: nexus-7.1.1-claim0 - name: nexus-7.1.1-claim0 -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 100Mi ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - creationTimestamp: null - labels: - app: nexus-7.1.1-claim1 - name: nexus-7.1.1-claim1 -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 100Mi diff --git a/app.sh b/app.sh new file mode 100755 index 0000000..1c96410 --- /dev/null +++ b/app.sh @@ -0,0 +1,122 @@ +#!/bin/bash + +function is_str_in_list(){ + local given_str=${1} + local list_str=${@:2} + + if [[ ! " ${list_str[*]} " =~ " ${given_str} " ]]; then + echo "${given_str} is not supported!" + exit 1 + fi +} + +tasks=("test" "build" "push") +if [ -z "${1}" ]; then + read -p "Task ($(echo "${tasks[@]}" | tr ' ' '|')) : " t +else + t=${1} +fi +is_str_in_list ${t} ${tasks[@]} + +projects=("base" "emulator" "genymotion" "pro-emulator" "pro-emulator_headless") +if [ -z "${2}" ]; then + read -p "Project ($(echo "${projects[@]}" | tr ' ' '|')) : " p +else + p=${2} +fi +is_str_in_list ${p} ${projects[@]} + +if [ -z "${3}" ]; then + read -p "Release Version (v2.0-p0|v2.0-p1|etc) : " r_v +else + r_v=${3} +fi + +FOLDER_PATH="" +IMAGE_NAME="" +TAG_NAME="" + +if [[ "${p}" == "pro"* ]]; then + IFS='-' read -ra arr <<<"${p}" + FOLDER_PATH+="docker/${arr[0]}/${arr[1]}" + IMAGE_NAME+="budtmo2/docker-android-${arr[0]}" + TAG_NAME+="${arr[1]}" +else + FOLDER_PATH+="docker/${p}" + IMAGE_NAME+="budtmo/docker-android" + TAG_NAME+="${p}" +fi + +if [[ "${p}" == *"emulator"* ]]; then + supported_android_version=("9.0" "10.0" "11.0" "12.0" "13.0") + declare -A api_levels=( + ["9.0"]=28 + ["10.0"]=29 + ["11.0"]=30 + ["12.0"]=32 + ["13.0"]=33 + ) + + # To get the last index + keys=("${!api_levels[@]}") + sorted_keys=($(printf '%s\n' "${keys[@]}" | sort)) + last_key=${keys[-2]} # because 9.0 will be last + + if [ -z "${4}" ]; then + read -p "Android Version ($(echo "${supported_android_version[@]}" \ + | tr ' ' '|')) : " a_v + else + a_v=${4} + fi + is_str_in_list ${a_v} ${supported_android_version[@]} + a_l=${api_levels[${a_v}]} + TAG_NAME+="_${a_v}" +fi + +IMAGE_NAME_LATEST="${IMAGE_NAME}:${TAG_NAME}" +TAG_NAME+="_${r_v}" +IMAGE_NAME_SPECIFIC_RELEASE=${IMAGE_NAME}:${TAG_NAME} +echo "${IMAGE_NAME_SPECIFIC_RELEASE} or ${IMAGE_NAME_LATEST} " + +function build() { + # autopep8 --recursive --exclude=.git,__pycache__,venv --max-line-length=120 --in-place . + cmd="docker build -t ${IMAGE_NAME_SPECIFIC_RELEASE} --build-arg DOCKER_ANDROID_VERSION=${r_v} " + if [ -n "${a_v}" ]; then + cmd+="--build-arg EMULATOR_ANDROID_VERSION=${a_v} --build-arg EMULATOR_API_LEVEL=${a_l} " + fi + + cmd+="-f ${FOLDER_PATH} ." + ${cmd} + docker tag ${IMAGE_NAME_SPECIFIC_RELEASE} ${IMAGE_NAME_LATEST} + + if [ -n "${a_v}" ] && [ "${a_v}" = "${last_key}" ]; then + echo "${a_v} is the last version in the list, will use it as default image tag" + docker tag ${IMAGE_NAME_SPECIFIC_RELEASE} ${IMAGE_NAME}:latest + fi +} + +function test() { + cli_path="/home/androidusr/docker-android/cli" + results_path="test-results" + tmp_folder="tmp" + + mkdir -p tmp + build + docker run -it --rm --name test --entrypoint /bin/bash \ + -v $PWD/${tmp_folder}:${cli_path}/${tmp_folder} ${IMAGE_NAME_SPECIFIC_RELEASE} \ + -c "cd ${cli_path} && sudo rm -rf ${tmp_folder}/* && \ + nosetests -v && sudo mv .coverage ${tmp_folder} && \ + sudo cp -r ${results_path}/* ${tmp_folder} && sudo chown -R 1300:1301 ${tmp_folder} && + sudo chmod a+x -R ${tmp_folder}" +} + +function push() { + build + docker push ${IMAGE_NAME_SPECIFIC_RELEASE} + docker push ${IMAGE_NAME_LATEST} + if [ -n "${a_v}" ] && [ "${a_v}" = "${last_key}" ]; then + docker push ${IMAGE_NAME}:latest + fi +} + +${t} diff --git a/cli/requirements.txt b/cli/requirements.txt new file mode 100644 index 0000000..ad2d834 --- /dev/null +++ b/cli/requirements.txt @@ -0,0 +1,6 @@ +autopep8==2.0.2 +click==8.1.3 +coverage==7.2.5 +mock==5.0.2 +nose==1.3.7 +requests==2.30.0 diff --git a/setup.cfg b/cli/setup.cfg similarity index 50% rename from setup.cfg rename to cli/setup.cfg index 07a9aba..b436b2c 100644 --- a/setup.cfg +++ b/cli/setup.cfg @@ -1,13 +1,10 @@ [nosetests] cover-xml=true -cover-xml-file=coverage.xml +cover-xml-file=test-results/coverage.xml with-coverage=true cover-package=src cover-erase=true with-xunit=true -xunit-file=xunit.xml +xunit-file=test-results/xunit.xml cover-html=true -cover-html-dir=coverage - -[flake8] -max-line-length = 120 +cover-html-dir=test-results/coverage diff --git a/cli/setup.py b/cli/setup.py new file mode 100644 index 0000000..e904442 --- /dev/null +++ b/cli/setup.py @@ -0,0 +1,21 @@ +import os + +from setuptools import setup + + +app_version = os.getenv("DOCKER_ANDROID_VERSION", "test-version") + +with open("requirements.txt", "r") as f: + reqs = f.read().splitlines() + +setup( + name="docker-android", + version=app_version, + url="https://github.com/budtmo/docker-android", + description="CLI for docker-android", + author="Budi Utomo", + author_email="budtmo.os@gmail.com", + install_requires=reqs, + py_modules=["cli", "docker-android"], + entry_points={"console_scripts": "docker-android=src.app:cli"} +) diff --git a/src/tests/__init__.py b/cli/src/__init__.py similarity index 100% rename from src/tests/__init__.py rename to cli/src/__init__.py diff --git a/cli/src/app.py b/cli/src/app.py new file mode 100644 index 0000000..65bde6b --- /dev/null +++ b/cli/src/app.py @@ -0,0 +1,213 @@ +#!/usr/bin/env python3 +import subprocess +from typing import Union + +import click +import logging +import os + +from enum import Enum + +from src.application import Application +from src.device import DeviceType +from src.device.emulator import Emulator +from src.device.geny_aws import GenyAWS +from src.device.geny_saas import GenySAAS +from src.helper import convert_str_to_bool, get_env_value_or_raise +from src.constants import ENV +from src.logger import log + +log.init() +logger = logging.getLogger("App") + + +def get_device(given_input: str) -> Union[Emulator, GenyAWS, GenySAAS, None]: + """ + Get Device object based on given input + + :param given_input: device in string + :return: Platform object + """ + + input_lower = given_input.lower() + + if input_lower == DeviceType.EMULATOR.value.lower(): + emu_av = get_env_value_or_raise(ENV.EMULATOR_ANDROID_VERSION) + emu_img_type = get_env_value_or_raise(ENV.EMULATOR_IMG_TYPE) + emu_sys_img = get_env_value_or_raise(ENV.EMULATOR_SYS_IMG) + + emu_device = os.getenv(ENV.EMULATOR_DEVICE, "Nexus 5") + emu_data_partition = os.getenv(ENV.EMULATOR_DATA_PARTITION, "550m") + emu_additional_args = os.getenv(ENV.EMULATOR_ADDITIONAL_ARGS, "") + + emu_name = os.getenv(ENV.EMULATOR_NAME, "{d}_{v}".format( + d=emu_device.replace(" ", "_").lower(), v=emu_av)) + emu = Emulator(emu_name, emu_device, emu_av, emu_data_partition, + emu_additional_args, emu_img_type, emu_sys_img) + return emu + elif input_lower == DeviceType.GENY_AWS.value.lower(): + return GenyAWS() + elif input_lower == DeviceType.GENY_SAAS.value.lower(): + return GenySAAS() + else: + return None + + +@click.group(context_settings=dict(help_option_names=['-h', '--help'])) +def cli(): + pass + + +def start_appium() -> None: + if convert_str_to_bool(os.getenv(ENV.APPIUM)): + cmd = f"/usr/bin/appium" + app_appium = Application("Appium", cmd, + os.getenv(ENV.APPIUM_ADDITIONAL_ARGS, ""), False) + app_appium.start() + else: + logger.info("env APPIUM cannot be found, Appium is not started!") + + +def start_device() -> None: + given_pt = get_env_value_or_raise(ENV.DEVICE_TYPE) + selected_device = get_device(given_pt) + if selected_device is None: + raise RuntimeError(f"'{given_pt}' is invalid! Please check again!") + selected_device.create() + selected_device.start() + selected_device.wait_until_ready() + selected_device.reconfigure() + selected_device.keep_alive() + + +def start_display_screen() -> None: + cmd = "/usr/bin/Xvfb" + args = f"{os.getenv(ENV.DISPLAY)} " \ + f"-screen {os.getenv(ENV.SCREEN_NUMBER)} " \ + f"{os.getenv(ENV.SCREEN_WIDTH)}x" \ + f"{os.getenv(ENV.SCREEN_HEIGHT)}x" \ + f"{os.getenv(ENV.SCREEN_DEPTH)}" + d_screen = Application("d_screen", cmd, args, False) + d_screen.start() + + +def start_display_wm() -> None: + cmd = "/usr/bin/openbox-session" + d_wm = Application("d_wm", cmd) + d_wm.start() + + +def start_port_forwarder() -> None: + import socket + local_ip = socket.gethostbyname(socket.gethostname()) + cmd = f"/usr/bin/socat tcp-listen:5554,bind={local_ip},fork tcp:127.0.0.1:5554 & " \ + f"/usr/bin/socat tcp-listen:5555,bind={local_ip},fork tcp:127.0.0.1:5555" + pf = Application("port_forwarder", cmd) + pf.start() + + +def start_vnc_server() -> None: + cmd = "/usr/bin/x11vnc" + vnc_pass = os.getenv(ENV.VNC_PASSWORD) + if vnc_pass: + pass_path = os.path.join(os.getenv(ENV.WORK_PATH), ".vncpass") + subprocess.check_call(f"{cmd} -storepasswd {vnc_pass} {pass_path}", shell=True) + last_arg = f"-rfbauth {pass_path}" + else: + last_arg = "-nopw" + + display = os.getenv(ENV.DISPLAY) + args = f"-display {display} -forever -shared {last_arg}" + vnc_server = Application("vnc_web", cmd, args, False) + vnc_server.start() + + +def start_vnc_web() -> None: + if convert_str_to_bool(os.getenv(ENV.WEB_VNC)): + vnc_port = get_env_value_or_raise(ENV.VNC_PORT) + vnc_web_port = get_env_value_or_raise(ENV.WEB_VNC_PORT) + cmd = "/opt/noVNC/utils/novnc_proxy" + args = f"--vnc localhost:{vnc_port} localhost:{vnc_web_port}" + vnc_web = Application("vnc_web", cmd, args, False) + vnc_web.start() + else: + logger.info("env WEB_VNC cannot be found, VNC_WEB is not started!") + + +@cli.command() +@click.argument("app", type=click.Choice([app.value for app in Application.App])) +def start(app): + selected_app = str(app).lower() + if selected_app == Application.App.APPIUM.value.lower(): + start_appium() + elif selected_app == Application.App.DEVICE.value.lower(): + start_device() + elif selected_app == Application.App.DISPLAY_SCREEN.value.lower(): + start_display_screen() + elif selected_app == Application.App.DISPLAY_WM.value.lower(): + start_display_wm() + elif selected_app == Application.App.PORT_FORWARDER.value.lower(): + start_port_forwarder() + elif selected_app == Application.App.VNC_SERVER.value.lower(): + start_vnc_server() + elif selected_app == Application.App.VNC_WEB.value.lower(): + start_vnc_web() + else: + logger.error(f"application '{selected_app}' is not supported!") + + +class SharedComponent(Enum): + LOG = "log" + + +def shared_log() -> None: + if convert_str_to_bool(os.getenv(ENV.WEB_LOG)): + from http.server import BaseHTTPRequestHandler, HTTPServer + + log_path = get_env_value_or_raise(ENV.LOG_PATH) + log_port = int(get_env_value_or_raise(ENV.WEB_LOG_PORT)) + logger.info(f"Shared log is enabled! all logs can be found on port '{log_port}'") + + class LogSharedHandler(BaseHTTPRequestHandler): + def do_GET(self): + # root path + if self.path == "/": + html = "" + for f in os.listdir(log_path): + html += f"

{f}

" + html += "" + + self.send_response(200) + self.send_header("Content-type", "text/html") + self.end_headers() + self.wfile.write(html.encode()) + # open each selected log file + else: + p = log_path + self.path + try: + with open(p, "rb") as file: + self.send_response(200) + self.send_header("Content-type", "text/plain") + self.end_headers() + self.wfile.write(file.read()) + except FileNotFoundError: + self.send_error(404, "File not found") + + httpd = HTTPServer(('0.0.0.0', log_port), LogSharedHandler) + httpd.serve_forever() + else: + logger.info(f"Shared log is disabled! nothing to do!") + + +@cli.command() +@click.argument("component", type=click.Choice([component.value for component in SharedComponent])) +def share(component): + selected_component = str(component).lower() + if selected_component == SharedComponent.LOG.value.lower(): + shared_log() + else: + logger.error(f"component '{component}' is not supported!") + + +if __name__ == '__main__': + cli() diff --git a/cli/src/application/__init__.py b/cli/src/application/__init__.py new file mode 100644 index 0000000..a8f680f --- /dev/null +++ b/cli/src/application/__init__.py @@ -0,0 +1,35 @@ +import logging +import subprocess + +from enum import Enum + + +class Application: + class App(Enum): + APPIUM = "appium" + DEVICE = "device" + DISPLAY_SCREEN = "display_screen" + DISPLAY_WM = "display_wm" + PORT_FORWARDER = "port_forwarder" + VNC_SERVER = "vnc_server" + VNC_WEB = "vnc_web" + + def __init__(self, name: str, command: str, additional_args: str = "", ui: bool = False) -> None: + self.logger = logging.getLogger(self.__class__.__name__) + self.name = name + self.command = command + self.additional_args = additional_args + self.ui = ui + + def start(self) -> None: + if self.ui: + self.logger.info(f"{self.name} will be started with ui!") + subprocess.check_call(f"/usr/bin/xterm -T {self.name} -n {self.name} " + f"-e '{self.command} {self.additional_args}'", shell=True) + else: + self.logger.info(f"{self.name} will be started without ui!") + subprocess.check_call(f"{self.command} {self.additional_args}", shell=True) + + def __repr__(self) -> str: + return "Application(name={n}, command={c}, args={args}, ui={ui})".format( + n=self.name, c=self.command, args=self.additional_args, ui=self.ui) diff --git a/cli/src/constants/DEVICE.py b/cli/src/constants/DEVICE.py new file mode 100644 index 0000000..940fb02 --- /dev/null +++ b/cli/src/constants/DEVICE.py @@ -0,0 +1,6 @@ +# Status +STATUS_CREATING = "CREATING" +STATUS_STARTING = "STARTING" +STATUS_BOOTING = "BOOTING" +STATUS_RECONFIGURING = "RECONFIGURING" +STATUS_READY = "READY" diff --git a/cli/src/constants/ENV.py b/cli/src/constants/ENV.py new file mode 100644 index 0000000..8a8254c --- /dev/null +++ b/cli/src/constants/ENV.py @@ -0,0 +1,45 @@ +# General +DOCKER_ANDROID_VERSION = "DOCKER_ANDROID_VERSION" +USER_BEHAVIOR_ANALYTICS = "USER_BEHAVIOR_ANALYTICS" +APPIUM = "APPIUM" +APPIUM_ADDITIONAL_ARGS = "APPIUM_ADDITIONAL_ARGS" +DISPLAY = "DISPLAY" +SCREEN_DEPTH = "SCREEN_DEPTH" +SCREEN_HEIGHT = "SCREEN_HEIGHT" +SCREEN_NUMBER = "SCREEN_NUMBER" +SCREEN_WIDTH = "SCREEN_WIDTH" +VNC_PASSWORD = "VNC_PASSWORD" +VNC_PORT = "VNC_PORT" +WEB_VNC_PORT = "WEB_VNC_PORT" +WEB_VNC = "WEB_VNC" +WORK_PATH = "WORK_PATH" +LOG_PATH = "LOG_PATH" +WEB_LOG_PORT = "WEB_LOG_PORT" +WEB_LOG = "WEB_LOG" + +# Device +DEVICE_INTERVAL_WAITING = "DEVICE_INTERVAL_WAITING" +DEVICE_TYPE = "DEVICE_TYPE" + +# Device (Emulator) +EMULATOR_ADDITIONAL_ARGS = "EMULATOR_ADDITIONAL_ARGS" +EMULATOR_ANDROID_VERSION = "EMULATOR_ANDROID_VERSION" +EMULATOR_DATA_PARTITION = "EMULATOR_DATA_PARTITION" +EMULATOR_DEVICE = "EMULATOR_DEVICE" +EMULATOR_IMG_TYPE = "EMULATOR_IMG_TYPE" +EMULATOR_NAME = "EMULATOR_NAME" +EMULATOR_NO_SKIN = "EMULATOR_NO_SKIN" +EMULATOR_SYS_IMG = "EMULATOR_SYS_IMG" + +# Device (Genymotion - General) +GENYMOTION_TEMPLATE_PATH = "GENYMOTION_TEMPLATE_PATH" + +# Device (Geny_SAAS) +GENY_SAAS_USER = "GENY_SAAS_USER" +GENY_SAAS_PASS = "GENY_SAAS_PASS" +GENY_SAAS_TEMPLATE_FILE_NAME = "saas.json" + +# Device (Geny_AWS) +AWS_ACCESS_KEY_ID = "AWS_ACCESS_KEY_ID" +AWS_SECRET_ACCESS_KEY = "AWS_SECRET_ACCESS_KEY" +GENY_AWS_TEMPLATE_FILE_NAME = "aws.json" diff --git a/cli/src/constants/__init__.py b/cli/src/constants/__init__.py new file mode 100644 index 0000000..975d98e --- /dev/null +++ b/cli/src/constants/__init__.py @@ -0,0 +1 @@ +UTF8 = "utf-8" diff --git a/cli/src/device/__init__.py b/cli/src/device/__init__.py new file mode 100644 index 0000000..d125b68 --- /dev/null +++ b/cli/src/device/__init__.py @@ -0,0 +1,172 @@ +import json +import logging +import os +import platform +import requests +import signal +import time + +from abc import ABC, abstractmethod +from enum import Enum + +from src.helper import convert_str_to_bool, get_env_value_or_raise +from src.constants import DEVICE, ENV + + +class DeviceType(Enum): + EMULATOR = "emulator" + GENY_SAAS = "geny_saas" + GENY_AWS = "geny_aws" + + +class Device(ABC): + FORM_ID = "1FAIpQLSdrKWQdMh6Nt8v8NQdYvTIntohebAgqWCpXT3T9NofAoxcpkw" + FORM_USER = "user" + FORM_CITY = "city" + FORM_REGION = "region" + FORM_COUNTRY = "country" + FORM_APP_VERSION = "app_version" + FORM_APPIUM = "appium" + FORM_APPIUM_ADDITIONAL_ARGS = "appium_additional_args" + FORM_WEB_LOG = "web_log" + FORM_WEB_VNC = "web_vnc" + FORM_SCREEN_RESOLUTION = "screen_resolution" + FORM_DEVICE_TYPE = "device_type" + FORM_EMU_DEVICE = "emu_device" + FORM_EMU_ANDROID_VERSION = "emu_android_version" + FORM_EMU_NO_SKIN = "emu_no_skin" + FORM_EMU_DATA_PARTITION = "emu_data_partition" + FORM_EMU_ADDITIONAL_ARGS = "emu_additional_args" + + def __init__(self) -> None: + self.logger = logging.getLogger(self.__class__.__name__) + self.device_type = None + self.interval_waiting = int(os.getenv(ENV.DEVICE_INTERVAL_WAITING, 2)) + self.user_behavior_analytics = convert_str_to_bool(os.getenv(ENV.USER_BEHAVIOR_ANALYTICS, "true")) + self.form_field = { + Device.FORM_USER: "entry.108751316", + Device.FORM_CITY: "entry.2083022547", + Device.FORM_REGION: "entry.1083141079", + Device.FORM_COUNTRY: "entry.1946159560", + Device.FORM_APP_VERSION: "entry.818050927", + Device.FORM_APPIUM: "entry.181610571", + Device.FORM_APPIUM_ADDITIONAL_ARGS: "entry.727759656", + Device.FORM_WEB_LOG: "entry.1225589007", + Device.FORM_WEB_VNC: "entry.2055392048", + Device.FORM_SCREEN_RESOLUTION: "entry.709976626", + Device.FORM_DEVICE_TYPE: "entry.207096546", + Device.FORM_EMU_DEVICE: "entry.1960740382", + Device.FORM_EMU_ANDROID_VERSION: "entry.671872491", + Device.FORM_EMU_NO_SKIN: "entry.403556951", + Device.FORM_EMU_DATA_PARTITION: "entry.1052258875", + Device.FORM_EMU_ADDITIONAL_ARGS: "entry.57529972" + } + self.form_data = {} + signal.signal(signal.SIGTERM, self.tear_down) + + def set_status(self, current_status) -> None: + bashrc_file = f"{os.getenv(ENV.WORK_PATH)}/device_status" + with open(bashrc_file, "w+") as bf: + bf.write(current_status) + # It won't work using docker exec + # os.environ[constants.ENV_DEVICE_STATUS] = current_status + + def _prepare_analytics_payload(self) -> None: + self.form_data.update({ + self.form_field[Device.FORM_USER]: f"{platform.platform()}_{platform.version().replace(' ', '_')}", + self.form_field[Device.FORM_APP_VERSION]: os.getenv(ENV.DOCKER_ANDROID_VERSION), + self.form_field[Device.FORM_DEVICE_TYPE]: self.device_type, + self.form_field[Device.FORM_WEB_VNC]: convert_str_to_bool(os.getenv(ENV.WEB_VNC)), + self.form_field[Device.FORM_WEB_LOG]: convert_str_to_bool(os.getenv(ENV.WEB_LOG)), + self.form_field[Device.FORM_APPIUM]: convert_str_to_bool(os.getenv(ENV.APPIUM)) + }) + + try: + res = requests.get("https://ipinfo.io") + if res.ok: + json_res = res.json() + self.form_data.update({ + self.form_field[Device.FORM_CITY]: json_res[Device.FORM_CITY], + self.form_field[Device.FORM_REGION]: json_res[Device.FORM_REGION], + self.form_field[Device.FORM_COUNTRY]: json_res[Device.FORM_COUNTRY] + }) + except requests.exceptions.RequestException as rer: + self.logger.warning(rer) + pass + except KeyError as ke: + self.logger.warning(ke) + pass + + def create(self) -> None: + if self.user_behavior_analytics: + self.logger.info("Sending user behavior analytics to improve the tool") + try: + form_url = f"https://docs.google.com/forms/d/e/{Device.FORM_ID}/formResponse" + self._prepare_analytics_payload() + requests.post(url=form_url, data=self.form_data) + except requests.exceptions.RequestException as rer: + self.logger.warning(rer) + pass + self.set_status(DEVICE.STATUS_CREATING) + + def start(self) -> None: + self.set_status(DEVICE.STATUS_STARTING) + + def wait_until_ready(self) -> None: + self.set_status(DEVICE.STATUS_BOOTING) + + def reconfigure(self) -> None: + self.set_status(DEVICE.STATUS_RECONFIGURING) + + def keep_alive(self) -> None: + self.set_status(DEVICE.STATUS_READY) + self.logger.warning(f"{self.device_type} process will be kept alive to be able to get sigterm signal...") + while True: + time.sleep(2) + + @abstractmethod + def tear_down(self, *args) -> None: + pass + + +class Genymotion(Device): + def __init__(self) -> None: + super().__init__() + self.logger = logging.getLogger(self.__class__.__name__) + + def get_data_from_template(self, filename: str) -> dict: + path_template_json = os.path.join(get_env_value_or_raise(ENV.GENYMOTION_TEMPLATE_PATH), filename) + data = {} + if os.path.isfile(path_template_json): + try: + self.logger.info(path_template_json) + with open(path_template_json, "r") as f: + data = json.load(f) + except FileNotFoundError as fnf: + self.shutdown_and_logout() + self.logger.error(f"File cannot be found: {fnf}") + except json.JSONDecodeError as jde: + self.shutdown_and_logout() + self.logger.error(f"Error Decoding Json: {jde}") + except Exception as e: + self.shutdown_and_logout() + self.logger.error(e) + else: + self.shutdown_and_logout() + raise RuntimeError(f"'{path_template_json}' cannot be found!") + return data + + @abstractmethod + def login(self) -> None: + pass + + def create(self) -> None: + super().create() + self.login() + + @abstractmethod + def shutdown_and_logout(self) -> None: + pass + + def tear_down(self, *args) -> None: + self.shutdown_and_logout() diff --git a/cli/src/device/emulator.py b/cli/src/device/emulator.py new file mode 100644 index 0000000..d27e576 --- /dev/null +++ b/cli/src/device/emulator.py @@ -0,0 +1,237 @@ +import logging +import os +import subprocess +import time + +from enum import Enum + +from src.device import Device, DeviceType +from src.helper import convert_str_to_bool, get_env_value_or_raise, symlink_force +from src.constants import ENV, UTF8 + + +class Emulator(Device): + DEVICE = ( + "Nexus 4", + "Nexus 5", + "Nexus 7", + "Nexus One", + "Nexus S", + "Samsung Galaxy S6", + "Samsung Galaxy S7", + "Samsung Galaxy S7 Edge", + "Samsung Galaxy S8", + "Samsung Galaxy S9", + "Samsung Galaxy S10" + ) + + API_LEVEL = { + "9.0": "28", + "10.0": "29", + "11.0": "30", + "12.0": "32", + "13.0": "33" + } + + adb_name_id = 5554 + + class ReadinessCheck(Enum): + BOOTED = "booted" + RUN_STATE = "in running state" + WELCOME_SCREEN = "in welcome screen" + POP_UP_WINDOW = "pop up window" + + def __init__(self, name: str, device: str, android_version: str, data_partition: str, + additional_args: str, img_type: str, sys_img: str) -> None: + super().__init__() + self.logger = logging.getLogger(self.__class__.__name__) + self.adb_name = f"emulator-{Emulator.adb_name_id}" + self.device_type = DeviceType.EMULATOR.value + self.name = name + if device in self.DEVICE: + self.device = device + else: + raise RuntimeError(f"device '{device}' is not supported!") + if android_version in self.API_LEVEL.keys(): + self.android_version = android_version + else: + raise RuntimeError(f"android version '{android_version}' is not supported!") + self.api_level = self.API_LEVEL[self.android_version] + self.data_partition = data_partition + self.additional_args = additional_args + self.img_type = img_type + self.sys_img = sys_img + workdir = get_env_value_or_raise(ENV.WORK_PATH) + self.path_device_profile_target = os.path.join(workdir, ".android", "devices.xml") + self.path_emulator = os.path.join(workdir, "emulator") + self.path_emulator_config = os.path.join(workdir, "emulator", "config.ini") + self.path_emulator_profiles = os.path.join(workdir, "docker-android", "mixins", + "configs", "devices", "profiles") + self.path_emulator_skins = os.path.join(workdir, "docker-android", "mixins", + "configs", "devices", "skins") + self.file_name = self.device.replace(" ", "_").lower() + self.no_skin = convert_str_to_bool(os.getenv(ENV.EMULATOR_NO_SKIN)) + self.interval_after_booting = 15 + Emulator.adb_name_id += 2 + self.form_data.update({ + self.form_field[Device.FORM_SCREEN_RESOLUTION]: f"{os.getenv(ENV.SCREEN_WIDTH)}x" + f"{os.getenv(ENV.SCREEN_HEIGHT)}x" + f"{os.getenv(ENV.SCREEN_DEPTH)}", + self.form_field[Device.FORM_EMU_DEVICE]: self.device, + self.form_field[Device.FORM_EMU_ANDROID_VERSION]: self.android_version, + self.form_field[Device.FORM_EMU_NO_SKIN]: self.no_skin, + self.form_field[Device.FORM_EMU_DATA_PARTITION]: self.data_partition, + self.form_field[Device.FORM_EMU_ADDITIONAL_ARGS]: self.additional_args + }) + + def is_initialized(self) -> bool: + import re + if os.path.exists(self.path_emulator_config): + self.logger.info("Config file exists") + with open(self.path_emulator_config, 'r') as f: + if any(re.match(r'hw\.device\.name ?= ?{}'.format(self.device), line) for line in f): + self.logger.info("Selected device is already created") + return True + else: + self.logger.info("Selected device is not created") + return False + + self.logger.info("Config file does not exist") + return False + + def _add_profile(self) -> None: + if "samsung" in self.device.lower(): + path_device_profile_source = os.path.join(self.path_emulator_profiles, + "{fn}.xml".format(fn=self.file_name)) + symlink_force(path_device_profile_source, self.path_device_profile_target) + self.logger.info("Samsung device profile is linked") + + def _add_skin(self) -> None: + device_skin_path = os.path.join( + self.path_emulator_skins, "{fn}".format(fn=self.file_name)) + with open(self.path_emulator_config, "a") as cf: + cf.write("hw.keyboard=yes\n") + cf.write("disk.dataPartition.size={dp}\n".format(dp=self.data_partition)) + cf.write("skin.path={sp}\n".format( + sp="_no_skin" if self.no_skin else device_skin_path)) + self.logger.info(f"Skin is added in: '{self.path_emulator_config}'") + + def create(self) -> None: + super().create() + first_run = not self.is_initialized() + if first_run: + self.logger.info(f"Creating the {self.device_type}...") + self._add_profile() + creation_cmd = "avdmanager create avd -f -n {n} -b {it}/{si} " \ + "-k 'system-images;android-{al};{it};{si}' " \ + "-d {d} -p {pe}".format(n=self.name, it=self.img_type, si=self.sys_img, + al=self.api_level, d=self.device.replace(" ", "\ "), + pe=self.path_emulator) + self.logger.info(f"Command to create emulator: '{creation_cmd}'") + subprocess.check_call(creation_cmd, shell=True) + self._add_skin() + self.logger.info(f"{self.device_type} is created!") + + def change_permission(self) -> None: + kvm_path = "/dev/kvm" + if os.path.exists(kvm_path): + cmds = (f"sudo chown 1300:1301 {kvm_path}", + "sudo sed -i '1d' /etc/passwd") + for c in cmds: + subprocess.check_call(c, shell=True) + self.logger.info("KVM permission is granted!") + else: + raise RuntimeError("/dev/kvm cannot be found!") + + def deploy(self): + self.logger.info(f"Deploying the {self.device_type}") + + basic_cmd = "emulator @{n}".format(n=self.name) + basic_args = "-gpu swiftshader_indirect -accel on -writable-system -verbose" + wipe_arg = "-wipe-data" if not self.is_initialized() else "" + + start_cmd = f"{basic_cmd} {basic_args} {wipe_arg} {self.additional_args}" + self.logger.info(f"Command to run {self.device_type}: '{start_cmd}'") + subprocess.Popen(start_cmd.split()) + + def start(self) -> None: + super().start() + self.change_permission() + self.deploy() + + def check_adb_command(self, readiness_check_type: ReadinessCheck, bash_command: str, + expected_keyword: str, max_attempts: int, interval_waiting_time: int, + adb_action: str = None) -> None: + success = False + for _ in range(1, max_attempts): + if success: + break + else: + try: + output = subprocess.check_output( + bash_command.split()).decode(UTF8) + if expected_keyword in str(output).lower(): + if readiness_check_type is self.ReadinessCheck.POP_UP_WINDOW: + subprocess.check_call(adb_action, shell=True) + else: + self.logger.info( + f"{self.device_type} is {readiness_check_type.value}!") + success = True + else: + self.logger.info(f"[attempt: {_}] {self.device_type} is not {readiness_check_type.value}! " + f"will check again in {interval_waiting_time} seconds") + time.sleep(interval_waiting_time) + except subprocess.CalledProcessError: + self.logger.warning("command cannot be executed! will continue...") + time.sleep(2) + continue + else: + if readiness_check_type is self.ReadinessCheck.POP_UP_WINDOW: + self.logger.info(f"Pop up windows '{expected_keyword}' is not found!") + else: + raise RuntimeError( + f"{readiness_check_type.value} is checked {_} times!") + + def wait_until_ready(self) -> None: + super().wait_until_ready() + booting_cmd = f"adb -s {self.adb_name} wait-for-device shell getprop sys.boot_completed" + focus_cmd = f"adb -s {self.adb_name} shell dumpsys window | grep -i mCurrentFocus" + self.check_adb_command(self.ReadinessCheck.BOOTED, + booting_cmd, "1", 60, self.interval_waiting) + time.sleep(self.interval_after_booting) + + interval_pop_up = 0 + max_attempt_pop_up = 3 + pop_up_system_ui = "Not Responding: com.android.systemui" + system_ui_cmd = f"adb shell su root 'kill $(pidof com.android.systemui)'" + pop_up_key_enter = { + "Not Responding: com.google.android.gms", + "Not Responding: system", + "ConversationListActivity" + } + key_enter_cmd = "adb shell input keyevent KEYCODE_ENTER" + self.check_adb_command(self.ReadinessCheck.POP_UP_WINDOW, focus_cmd, pop_up_system_ui, + max_attempt_pop_up, interval_pop_up, system_ui_cmd) + for pe in pop_up_key_enter: + self.check_adb_command(self.ReadinessCheck.POP_UP_WINDOW, focus_cmd, pe, max_attempt_pop_up, + interval_pop_up, key_enter_cmd) + + self.check_adb_command(self.ReadinessCheck.WELCOME_SCREEN, + focus_cmd, "launcheractivity", 60, self.interval_waiting) + self.logger.info(f"{self.device_type} is ready to use") + + def tear_down(self, *args) -> None: + self.logger.warning("Sigterm is detected! Nothing to do!") + + def __repr__(self) -> str: + try: + return "Emulator(name={n}, device={d}, adb_name={an}, android_version={av}, api_level={al}, " \ + "data_partition={dp}, additional_args={aa}, img_type={it}, sys_img={si}, " \ + "path_device_profile_target={pdpt}, path_emulator={pe}, path_emulator_config={pec}, " \ + "file={f})".format(n=self.name, d=self.device, an=self.adb_name, av=self.android_version, + al=self.api_level, dp=self.data_partition, aa=self.additional_args, + it=self.img_type, si=self.sys_img, pdpt=self.path_device_profile_target, + pe=self.path_emulator, pec=self.path_emulator_config, f=self.file_name) + except AttributeError as ae: + self.logger.error(ae) + return "" diff --git a/cli/src/device/geny_aws.py b/cli/src/device/geny_aws.py new file mode 100644 index 0000000..f15d40d --- /dev/null +++ b/cli/src/device/geny_aws.py @@ -0,0 +1,223 @@ +import json +import logging +import os +import shutil +import subprocess +import time + +from src.device import Genymotion, DeviceType +from src.helper import get_env_value_or_raise +from src.constants import ENV, UTF8 + + +class GenyAWS(Genymotion): + port = 5555 + + def __init__(self) -> None: + super().__init__() + self.logger = logging.getLogger(self.__class__.__name__) + self.device_type = DeviceType.GENY_AWS.value + self.workdir = get_env_value_or_raise(ENV.WORK_PATH) + self.aws_credentials_path = os.path.join(self.workdir, ".aws") + self.remove_cred_at_the_end = False # for logout + self.geny_aws_template_path = os.path.join(self.workdir, "docker-android", "mixins", + "templates", "genymotion", "aws") + self.created_devices = {} + + def login(self) -> None: + aws_credentials_file = os.path.join(self.aws_credentials_path, "credentials") + if os.path.exists(self.aws_credentials_path): + self.logger.info(".aws is found! It will be used as credentials") + else: + self.logger.info(".aws cannot be found! the template will be used!") + self.remove_cred_at_the_end = True + aws_credentials_template_path = os.path.join(self.geny_aws_template_path, ".aws") + shutil.move(aws_credentials_template_path, self.aws_credentials_path) + + aws_key_id = get_env_value_or_raise(ENV.AWS_ACCESS_KEY_ID) + aws_secret_key = get_env_value_or_raise(ENV.AWS_SECRET_ACCESS_KEY) + replacements_cred = { + f"<{ENV.AWS_ACCESS_KEY_ID.lower()}>": aws_key_id, + f"<{ENV.AWS_SECRET_ACCESS_KEY.lower()}>": aws_secret_key + } + with open(aws_credentials_file, 'r+') as cred_file: + cred_file_contents = cred_file.read() + for old_str, new_str in replacements_cred.items(): + cred_file_contents = cred_file_contents.replace(old_str, new_str) + cred_file.seek(0) + cred_file.write(cred_file_contents) + cred_file.truncate() + self.logger.info("aws credentials is set!") + + def create_ssh_key(self) -> None: + subprocess.check_call('ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa -N ""', shell=True) + self.logger.info("ssh key is created!") + + def create_tf_files(self) -> None: + try: + for item in self.get_data_from_template(ENV.GENY_AWS_TEMPLATE_FILE_NAME): + name = item["name"] + region = item["region"] + ami = item["ami"] + instance_type = item["instance_type"] + if "security_group" in item: + sg = item["security_group"] + tf_content = f''' + provider "aws" {{ + alias = "provider_{name}" + region = "{region}" + }} + + resource "aws_key_pair" "geny_key_{name}" {{ + provider = aws.provider_{name} + public_key = file("~/.ssh/id_rsa.pub") + }} + + resource "aws_instance" "geny_aws_{name}" {{ + provider = aws.provider_{name} + ami = "{ami}" + instance_type = "{instance_type}" + vpc_security_group_ids = ["{sg}"] + key_name = aws_key_pair.geny_key_{name}.key_name + tags = {{ + Name = "DockerAndroid-GenyAWS-{ami}.id}}" + }} + + provisioner "remote-exec" {{ + connection {{ + type = "ssh" + user = "shell" + host = self.public_ip + private_key = file("~/.ssh/id_rsa") + }} + script = "/home/androidusr/docker-android/mixins/scripts/genymotion/aws/enable_adb.sh" + }} + }} + + output "public_dns_{name}" {{ + value = aws_instance.geny_aws_{name}.public_dns + }} + ''' + else: + ingress_rules = json.dumps(item["ingress_rules"]) + egress_rules = json.dumps(item["egress_rules"]) + tf_content = f''' + locals {{ + ingress_rules = {ingress_rules} + egress_rules = {egress_rules} + }} + + provider "aws" {{ + alias = "provider_{name}" + region = "{region}" + }} + + resource "aws_security_group" "geny_sg_{name}" {{ + provider = aws.provider_{name} + dynamic "ingress" {{ + for_each = local.ingress_rules + content {{ + from_port = ingress.value.from_port + to_port = ingress.value.to_port + protocol = ingress.value.protocol + cidr_blocks = ingress.value.cidr_blocks + }} + }} + + dynamic "egress" {{ + for_each = local.egress_rules + content {{ + from_port = egress.value.from_port + to_port = egress.value.to_port + protocol = egress.value.protocol + cidr_blocks = egress.value.cidr_blocks + }} + }} + }} + + resource "aws_key_pair" "geny_key_{name}" {{ + provider = aws.provider_{name} + public_key = file("~/.ssh/id_rsa.pub") + }} + + resource "aws_instance" "geny_aws_{name}" {{ + provider = aws.provider_{name} + ami = "{ami}" + instance_type = "{instance_type}" + vpc_security_group_ids = [aws_security_group.geny_sg_{name}.name] + key_name = aws_key_pair.geny_key_{name}.key_name + tags = {{ + Name = "DockerAndroid-GenyAWS-{ami}.id}}" + }} + + provisioner "remote-exec" {{ + connection {{ + type = "ssh" + user = "shell" + host = self.public_ip + private_key = file("~/.ssh/id_rsa") + }} + script = "/home/androidusr/docker-android/mixins/scripts/genymotion/aws/enable_adb.sh" + }} + }} + + output "public_dns_{name}" {{ + value = aws_instance.geny_aws_{name}.public_dns + }} + ''' + tf_deployment_filename = f"{name}.tf" + self.created_devices[name] = GenyAWS.port + GenyAWS.port += 1 + with open(tf_deployment_filename, "w") as df: + df.write(tf_content) + self.logger.info("Terraform files are created!") + except Exception as e: + self.logger.error(e) + self.shutdown_and_logout() + + def deploy_tf(self) -> None: + try: + cmds = ( + "terraform init", + "terraform plan", + "terraform apply -auto-approve" + ) + for c in cmds: + subprocess.check_call(c, shell=True) + self.logger.info("Genymotion-Device(s) are deployed on AWS") + except subprocess.CalledProcessError as cpe: + self.logger.error(cpe) + self.shutdown_and_logout() + + def connect_with_local_adb(self) -> None: + self.logger.info(f"created devices: {self.created_devices}") + try: + for d, p in self.created_devices.items(): + dns_cmd = f"terraform output public_dns_{d}" + dns_ip = subprocess.check_output(dns_cmd.split()).decode(UTF8).replace('"', '') + tunnel_cmd = f"ssh -i ~/.ssh/id_rsa -o ServerAliveInterval=60 -o StrictHostKeyChecking=no -q -NL " \ + f"{p}:localhost:5555 shell@{dns_ip}" + subprocess.Popen(tunnel_cmd.split()) + time.sleep(10) + subprocess.check_call(f"adb connect localhost:{p} >/dev/null 2>&1", shell=True) + except Exception as e: + self.logger.error(e) + self.shutdown_and_logout() + + def create(self) -> None: + super().create() + self.create_ssh_key() + self.create_tf_files() + self.deploy_tf() + self.connect_with_local_adb() + + def shutdown_and_logout(self) -> None: + try: + subprocess.check_call("terraform destroy -auto-approve -lock=false", shell=True) + self.logger.info("device(s) is successfully removed!") + except subprocess.CalledProcessError as cpe: + self.logger.error(cpe) + finally: + if self.remove_cred_at_the_end: + subprocess.check_call(f"rm -rf {self.aws_credentials_path}", shell=True) + self.logger.info("successfully logged out!") diff --git a/cli/src/device/geny_saas.py b/cli/src/device/geny_saas.py new file mode 100644 index 0000000..75ed073 --- /dev/null +++ b/cli/src/device/geny_saas.py @@ -0,0 +1,72 @@ +import logging +import subprocess + +from src.device import Genymotion, DeviceType +from src.helper import get_env_value_or_raise +from src.constants import ENV, UTF8 + + +class GenySAAS(Genymotion): + def __init__(self) -> None: + super().__init__() + self.logger = logging.getLogger(self.__class__.__name__) + self.device_type = DeviceType.GENY_SAAS.value + self.created_devices = [] + + def login(self) -> None: + user = get_env_value_or_raise(ENV.GENY_SAAS_USER) + password = get_env_value_or_raise(ENV.GENY_SAAS_PASS) + subprocess.check_call(f"gmsaas auth login {user} {password} > /dev/null 2>&1", shell=True) + self.logger.info("successfully logged in!") + + def create(self) -> None: + super().create() + for item in self.get_data_from_template(ENV.GENY_SAAS_TEMPLATE_FILE_NAME): + name = "" + template = "" + local_port = "" + + # implement like this because local_port param is not a must + for k, v in item.items(): + if k.lower() == "name": + name = v + elif k.lower() == "template": + template = v + elif k.lower() == "local_port": + local_port = v + else: + self.logger.warning(f"'{k}' is not supported! Please check the documentation!") + + if not name: + import uuid + name = str(uuid.uuid4()) + + if not template: + self.shutdown_and_logout() + raise RuntimeError(f"'template' is a must parameter and not given!") + else: + self.logger.info(f"name: {name}, template: {template}") + creation_cmd = f"gmsaas instances start {template} {name}" + try: + instance_id = subprocess.check_output(creation_cmd.split()).decode(UTF8).replace("\n", "") + created_device = {f"{name}": {instance_id}} + self.created_devices.append(created_device) + additional_args = "" + if local_port: + additional_args = f"--adb-serial-port {local_port}" + connect_cmd = f"gmsaas instances adbconnect {instance_id} {additional_args}" + subprocess.check_call(f"{connect_cmd}", shell=True) + except Exception as e: + self.shutdown_and_logout() + self.logger.error(e) + exit(1) + + def shutdown_and_logout(self) -> None: + if bool(self.created_devices): + self.logger.info("Created device(s) will be removed!") + for d in self.created_devices: + for n, i in d.items(): + subprocess.check_call(f"gmsaas instances stop {i}", shell=True) + self.logger.info(f"device '{n}' is successfully removed!") + subprocess.check_call("gmsaas auth logout", shell=True) + self.logger.info("successfully logged out!") diff --git a/cli/src/helper/__init__.py b/cli/src/helper/__init__.py new file mode 100644 index 0000000..7e19691 --- /dev/null +++ b/cli/src/helper/__init__.py @@ -0,0 +1,56 @@ +import logging +import os + +logger = logging.getLogger("helper") + + +def convert_str_to_bool(given_str: str) -> bool: + """ + Convert String to Boolean value + + :param given_str: given string + :return: converted string in Boolean + """ + if given_str: + if type(given_str) is str: + return given_str.lower() in ("yes", "true", "t", "1") + else: + raise AttributeError + else: + logger.info(f"'{given_str}' is empty!") + return False + + +def get_env_value_or_raise(env_key: str) -> str: + """ + Get value of necessary environment variable. + + :param env_key: given environment variable + :return: env_value in String + """ + try: + env_value = os.getenv(env_key) + if not env_value: + raise RuntimeError(f"'{env_key}' is missing.") + elif env_value.isspace(): + raise RuntimeError(f"'{env_key}' contains only white space.") + return env_value + except TypeError as t_err: + logger.error(t_err) + + +def symlink_force(source: str, target: str) -> None: + """ + Create Symbolic link + + :param source: source file + :param target: target file + :return: None + """ + try: + os.symlink(source, target) + except FileNotFoundError as ffe_err: + logger.error(ffe_err) + except FileExistsError: + os.remove(target) + os.symlink(source, target) diff --git a/cli/src/logger/__init__.py b/cli/src/logger/__init__.py new file mode 100644 index 0000000..2021f52 --- /dev/null +++ b/cli/src/logger/__init__.py @@ -0,0 +1,3 @@ +import os + +LOGGING_FILE = os.path.join(os.path.dirname(__file__), 'logging.conf') diff --git a/src/log.py b/cli/src/logger/log.py similarity index 55% rename from src/log.py rename to cli/src/logger/log.py index 36cf476..b9b1d46 100644 --- a/src/log.py +++ b/cli/src/logger/log.py @@ -1,9 +1,7 @@ -import logging import logging.config -from src import LOGGING_FILE +from src.logger import LOGGING_FILE def init(): - """Init log.""" logging.config.fileConfig(LOGGING_FILE) diff --git a/src/logging.conf b/cli/src/logger/logging.conf similarity index 59% rename from src/logging.conf rename to cli/src/logger/logging.conf index 018340a..c89d346 100644 --- a/src/logging.conf +++ b/cli/src/logger/logging.conf @@ -1,5 +1,5 @@ [loggers] -keys=root, app +keys=root [handlers] keys=console @@ -11,16 +11,11 @@ keys=formatter level=INFO handlers=console -[logger_app] -level=INFO -handlers=console -propagate=0 -qualname=app - [handler_console] class=StreamHandler formatter=formatter args=(sys.stdout,) [formatter_formatter] -format=[%(process)2d] [%(levelname)5s] %(name)s - %(message)s +format=%(asctime)s %(levelname)s %(name)s - %(message)s +datefmt=%Y-%m-%d %H:%M:%S diff --git a/cli/src/tests/__init__.py b/cli/src/tests/__init__.py new file mode 100644 index 0000000..ea27d1b --- /dev/null +++ b/cli/src/tests/__init__.py @@ -0,0 +1,9 @@ +from unittest import TestCase + + +class BaseTest(TestCase): + def setUp(self) -> None: + pass + + def tearDown(self) -> None: + pass diff --git a/cli/src/tests/device/__init__.py b/cli/src/tests/device/__init__.py new file mode 100644 index 0000000..ac2a226 --- /dev/null +++ b/cli/src/tests/device/__init__.py @@ -0,0 +1,21 @@ +import os + +from src.constants import ENV +from src.tests import BaseTest + + +class BaseDeviceTest(BaseTest): + DEVICE_ENVS = { + ENV.WORK_PATH: "/home/androidusr", + ENV.USER_BEHAVIOR_ANALYTICS: str(False), + ENV.EMULATOR_NO_SKIN: str(False) + } + + def setUp(self) -> None: + for k, v in self.DEVICE_ENVS.items(): + os.environ[k] = v + + def tearDown(self) -> None: + for k in self.DEVICE_ENVS.keys(): + if os.environ[k]: + del os.environ[k] diff --git a/cli/src/tests/device/test_device.py b/cli/src/tests/device/test_device.py new file mode 100644 index 0000000..b7d2e04 --- /dev/null +++ b/cli/src/tests/device/test_device.py @@ -0,0 +1,8 @@ +from src.device import Device +from src.tests.device import BaseDeviceTest + + +class TestDevice(BaseDeviceTest): + def test_create_device(self): + with self.assertRaises(TypeError): + Device() diff --git a/cli/src/tests/device/test_emulator.py b/cli/src/tests/device/test_emulator.py new file mode 100644 index 0000000..9661031 --- /dev/null +++ b/cli/src/tests/device/test_emulator.py @@ -0,0 +1,87 @@ +import mock + +from src.device.emulator import Emulator +from src.tests.device import BaseDeviceTest + + +class TestEmulator(BaseDeviceTest): + def setUp(self) -> None: + super().setUp() + self.name = "my_emu" + self.device = "Nexus 4" + self.a_version = "10.0" + self.d_partition = "550m" + self.additional_args = "" + self.i_type = "google_apis" + self.s_img = "x86" + self.emu = Emulator(self.name, self.device, self.a_version, self.d_partition, + self.additional_args, self.i_type, self.s_img) + + def tearDown(self) -> None: + super().tearDown() + + def test_adb_name(self): + my_emu = Emulator("my_other_emu", self.device, self.a_version, self.d_partition, + self.additional_args, self.i_type, self.s_img) + self.assertNotEqual(self.emu.adb_name, my_emu.adb_name) + + def test_invalid_device(self): + with self.assertRaises(RuntimeError): + Emulator("my_other_emu", "unknown device", self.a_version, self.d_partition, + self.additional_args, self.i_type, self.s_img) + with self.assertRaises(RuntimeError): + Emulator("my_other_emu", "NEXUS 5", self.a_version, self.d_partition, + self.additional_args, self.i_type, self.s_img) + + def test_invalid_android_version(self): + with self.assertRaises(RuntimeError): + Emulator("my_other_emu", self.device, "0.0", self.d_partition, + self.additional_args, self.i_type, self.s_img) + + @mock.patch("os.path.exists", mock.MagicMock(return_value=False)) + def test_initialisation_config_not_exist(self): + self.assertEqual(self.emu.is_initialized(), False) + + @mock.patch("os.path.exists", mock.MagicMock(return_value=True)) + @mock.patch("builtins.open", mock.mock_open(read_data="")) + def test_initialisation_device_not_exist(self): + self.assertEqual(self.emu.is_initialized(), False) + + @mock.patch("os.path.exists", mock.MagicMock(return_value=True)) + @mock.patch("builtins.open", mock.mock_open(read_data="hw.device.name=Nexus 4\n")) + def test_initialisation_device_exists(self): + self.assertEqual(self.emu.is_initialized(), True) + + @mock.patch("src.device.Device.set_status") + @mock.patch("src.device.emulator.Emulator._add_profile") + @mock.patch("subprocess.check_call") + @mock.patch("src.device.emulator.Emulator._add_skin") + @mock.patch("src.device.emulator.Emulator.is_initialized", mock.MagicMock(return_value=False)) + def test_create_device_not_exist(self, mocked_status, mocked_profile, mocked_subprocess, mocked_skin): + self.emu.create() + self.assertEqual(mocked_status.called, True) + self.assertEqual(mocked_profile.called, True) + self.assertEqual(mocked_subprocess.called, True) + self.assertEqual(mocked_skin.called, True) + + @mock.patch("src.device.Device.set_status") + @mock.patch("src.device.emulator.Emulator._add_profile") + @mock.patch("subprocess.check_call") + @mock.patch("src.device.emulator.Emulator._add_skin") + @mock.patch("src.device.emulator.Emulator.is_initialized", mock.MagicMock(return_value=True)) + def test_create_device_exists(self, mocked_status, mocked_profile, mocked_subprocess, mocked_skin): + self.emu.create() + self.assertEqual(mocked_status.called, False) + self.assertEqual(mocked_profile.called, False) + self.assertEqual(mocked_subprocess.called, False) + + def test_check_adb_command(self): + with mock.patch("subprocess.check_output", mock.MagicMock(return_value="1".encode("utf-8"))): + self.emu.check_adb_command( + self.emu.ReadinessCheck.BOOTED, "mocked_command", "1", 3, 0) + + def test_check_adb_command_out_of_attempts(self): + with mock.patch("subprocess.check_output", mock.MagicMock(return_value=" ".encode("utf-8"))): + with self.assertRaises(RuntimeError): + self.emu.check_adb_command( + self.emu.ReadinessCheck.BOOTED, "mocked_command", "1", 3, 0) diff --git a/src/tests/e2e/__init__.py b/cli/src/tests/helper/__init__.py similarity index 100% rename from src/tests/e2e/__init__.py rename to cli/src/tests/helper/__init__.py diff --git a/cli/src/tests/helper/test_helper.py b/cli/src/tests/helper/test_helper.py new file mode 100644 index 0000000..8d87373 --- /dev/null +++ b/cli/src/tests/helper/test_helper.py @@ -0,0 +1,73 @@ +import os +import mock + +from src.helper import convert_str_to_bool, get_env_value_or_raise, symlink_force +from src.tests import BaseTest + + +class TestHelperMethods(BaseTest): + def test_boolean_converter_with_valid_str(self): + self.assertEqual(convert_str_to_bool("TRUE"), True) + self.assertEqual(convert_str_to_bool("true"), True) + self.assertEqual(convert_str_to_bool("T"), True) + self.assertEqual(convert_str_to_bool("Yes"), True) + self.assertEqual(convert_str_to_bool("1"), True) + self.assertEqual(convert_str_to_bool("False"), False) + self.assertEqual(convert_str_to_bool("f"), False) + self.assertEqual(convert_str_to_bool("0"), False) + + def test_boolean_converter_with_empty(self): + self.assertEqual(convert_str_to_bool(None), False) + self.assertEqual(convert_str_to_bool(""), False) + + def test_boolean_converter_with_invalid_str(self): + self.assertEqual(convert_str_to_bool(" "), False) + self.assertEqual(convert_str_to_bool("test"), False) + + def test_boolean_converter_with_invalid_format(self): + with self.assertRaises(AttributeError): + convert_str_to_bool(True) + + def test_get_env_value_from_valid_key(self): + env_key = "env_key01" + os.environ[env_key] = "env_value01" + get_env_value_or_raise(env_key) + del os.environ[env_key] + + def test_get_env_value_with_empty_string(self): + with self.assertRaises(RuntimeError): + env_key = "env_key01" + os.environ[env_key] = " " + get_env_value_or_raise(env_key) + del os.environ[env_key] + + def test_get_env_value_from_invalid_key(self): + with self.assertRaises(RuntimeError): + get_env_value_or_raise("env_key02") + + def test_get_env_value_with_invalid_format(self): + with mock.patch("src.logger"): + get_env_value_or_raise(True) + + def test_symlink(self): + s = os.path.join("source.txt") + t = os.path.join("target_file.txt") + open(s, "a").close() + symlink_force(s, t) + os.remove(s) + os.remove(t) + + def test_symlink_already_exist(self): + s = os.path.join("source.txt") + t = os.path.join("target_file.txt") + open(s, "a").close() + open(t, "a").close() + symlink_force(s, t) + os.remove(s) + os.remove(t) + + def test_symlink_file_not_exists(self): + s = os.path.join("source.txt") + t = os.path.join("target_file.txt") + symlink_force(s, t) + os.remove(t) diff --git a/cli/test-results/.gitignore b/cli/test-results/.gitignore new file mode 100644 index 0000000..5e7d273 --- /dev/null +++ b/cli/test-results/.gitignore @@ -0,0 +1,4 @@ +# Ignore everything in this directory +* +# Except this file +!.gitignore diff --git a/devices/skins/galaxy_nexus/land_back.png b/devices/skins/galaxy_nexus/land_back.png deleted file mode 100644 index 4563224..0000000 Binary files a/devices/skins/galaxy_nexus/land_back.png and /dev/null differ diff --git a/devices/skins/galaxy_nexus/land_fore.png b/devices/skins/galaxy_nexus/land_fore.png deleted file mode 100644 index 01f0d25..0000000 Binary files a/devices/skins/galaxy_nexus/land_fore.png and /dev/null differ diff --git a/devices/skins/galaxy_nexus/land_shadow.png b/devices/skins/galaxy_nexus/land_shadow.png deleted file mode 100644 index ab607e1..0000000 Binary files a/devices/skins/galaxy_nexus/land_shadow.png and /dev/null differ diff --git a/devices/skins/galaxy_nexus/layout b/devices/skins/galaxy_nexus/layout deleted file mode 100644 index fcbe482..0000000 --- a/devices/skins/galaxy_nexus/layout +++ /dev/null @@ -1,59 +0,0 @@ -parts { - device { - display { - width 720 - height 1280 - x 0 - y 0 - } - } - portrait { - background { - image port_back.png - } - onion { - image port_fore.png - } - } - landscape { - background { - image land_back.png - } - onion { - image land_fore.png - } - } -} -layouts { - portrait { - width 1101 - height 1709 - event EV_SW:0:1 - part1 { - name portrait - x 0 - y 0 - } - part2 { - name device - x 192 - y 213 - } - } - landscape { - width 1847 - height 886 - event EV_SW:0:0 - part1 { - name landscape - x 0 - y 0 - } - part2 { - name device - x 304 - y 788 - rotation 3 - } - } -} diff --git a/devices/skins/galaxy_nexus/port_back.png b/devices/skins/galaxy_nexus/port_back.png deleted file mode 100644 index e43fb2b..0000000 Binary files a/devices/skins/galaxy_nexus/port_back.png and /dev/null differ diff --git a/devices/skins/galaxy_nexus/port_fore.png b/devices/skins/galaxy_nexus/port_fore.png deleted file mode 100644 index afe6429..0000000 Binary files a/devices/skins/galaxy_nexus/port_fore.png and /dev/null differ diff --git a/devices/skins/galaxy_nexus/port_shadow.png b/devices/skins/galaxy_nexus/port_shadow.png deleted file mode 100644 index 7cea0a1..0000000 Binary files a/devices/skins/galaxy_nexus/port_shadow.png and /dev/null differ diff --git a/devices/skins/galaxy_nexus/thumb.png b/devices/skins/galaxy_nexus/thumb.png deleted file mode 100644 index e21a421..0000000 Binary files a/devices/skins/galaxy_nexus/thumb.png and /dev/null differ diff --git a/devices/skins/nexus_10/land_back.png b/devices/skins/nexus_10/land_back.png deleted file mode 100644 index 4fbe3f0..0000000 Binary files a/devices/skins/nexus_10/land_back.png and /dev/null differ diff --git a/devices/skins/nexus_10/land_fore.png b/devices/skins/nexus_10/land_fore.png deleted file mode 100644 index dc69b5b..0000000 Binary files a/devices/skins/nexus_10/land_fore.png and /dev/null differ diff --git a/devices/skins/nexus_10/land_shadow.png b/devices/skins/nexus_10/land_shadow.png deleted file mode 100644 index 77116ea..0000000 Binary files a/devices/skins/nexus_10/land_shadow.png and /dev/null differ diff --git a/devices/skins/nexus_10/layout b/devices/skins/nexus_10/layout deleted file mode 100644 index be3a0b6..0000000 --- a/devices/skins/nexus_10/layout +++ /dev/null @@ -1,59 +0,0 @@ -parts { - device { - display { - width 1600 - height 2560 - x 0 - y 0 - } - } - portrait { - background { - image port_back.png - } - onion { - image port_fore.png - } - } - landscape { - background { - image land_back.png - } - onion { - image land_fore.png - } - } -} -layouts { - portrait { - width 2330 - height 3136 - event EV_SW:0:1 - part1 { - name portrait - x 0 - y 0 - } - part2 { - name device - x 366 - y 266 - } - } - landscape { - width 3340 - height 2176 - event EV_SW:0:0 - part1 { - name landscape - x 0 - y 0 - } - part2 { - name device - x 388 - y 1866 - rotation 3 - } - } -} diff --git a/devices/skins/nexus_10/port_back.png b/devices/skins/nexus_10/port_back.png deleted file mode 100644 index 07e60ff..0000000 Binary files a/devices/skins/nexus_10/port_back.png and /dev/null differ diff --git a/devices/skins/nexus_10/port_fore.png b/devices/skins/nexus_10/port_fore.png deleted file mode 100644 index cf4f664..0000000 Binary files a/devices/skins/nexus_10/port_fore.png and /dev/null differ diff --git a/devices/skins/nexus_10/port_shadow.png b/devices/skins/nexus_10/port_shadow.png deleted file mode 100644 index 555f1e8..0000000 Binary files a/devices/skins/nexus_10/port_shadow.png and /dev/null differ diff --git a/devices/skins/nexus_10/thumb.png b/devices/skins/nexus_10/thumb.png deleted file mode 100644 index ec12a01..0000000 Binary files a/devices/skins/nexus_10/thumb.png and /dev/null differ diff --git a/devices/skins/nexus_5x/land_back.png b/devices/skins/nexus_5x/land_back.png deleted file mode 100644 index a1dbf0b..0000000 Binary files a/devices/skins/nexus_5x/land_back.png and /dev/null differ diff --git a/devices/skins/nexus_5x/land_fore.png b/devices/skins/nexus_5x/land_fore.png deleted file mode 100644 index d09c434..0000000 Binary files a/devices/skins/nexus_5x/land_fore.png and /dev/null differ diff --git a/devices/skins/nexus_5x/land_shadow.png b/devices/skins/nexus_5x/land_shadow.png deleted file mode 100644 index f3385ee..0000000 Binary files a/devices/skins/nexus_5x/land_shadow.png and /dev/null differ diff --git a/devices/skins/nexus_5x/layout b/devices/skins/nexus_5x/layout deleted file mode 100644 index 937743b..0000000 --- a/devices/skins/nexus_5x/layout +++ /dev/null @@ -1,59 +0,0 @@ -parts { - device { - display { - width 1080 - height 1920 - x 0 - y 0 - } - } - portrait { - background { - image port_back.png - } - onion { - image port_fore.png - } - } - landscape { - background { - image land_back.png - } - onion { - image land_fore.png - } - } -} -layouts { - portrait { - width 1370 - height 2446 - event EV_SW:0:1 - part1 { - name portrait - x 0 - y 0 - } - part2 { - name device - x 147 - y 233 - } - } - landscape { - width 2497 - height 1234 - event EV_SW:0:0 - part1 { - name landscape - x 0 - y 0 - } - part2 { - name device - x 278 - y 1143 - rotation 3 - } - } -} diff --git a/devices/skins/nexus_5x/port_back.png b/devices/skins/nexus_5x/port_back.png deleted file mode 100644 index 01933a5..0000000 Binary files a/devices/skins/nexus_5x/port_back.png and /dev/null differ diff --git a/devices/skins/nexus_5x/port_fore.png b/devices/skins/nexus_5x/port_fore.png deleted file mode 100644 index b19b106..0000000 Binary files a/devices/skins/nexus_5x/port_fore.png and /dev/null differ diff --git a/devices/skins/nexus_5x/port_shadow.png b/devices/skins/nexus_5x/port_shadow.png deleted file mode 100644 index 851db21..0000000 Binary files a/devices/skins/nexus_5x/port_shadow.png and /dev/null differ diff --git a/devices/skins/nexus_6/land_back.png b/devices/skins/nexus_6/land_back.png deleted file mode 100644 index bc6bd5b..0000000 Binary files a/devices/skins/nexus_6/land_back.png and /dev/null differ diff --git a/devices/skins/nexus_6/land_fore.png b/devices/skins/nexus_6/land_fore.png deleted file mode 100644 index 38cefcc..0000000 Binary files a/devices/skins/nexus_6/land_fore.png and /dev/null differ diff --git a/devices/skins/nexus_6/land_shadow.png b/devices/skins/nexus_6/land_shadow.png deleted file mode 100644 index 2fcc542..0000000 Binary files a/devices/skins/nexus_6/land_shadow.png and /dev/null differ diff --git a/devices/skins/nexus_6/layout b/devices/skins/nexus_6/layout deleted file mode 100644 index fe01c10..0000000 --- a/devices/skins/nexus_6/layout +++ /dev/null @@ -1,59 +0,0 @@ -parts { - device { - display { - width 1440 - height 2560 - x 0 - y 0 - } - } - portrait { - background { - image port_back.png - } - onion { - image port_fore.png - } - } - landscape { - background { - image land_back.png - } - onion { - image land_fore.png - } - } -} -layouts { - portrait { - width 1896 - height 3054 - event EV_SW:0:1 - part1 { - name portrait - x 0 - y 0 - } - part2 { - name device - x 229 - y 239 - } - } - landscape { - width 3142 - height 1639 - event EV_SW:0:0 - part1 { - name landscape - x 0 - y 0 - } - part2 { - name device - x 318 - y 1516 - rotation 3 - } - } -} diff --git a/devices/skins/nexus_6/port_back.png b/devices/skins/nexus_6/port_back.png deleted file mode 100644 index 0535439..0000000 Binary files a/devices/skins/nexus_6/port_back.png and /dev/null differ diff --git a/devices/skins/nexus_6/port_fore.png b/devices/skins/nexus_6/port_fore.png deleted file mode 100644 index f8821ba..0000000 Binary files a/devices/skins/nexus_6/port_fore.png and /dev/null differ diff --git a/devices/skins/nexus_6/port_shadow.png b/devices/skins/nexus_6/port_shadow.png deleted file mode 100644 index 57e1800..0000000 Binary files a/devices/skins/nexus_6/port_shadow.png and /dev/null differ diff --git a/devices/skins/nexus_6p/land_back.png b/devices/skins/nexus_6p/land_back.png deleted file mode 100644 index f1790cd..0000000 Binary files a/devices/skins/nexus_6p/land_back.png and /dev/null differ diff --git a/devices/skins/nexus_6p/land_fore.png b/devices/skins/nexus_6p/land_fore.png deleted file mode 100644 index 566df98..0000000 Binary files a/devices/skins/nexus_6p/land_fore.png and /dev/null differ diff --git a/devices/skins/nexus_6p/land_shadow.png b/devices/skins/nexus_6p/land_shadow.png deleted file mode 100644 index 036a295..0000000 Binary files a/devices/skins/nexus_6p/land_shadow.png and /dev/null differ diff --git a/devices/skins/nexus_6p/layout b/devices/skins/nexus_6p/layout deleted file mode 100644 index fff8a05..0000000 --- a/devices/skins/nexus_6p/layout +++ /dev/null @@ -1,59 +0,0 @@ -parts { - device { - display { - width 1440 - height 2560 - x 0 - y 0 - } - } - portrait { - background { - image port_back.png - } - onion { - image port_fore.png - } - } - landscape { - background { - image land_back.png - } - onion { - image land_fore.png - } - } -} -layouts { - portrait { - width 1840 - height 3251 - event EV_SW:0:1 - part1 { - name portrait - x 0 - y 0 - } - part2 { - name device - x 195 - y 329 - } - } - landscape { - width 3427 - height 1620 - event EV_SW:0:0 - part1 { - name landscape - x 0 - y 0 - } - part2 { - name device - x 442 - y 1511 - rotation 3 - } - } -} diff --git a/devices/skins/nexus_6p/port_back.png b/devices/skins/nexus_6p/port_back.png deleted file mode 100644 index 710ad89..0000000 Binary files a/devices/skins/nexus_6p/port_back.png and /dev/null differ diff --git a/devices/skins/nexus_6p/port_fore.png b/devices/skins/nexus_6p/port_fore.png deleted file mode 100644 index 40044e5..0000000 Binary files a/devices/skins/nexus_6p/port_fore.png and /dev/null differ diff --git a/devices/skins/nexus_6p/port_shadow.png b/devices/skins/nexus_6p/port_shadow.png deleted file mode 100644 index b19fc4f..0000000 Binary files a/devices/skins/nexus_6p/port_shadow.png and /dev/null differ diff --git a/devices/skins/nexus_9/land_back.png b/devices/skins/nexus_9/land_back.png deleted file mode 100644 index 909d728..0000000 Binary files a/devices/skins/nexus_9/land_back.png and /dev/null differ diff --git a/devices/skins/nexus_9/land_fore.png b/devices/skins/nexus_9/land_fore.png deleted file mode 100644 index c79ab88..0000000 Binary files a/devices/skins/nexus_9/land_fore.png and /dev/null differ diff --git a/devices/skins/nexus_9/land_shadow.png b/devices/skins/nexus_9/land_shadow.png deleted file mode 100644 index fdc09ed..0000000 Binary files a/devices/skins/nexus_9/land_shadow.png and /dev/null differ diff --git a/devices/skins/nexus_9/layout b/devices/skins/nexus_9/layout deleted file mode 100644 index 5743f19..0000000 --- a/devices/skins/nexus_9/layout +++ /dev/null @@ -1,59 +0,0 @@ -parts { - device { - display { - width 1536 - height 2048 - x 0 - y 0 - } - } - portrait { - background { - image port_back.png - } - onion { - image port_fore.png - } - } - landscape { - background { - image land_back.png - } - onion { - image land_fore.png - } - } -} -layouts { - portrait { - width 1978 - height 2631 - event EV_SW:0:1 - part1 { - name portrait - x 0 - y 0 - } - part2 { - name device - x 219 - y 264 - } - } - landscape { - width 2854 - height 1785 - event EV_SW:0:0 - part1 { - name landscape - x 0 - y 0 - } - part2 { - name device - x 401 - y 1635 - rotation 3 - } - } -} diff --git a/devices/skins/nexus_9/port_back.png b/devices/skins/nexus_9/port_back.png deleted file mode 100644 index 561370e..0000000 Binary files a/devices/skins/nexus_9/port_back.png and /dev/null differ diff --git a/devices/skins/nexus_9/port_fore.png b/devices/skins/nexus_9/port_fore.png deleted file mode 100644 index b17f30f..0000000 Binary files a/devices/skins/nexus_9/port_fore.png and /dev/null differ diff --git a/devices/skins/nexus_9/port_shadow.png b/devices/skins/nexus_9/port_shadow.png deleted file mode 100644 index 2298e56..0000000 Binary files a/devices/skins/nexus_9/port_shadow.png and /dev/null differ diff --git a/devices/skins/pixel_c/land_back.png b/devices/skins/pixel_c/land_back.png deleted file mode 100644 index 06b6dd1..0000000 Binary files a/devices/skins/pixel_c/land_back.png and /dev/null differ diff --git a/devices/skins/pixel_c/land_fore.png b/devices/skins/pixel_c/land_fore.png deleted file mode 100644 index 58976fe..0000000 Binary files a/devices/skins/pixel_c/land_fore.png and /dev/null differ diff --git a/devices/skins/pixel_c/land_shadow.png b/devices/skins/pixel_c/land_shadow.png deleted file mode 100644 index 09cc981..0000000 Binary files a/devices/skins/pixel_c/land_shadow.png and /dev/null differ diff --git a/devices/skins/pixel_c/layout b/devices/skins/pixel_c/layout deleted file mode 100644 index a6e65da..0000000 --- a/devices/skins/pixel_c/layout +++ /dev/null @@ -1,59 +0,0 @@ -parts { - device { - display { - width 1800 - height 2560 - x 0 - y 0 - } - } - portrait { - background { - image port_back.png - } - onion { - image port_fore.png - } - } - landscape { - background { - image land_back.png - } - onion { - image land_fore.png - } - } -} -layouts { - portrait { - width 2307 - height 2971 - event EV_SW:0:1 - part1 { - name portrait - x 0 - y 0 - } - part2 { - name device - x 259 - y 181 - } - } - landscape { - width 3096 - height 2215 - event EV_SW:0:0 - part1 { - name landscape - x 0 - y 0 - } - part2 { - name device - x 269 - y 1988 - rotation 3 - } - } -} diff --git a/devices/skins/pixel_c/port_back.png b/devices/skins/pixel_c/port_back.png deleted file mode 100644 index 52d2eda..0000000 Binary files a/devices/skins/pixel_c/port_back.png and /dev/null differ diff --git a/devices/skins/pixel_c/port_fore.png b/devices/skins/pixel_c/port_fore.png deleted file mode 100644 index 8be9d34..0000000 Binary files a/devices/skins/pixel_c/port_fore.png and /dev/null differ diff --git a/devices/skins/pixel_c/port_shadow.png b/devices/skins/pixel_c/port_shadow.png deleted file mode 100644 index 2ac3296..0000000 Binary files a/devices/skins/pixel_c/port_shadow.png and /dev/null differ diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100755 index 8cce1fb..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,114 +0,0 @@ -# Note: It requires docker-compose 1.13.0 -# -# Usage: docker-compose up -d -version: "2.2" - -services: - # Selenium hub - selenium_hub: - image: selenium/hub:3.14.0-curium - ports: - - 4444:4444 - - # There is a bug for using appium. Issue: https://github.com/budtmo/docker-android/issues/73 - # Real devices - #real_device: - # image: budtmo/docker-android-real-device - # privileged: true - # depends_on: - # - selenium_hub - # ports: - # - 6080:6080 - # volumes: - # - ./video-real-device:/tmp/video - # - /dev/bus/usb:/dev/bus/usb - # - ~/.android:/root/.android - # environment: - # - CONNECT_TO_GRID=true - # - APPIUM=true - # - SELENIUM_HOST=selenium_hub - # - AUTO_RECORD=true - # - BROWSER_NAME=chrome - - # Using Appium Docker Android - real_device: - image: appium/appium - depends_on: - - selenium_hub - network_mode: "service:selenium_hub" - privileged: true - volumes: - - /dev/bus/usb:/dev/bus/usb - - ~/.android:/root/.android - - $PWD/example/sample_apk:/root/tmp - environment: - - CONNECT_TO_GRID=true - - SELENIUM_HOST=selenium_hub - # Enable it for msite testing - #- BROWSER_NAME=chrome - - # Docker-Android for Android application testing - nexus_7.1.1: - image: budtmo/docker-android-x86-7.1.1 - privileged: true - # Increase scale number if needed - scale: 1 - depends_on: - - selenium_hub - - real_device - ports: - - 6080 - # Change path of apk that you want to test. I use sample_apk that I provide in folder "example" - volumes: - - $PWD/example/sample_apk:/root/tmp/sample_apk - - ./video-nexus_7.1.1:/tmp/video - environment: - - DEVICE=Nexus 5 - - CONNECT_TO_GRID=true - - APPIUM=true - - SELENIUM_HOST=selenium_hub - - AUTO_RECORD=true - - # Docker-Android for mobile website testing with chrome browser - # Chrome browser exists only for version 7.0 and 7.1.1 - samsung_galaxy_web_7.1.1: - image: budtmo/docker-android-x86-8.1 - privileged: true - # Increase scale number if needed - scale: 1 - depends_on: - - selenium_hub - - real_device - ports: - - 6080 - volumes: - - ./video-samsung_7.1.1:/tmp/video - environment: - - DEVICE=Samsung Galaxy S6 - - CONNECT_TO_GRID=true - - APPIUM=true - - SELENIUM_HOST=selenium_hub - - MOBILE_WEB_TEST=true - - AUTO_RECORD=true - - # Docker-Android for mobile website testing with default browser - # Default browser exists only for version 5.0.1, 5.1.1 and 6.0 - samsung_galaxy_web_5.1.1: - image: budtmo/docker-android-x86-5.1.1 - privileged: true - # Increase scale number if needed - scale: 1 - depends_on: - - selenium_hub - - real_device - ports: - - 6080 - volumes: - - ./video-samsung_5.1.1:/tmp/video - environment: - - DEVICE=Samsung Galaxy S6 - - CONNECT_TO_GRID=true - - APPIUM=true - - SELENIUM_HOST=selenium_hub - - MOBILE_WEB_TEST=true - - AUTO_RECORD=true diff --git a/docker.tf b/docker.tf deleted file mode 100644 index 582e52e..0000000 --- a/docker.tf +++ /dev/null @@ -1,44 +0,0 @@ -provider "docker" { - host = "unix:///var/run/docker.sock" -} - -resource "docker_image" "selenium_hub_img" { - name = "selenium/hub:3.14.0-curium" -} - -resource "docker_image" "docker_android_img" { - name = "budtmo/docker-android-x86-8.1:latest" -} - -resource "docker_network" "private_network" { - name = "private_network" -} - -resource "docker_container" "selenium_hub_con" { - image = "${docker_image.selenium_hub_img.latest}" - name = "selenium_hub_con" - networks = ["${docker_network.private_network.id}"] - ports { - internal = 4444 - external = 4444 - } -} - -resource "docker_container" "samsung_s6_con" { - image = "${docker_image.docker_android_img.latest}" - name = "samsung_s6_con" - privileged = true - depends_on = ["docker_container.selenium_hub_con"] - networks = ["${docker_network.private_network.id}"] - ports { - internal = 6080 - external = 6080 - } - env = [ - "DEVICE=Samsung Galaxy S6", - "CONNECT_TO_GRID=true", - "APPIUM=true", - "MOBILE_WEB_TEST=true", - "AUTO_RECORD=true" - ] -} diff --git a/docker/Emulator_x86 b/docker/Emulator_x86 deleted file mode 100644 index 2ebfd1d..0000000 --- a/docker/Emulator_x86 +++ /dev/null @@ -1,200 +0,0 @@ -FROM appium/appium:v1.22.3-p1 - -LABEL maintainer "Budi Utomo " - -#============= -# Set WORKDIR -#============= -WORKDIR /root - -#================== -# General Packages -#------------------ -# xterm -# Terminal emulator -# supervisor -# Process manager -# socat -# Port forwarder -#------------------ -# NoVNC Packages -#------------------ -# x11vnc -# VNC server for X display -# We use package from ubuntu 18.10 to fix crashing issue -# openbox -# Windows manager -# feh -# ScreenBackground -# menu -# Debian menu -# python-numpy -# Numpy, For faster performance: https://github.com/novnc/websockify/issues/77 -# net-tools -# Netstat -#------------------ -# Video Recording -#------------------ -# ffmpeg -# Video recorder -# jq -# Sed for JSON data -#------------------ -# KVM Package -# for emulator x86 -# https://help.ubuntu.com/community/KVM/Installation -#------------------ -# qemu-kvm -# libvirt-bin -# ubuntu-vm-builder -# bridge-utils -#================== -ADD docker/configs/x11vnc.pref /etc/apt/preferences.d/ -RUN apt-get -qqy update && apt-get -qqy install --no-install-recommends \ - xterm \ - supervisor \ - socat \ - x11vnc \ - openbox \ - feh \ - menu \ - python-numpy \ - net-tools \ - ffmpeg \ - jq \ - qemu-kvm \ - libvirt-bin \ - ubuntu-vm-builder \ - bridge-utils \ - && apt clean all \ - && rm -rf /var/lib/apt/lists/* - -#======= -# noVNC -# Use same commit id that docker-selenium uses -# https://github.com/elgalu/docker-selenium/blob/236b861177bd2917d864e52291114b1f5e4540d7/Dockerfile#L412-L413 -#======= -ENV NOVNC_SHA="b403cb92fb8de82d04f305b4f14fa978003890d7" \ - WEBSOCKIFY_SHA="558a6439f14b0d85a31145541745e25c255d576b" -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 -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 \ - && ln noVNC/vnc_auto.html noVNC/index.html - -#====================== -# Install SDK packages -#====================== -ARG ANDROID_VERSION=5.0.1 -ARG API_LEVEL=21 -ARG PROCESSOR=x86 -ARG SYS_IMG=x86 -ARG IMG_TYPE=google_apis -ARG BROWSER=android -ARG CHROME_DRIVER=2.40 -ARG GOOGLE_PLAY_SERVICE=12.8.74 -ARG GOOGLE_PLAY_STORE=11.0.50 -ARG APP_RELEASE_VERSION=1.5-p0 -ENV ANDROID_VERSION=$ANDROID_VERSION \ - API_LEVEL=$API_LEVEL \ - PROCESSOR=$PROCESSOR \ - SYS_IMG=$SYS_IMG \ - IMG_TYPE=$IMG_TYPE \ - BROWSER=$BROWSER \ - CHROME_DRIVER=$CHROME_DRIVER \ - GOOGLE_PLAY_SERVICE=$GOOGLE_PLAY_SERVICE \ - GOOGLE_PLAY_STORE=$GOOGLE_PLAY_STORE \ - GA=true \ - GA_ENDPOINT=https://www.google-analytics.com/collect \ - GA_TRACKING_ID=UA-133466903-1 \ - GA_API_VERSION="1" \ - APP_RELEASE_VERSION=$APP_RELEASE_VERSION \ - APP_TYPE=Emulator -ENV PATH ${PATH}:${ANDROID_HOME}/build-tools - -RUN yes | sdkmanager --licenses && \ - sdkmanager "platforms;android-${API_LEVEL}" "system-images;android-${API_LEVEL};${IMG_TYPE};${SYS_IMG}" "emulator" - -#============================================== -# Download proper version of chromedriver -# to be able to use Chrome browser in emulator -#============================================== -RUN wget -nv -O chrome.zip "https://chromedriver.storage.googleapis.com/${CHROME_DRIVER}/chromedriver_linux64.zip" \ - && unzip -x chrome.zip \ - && rm chrome.zip - -#================================================================ -# Download Google Play Services APK and Play Store from apklinker -#================================================================ -#Run wget -nv -O google_play_services.apk "https://www.apklinker.com/wp-content/uploads/uploaded_apk/5b5155e5ef4f8/com.google.android.gms_${GOOGLE_PLAY_SERVICE}-020700-204998136_12874013_MinAPI21_(x86)(nodpi)_apklinker.com.apk" -#Run wget -nv -O google_play_store.apk "https://www.apklinker.com/wp-content/uploads/uploaded_apk/5b632b1164e31/com.android.vending_${GOOGLE_PLAY_STORE}-all-0-PR-206665793_81105000_MinAPI16_(armeabi,armeabi-v7a,mips,mips64,x86,x86_64)(240,320,480dpi)_apklinker.com.apk" - -#================================================ -# noVNC Default Configurations -# These Configurations can be changed through -e -#================================================ -ENV DISPLAY=:0 \ - SCREEN=0 \ - SCREEN_WIDTH=1600 \ - SCREEN_HEIGHT=900 \ - SCREEN_DEPTH=24+32 \ - LOCAL_PORT=5900 \ - TARGET_PORT=6080 \ - TIMEOUT=1 \ - VIDEO_PATH=/tmp/video \ - LOG_PATH=/var/log/supervisor - -#================================================ -# openbox configuration -# Update the openbox configuration files to: -# + Use a single virtual desktop to prevent accidentally switching -# + Add background -#================================================ -ADD images/logo_dockerandroid.png /root/logo.png -ADD src/.fehbg /root/.fehbg -ADD src/rc.xml /etc/xdg/openbox/rc.xml -RUN echo /root/.fehbg >> /etc/xdg/openbox/autostart - -#====================== -# Workarounds -#====================== -# Fix emulator from crashing when running as root user. -# See https://github.com/budtmo/docker-android/issues/223 -ENV QTWEBENGINE_DISABLE_SANDBOX=1 - -#=============== -# Expose Ports -#--------------- -# 4723 -# Appium port -# 6080 -# noVNC port -# 5554 -# Emulator port -# 5555 -# ADB connection port -#=============== -EXPOSE 4723 6080 5554 5555 - -#====================== -# Add Emulator Devices -#====================== -COPY devices ${ANDROID_HOME}/devices - -#=================== -# Run docker-appium -#=================== -COPY src /root/src -COPY supervisord.conf /root/ -RUN chmod -R +x /root/src && chmod +x /root/supervisord.conf - -HEALTHCHECK --interval=2s --timeout=40s --retries=1 \ - CMD timeout 40 adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done' - -RUN ln -s ${ANDROID_HOME}/emulator/emulator /usr/bin/ - -CMD /usr/bin/supervisord --configuration supervisord.conf diff --git a/docker/Genymotion b/docker/Genymotion deleted file mode 100644 index f3c2591..0000000 --- a/docker/Genymotion +++ /dev/null @@ -1,172 +0,0 @@ -FROM appium/appium:v1.22.3-p1 - -LABEL maintainer "Budi Utomo " - -#============= -# Set WORKDIR -#============= -WORKDIR /root - -#================== -# General Packages -#------------------ -# xterm -# Terminal emulator -# supervisor -# Process manager -# socat -# Port forwarder -# keychain -# ssh-key creator -#------------------ -# Genymotion spec -#------------------ -# python3-setuptools -# PPython packaging facilitator -# python3-wheel -# Python distribution -# python3-pip -# Python package installer -#------------------ -# NoVNC Packages -#------------------ -# x11vnc -# VNC server for X display -# We use package from ubuntu 18.10 to fix crashing issue -# openbox -# Windows manager -# feh -# ScreenBackground -# python-xdg -# Required by openbox autostart function -# menu -# Debian menu -# python-numpy -# Numpy, For faster performance: https://github.com/novnc/websockify/issues/77 -# net-tools -# Netstat -#------------------ -# Video Recording -#------------------ -# ffmpeg -# Video recorder -# jq -# Sed for JSON data -#================== -ADD docker/configs/x11vnc.pref /etc/apt/preferences.d/ -RUN apt-get -qqy update && apt-get -qqy install --no-install-recommends \ - xterm \ - supervisor \ - socat \ - keychain \ - python3-setuptools \ - python3-wheel \ - python3-pip \ - x11vnc \ - openbox \ - feh \ - python-xdg \ - menu \ - python-numpy \ - net-tools \ - ffmpeg \ - jq \ - && apt clean all \ - && rm -rf /var/lib/apt/lists/* - -#======= -# noVNC -# Use same commit id that docker-selenium uses -# https://github.com/elgalu/docker-selenium/blob/236b861177bd2917d864e52291114b1f5e4540d7/Dockerfile#L412-L413 -#======= -ENV NOVNC_SHA="b403cb92fb8de82d04f305b4f14fa978003890d7" \ - WEBSOCKIFY_SHA="558a6439f14b0d85a31145541745e25c255d576b" -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 -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 \ - && ln noVNC/vnc_auto.html noVNC/index.html - -#================================================ -# noVNC Default Configurations -# These Configurations can be changed through -e -#================================================ -ARG APP_RELEASE_VERSION=1.5-p0 -ENV DISPLAY=:0 \ - SCREEN=0 \ - SCREEN_WIDTH=1600 \ - SCREEN_HEIGHT=900 \ - SCREEN_DEPTH=16 \ - LOCAL_PORT=5900 \ - TARGET_PORT=6080 \ - TIMEOUT=1 \ - VIDEO_PATH=/tmp/video \ - LOG_PATH=/var/log/supervisor \ - GA=true \ - GA_ENDPOINT=https://www.google-analytics.com/collect \ - GA_TRACKING_ID=UA-133466903-1 \ - GA_API_VERSION="1" \ - APP_RELEASE_VERSION=$APP_RELEASE_VERSION \ - APP_TYPE=Genymotion - -#================================================ -# openbox configuration -# Update the openbox configuration files to: -# + Use a single virtual desktop to prevent accidentally switching -# + Add background -#================================================ -ADD images/logo_dockerandroid.png /root/logo.png -ADD src/.fehbg /root/.fehbg -ADD src/rc.xml /etc/xdg/openbox/rc.xml -RUN echo /root/.fehbg >> /etc/xdg/openbox/autostart - -#============ -# Set Locale -#============ -ENV LC_ALL=C.UTF-8 -ENV LANG=C.UTF-8 - -#==================== -# Install genymotion -#==================== -RUN echo | ssh-keygen -q -ENV GENYMOTION=true \ - INSTANCES_PATH=/root/tmp/instances.txt \ - APPIUM_LOG=$LOG_PATH/appium.log -RUN pip3 install gmsaas -COPY genymotion/generate_config.sh genymotion/geny_start.sh genymotion/enable_adb.sh /root/ - -#=================== -# Install Terraform -#=================== -ARG TERRAFORM_VERSION=0.11.7 - -ENV TERRAFORM_VERSION=$TERRAFORM_VERSION -RUN wget -nv -O terraform.zip "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip" \ - && unzip -x terraform.zip \ - && rm terraform.zip - -#=============== -# Expose Ports -#--------------- -# 4723 -# Appium port -# 6080 -# noVNC port -# 5555 -# ADB connection port -#=============== -EXPOSE 4723 6080 5555 - -#======================= -# Run docker-genymotion -#======================= -COPY src /root/src -COPY supervisord.conf /root/ -RUN chmod -R +x /root/src && chmod +x /root/supervisord.conf /root/geny_start.sh -RUN gmsaas config set android-sdk-path ${ANDROID_HOME} -CMD ["./geny_start.sh"] diff --git a/docker/Real_device b/docker/Real_device deleted file mode 100644 index 55afbc2..0000000 --- a/docker/Real_device +++ /dev/null @@ -1,166 +0,0 @@ -FROM appium/appium:v1.22.3-p1 - -LABEL maintainer "Budi Utomo " - -#============= -# Set WORKDIR -#============= -WORKDIR /root - -#================== -# General Packages -#------------------ -# xterm -# Terminal emulator -# supervisor -# Process manager -# socat -# Port forwarder -#------------------ -# NoVNC Packages -#------------------ -# x11vnc -# VNC server for X display -# We use package from ubuntu 18.10 to fix crashing issue -# openbox -# Windows manager -# feh -# ScreenBackground -# python-xdg -# Required by openbox autostart function -# menu -# Debian menu -# python-numpy -# Numpy, For faster performance: https://github.com/novnc/websockify/issues/77 -# net-tools -# Netstat -#------------------ -# Video Recording -#------------------ -# ffmpeg -# Video recorder -# jq -# Sed for JSON data -#================== -ADD docker/configs/x11vnc.pref /etc/apt/preferences.d/ -RUN apt-get -qqy update && apt-get -qqy install --no-install-recommends \ - xterm \ - supervisor \ - socat \ - x11vnc \ - openbox \ - feh \ - python-xdg \ - menu \ - python-numpy \ - net-tools \ - ffmpeg \ - jq \ - curl \ - libavcodec-dev \ - libavformat-dev \ - libavutil-dev \ - gcc \ - git \ - make \ - meson \ - musl-dev \ - pkgconf \ - libsdl2-dev \ - && apt clean all \ - && rm -rf /var/lib/apt/lists/* - - -#=========== -# scrcpy - screen copy -# https://github.com/Genymobile/scrcpy -#=========== -ARG SCRCPY_VER=1.10 -ARG SERVER_HASH="cbeb1a4e046f1392c1dc73c3ccffd7f86dec4636b505556ea20929687a119390" - -RUN mkdir /root/scrcpy -RUN curl -L -o /root/scrcpy/scrcpy-code.zip https://github.com/Genymobile/scrcpy/archive/v${SCRCPY_VER}.zip -RUN curl -L -o /root/scrcpy/scrcpy-server.jar https://github.com/Genymobile/scrcpy/releases/download/v${SCRCPY_VER}/scrcpy-server-v${SCRCPY_VER}.jar -RUN echo "$SERVER_HASH scrcpy/scrcpy-server.jar" | sha256sum -c - -RUN cd scrcpy && unzip -x scrcpy-code.zip -RUN cd scrcpy/scrcpy-${SCRCPY_VER} && meson x --buildtype release --strip -Db_lto=true -Dprebuilt_server=/root/scrcpy/scrcpy-server.jar -RUN cd scrcpy/scrcpy-${SCRCPY_VER}/x && ninja && ninja install -RUN rm -rf scrcpy/ - -#======= -# noVNC -# Use same commit id that docker-selenium uses -# https://github.com/elgalu/docker-selenium/blob/236b861177bd2917d864e52291114b1f5e4540d7/Dockerfile#L412-L413 -#======= -ENV NOVNC_SHA="b403cb92fb8de82d04f305b4f14fa978003890d7" \ - WEBSOCKIFY_SHA="558a6439f14b0d85a31145541745e25c255d576b" -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 -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 \ - && ln noVNC/vnc_auto.html noVNC/index.html - -#================================================ -# noVNC Default Configurations -# These Configurations can be changed through -e -#================================================ -ARG APP_RELEASE_VERSION=1.5-p0 -ENV DISPLAY=:0 \ - SCREEN=0 \ - SCREEN_WIDTH=1600 \ - SCREEN_HEIGHT=900 \ - SCREEN_DEPTH=16 \ - LOCAL_PORT=5900 \ - TARGET_PORT=6080 \ - TIMEOUT=1 \ - VIDEO_PATH=/tmp/video \ - LOG_PATH=/var/log/supervisor \ - GA=true \ - GA_ENDPOINT=https://www.google-analytics.com/collect \ - GA_TRACKING_ID=UA-133466903-1 \ - GA_API_VERSION="1" \ - APP_RELEASE_VERSION=$APP_RELEASE_VERSION \ - APP_TYPE=Device - -#================================================ -# openbox configuration -# Update the openbox configuration files to: -# + Use a single virtual desktop to prevent accidentally switching -# + Add background -#================================================ -ADD images/logo_dockerandroid.png /root/logo.png -ADD src/.fehbg /root/.fehbg -ADD src/rc.xml /etc/xdg/openbox/rc.xml -RUN echo /root/.fehbg >> /etc/xdg/openbox/autostart - -#========================= -# Set default variables -#========================= -ENV APPIUM_LOG=$LOG_PATH/appium.log -ENV REAL_DEVICE=true -ENV BROWSER=android - -#=============== -# Expose Ports -#--------------- -# 4723 -# Appium port -# 6080 -# noVNC port -# 5555 -# ADB connection port -#=============== -EXPOSE 4723 6080 5555 - -#=================== -# Run docker-appium -#=================== -COPY src /root/src -COPY supervisord.conf /root/ -RUN chmod -R +x /root/src && chmod +x /root/supervisord.conf - -CMD /usr/bin/supervisord --configuration supervisord.conf diff --git a/docker/base b/docker/base new file mode 100644 index 0000000..8934883 --- /dev/null +++ b/docker/base @@ -0,0 +1,48 @@ +FROM appium/appium:v1.22.3-p6 + +LABEL maintainer "Budi Utomo " + +USER root + +#================ +# Basic Packages +#---------------- +# socat +# Port forwarder +# supervisor +# Process manager +#================ +RUN apt-get -qqy update && apt-get -qqy install --no-install-recommends \ + socat \ + supervisor \ + && apt autoremove -y \ + && apt clean all \ + && rm -rf /var/lib/apt/lists/* + +#================== +# Configure Python +#================== +RUN apt-get -qqy update && \ + apt-get -qqy --no-install-recommends install \ + python3-pip \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* \ + && update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1 + +#===================== +# Set release version +#===================== +ARG DOCKER_ANDROID_VERSION=test-version +ENV DOCKER_ANDROID_VERSION=${DOCKER_ANDROID_VERSION} + +#=============== +# Expose Ports +#--------------- +# 4723 +# Appium port +# 5554 +# Emulator port +# 5555 +# ADB connection port +#=============== +EXPOSE 4723 5554 5555 diff --git a/docker/configs/x11vnc.pref b/docker/configs/x11vnc.pref deleted file mode 100644 index 67a022f..0000000 --- a/docker/configs/x11vnc.pref +++ /dev/null @@ -1,6 +0,0 @@ -Package: * -Pin: release n=bionic -Pin-Priority: -10 -Package: x11vnc* -Pin: release n=cosmic -Pin-Priority: 500 \ No newline at end of file diff --git a/docker/emulator b/docker/emulator new file mode 100644 index 0000000..22ce0ae --- /dev/null +++ b/docker/emulator @@ -0,0 +1,108 @@ +ARG DOCKER_ANDROID_VERSION +FROM budtmo/docker-android:base_${DOCKER_ANDROID_VERSION} + +#================== +# Android Packages +#================== +ARG EMULATOR_ANDROID_VERSION +ARG EMULATOR_API_LEVEL +ENV EMULATOR_ANDROID_VERSION=${EMULATOR_ANDROID_VERSION} \ + EMULATOR_API_LEVEL=${EMULATOR_API_LEVEL} \ + EMULATOR_SYS_IMG=x86_64 \ + EMULATOR_IMG_TYPE=google_apis \ + EMULATOR_BROWSER=chrome +ENV PATH ${PATH}:${ANDROID_HOME}/build-tools +RUN yes | sdkmanager --licenses \ + && sdkmanager "platforms;android-${EMULATOR_API_LEVEL}" \ + "system-images;android-${EMULATOR_API_LEVEL};${EMULATOR_IMG_TYPE};${EMULATOR_SYS_IMG}" "emulator" \ + && ln -s ${ANDROID_HOME}/emulator/emulator /usr/bin/ + +#============= +# UI Packages +#------------- +# ffmpeg +# Video recorder +# feh +# Screen background +# libxcomposite-dev +# Window System for Emulator +# menu +# Debian menu +# openbox +# Windows manager +# x11vnc +# VNC server +# xterm +# Terminal emulator +#================== +RUN apt-get -qqy update && apt-get -qqy install --no-install-recommends \ + ffmpeg \ + feh \ + libxcomposite-dev \ + menu \ + openbox \ + x11vnc \ + xterm \ + && apt autoremove -y \ + && apt clean all \ + && rm -rf /var/lib/apt/lists/* + +#======= +# noVNC +#======= +ENV NOVNC_VERSION="1.4.0" \ + WEBSOCKIFY_VERSION="0.11.0" \ + OPT_PATH="/opt" +RUN wget -nv -O noVNC.zip "https://github.com/novnc/noVNC/archive/refs/tags/v${NOVNC_VERSION}.zip" \ + && unzip -x noVNC.zip \ + && rm noVNC.zip \ + && mv noVNC-${NOVNC_VERSION} ${OPT_PATH}/noVNC \ + && wget -nv -O websockify.zip "https://github.com/novnc/websockify/archive/refs/tags/v${WEBSOCKIFY_VERSION}.zip" \ + && unzip -x websockify.zip \ + && mv websockify-${WEBSOCKIFY_VERSION} ${OPT_PATH}/noVNC/utils/websockify \ + && rm websockify.zip \ + && ln ${OPT_PATH}/noVNC/vnc.html ${OPT_PATH}/noVNC/index.html + +ENV DISPLAY=:0 \ + SCREEN_NUMBER=0 \ + SCREEN_WIDTH=1600 \ + SCREEN_HEIGHT=900 \ + SCREEN_DEPTH=24+32 \ + VNC_PORT=5900 \ + WEB_VNC_PORT=6080 + +EXPOSE 5900 6080 + +#========== +# Copy app +#========== +RUN rm -rf ${SCRIPT_PATH} +ENV SCRIPT_PATH="docker-android" +ENV WORK_PATH="/home/androidusr" +ENV APP_PATH=${WORK_PATH}/${SCRIPT_PATH} +RUN mkdir -p ${APP_PATH} +COPY mixins ${APP_PATH}/mixins +COPY cli ${APP_PATH}/cli +RUN chown -R 1300:1301 ${APP_PATH} \ + && pip install --quiet -e ${APP_PATH}/cli + +#=================== +# Configure OpenBox +#=================== +RUN echo ${APP_PATH}/mixins/configs/display/.fehbg >> /etc/xdg/openbox/autostart + +#================== +# Use created user +#================== +USER 1300:1301 +ENV LOG_PATH=${WORK_PATH}/logs \ + WEB_LOG_PORT=9000 +EXPOSE 9000 +RUN mkdir -p ${LOG_PATH} + +#========= +# Run App +#========= +STOPSIGNAL SIGTERM +ENV DEVICE_TYPE=emulator +ENTRYPOINT ["/home/androidusr/docker-android/mixins/scripts/run.sh"] diff --git a/docker/genymotion b/docker/genymotion new file mode 100644 index 0000000..8648e3c --- /dev/null +++ b/docker/genymotion @@ -0,0 +1,66 @@ +ARG DOCKER_ANDROID_VERSION +FROM budtmo/docker-android:base_${DOCKER_ANDROID_VERSION} + +#=================================================== +# Install Genymotion CLI +# (for user management and deployment on Geny Cloud) +#=================================================== +ENV GMSAAS_CLI_VERSION="1.7.1" +RUN pip install gmsaas==${GMSAAS_CLI_VERSION} + +#================ +# Cloud Packages +#---------------- +# keychain +# ssh-key generator +#================ +RUN apt-get -qqy update && apt-get -qqy install --no-install-recommends \ + keychain \ + && apt autoremove -y \ + && apt clean all \ + && rm -rf /var/lib/apt/lists/* + +#========================================= +# Install Terraform +# (for deployment on other cloud services) +#========================================= +ENV TERRAFORM_VERSION=1.4.6 +RUN wget -nv -O terraform.zip "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip" \ + && unzip -x terraform.zip \ + && mv terraform /usr/local/bin \ + && rm terraform.zip + +#========== +# Copy app +#========== +RUN rm -rf ${SCRIPT_PATH} +ENV SCRIPT_PATH="docker-android" +ENV WORK_PATH="/home/androidusr" +ENV APP_PATH=${WORK_PATH}/${SCRIPT_PATH} +RUN mkdir -p ${APP_PATH} +COPY mixins ${APP_PATH}/mixins +COPY cli ${APP_PATH}/cli +RUN chown -R 1300:1301 ${APP_PATH} \ + && pip install --quiet -e ${APP_PATH}/cli + +#=================================== +# Create Genymotion Template folder +#=================================== +ENV GENYMOTION_TEMPLATE_PATH=${WORK_PATH}/genymotion_template +RUN mkdir -p ${GENYMOTION_TEMPLATE_PATH} + +#================== +# Use created user +#================== +USER 1300:1301 +ENV LOG_PATH=${WORK_PATH}/logs \ + WEB_LOG_PORT=9000 +EXPOSE 9000 +RUN mkdir -p ${LOG_PATH} + +#========= +# Run App +#========= +STOPSIGNAL SIGTERM +RUN gmsaas config set android-sdk-path ${ANDROID_HOME} +ENTRYPOINT ["/home/androidusr/docker-android/mixins/scripts/run.sh"] diff --git a/documentations/CUSTOM_CONFIGURATIONS.md b/documentations/CUSTOM_CONFIGURATIONS.md new file mode 100644 index 0000000..c6dd90a --- /dev/null +++ b/documentations/CUSTOM_CONFIGURATIONS.md @@ -0,0 +1,61 @@ +VNC-CLIENT +---------- + +Vnc-server inside container is run on port 5900 + +1. Run docker-android: + ``` + docker run -d -p 5900:5900 -e EMULATOR_DEVICE="Samsung Galaxy S10" --device /dev/kvm --name android-container budtmo/docker-android:emulator_11.0 + ``` + +2. Connect docker-container using vnc-client + +Environment variables that can be passed to docker container for vnc configuration: +|Environment Variable |Description |Example| +|:---|:---|:---| +|VNC_PASSWORD|protect vnc connection with password|docker run ... -e VNC_PASSWORD=thisissecret ...| + + +VNC-WEB +------- + +Vnc-web inside container is run on port 6080 + +Environment variables that can be passed to docker container for vnc configuration: +|Environment Variable |Description |Example| +|:---|:---|:---| +|WEB_VNC|access inside of the container through web-ui|docker run ... -p 6080:6080 -e WEB_VNC=true ...| +|WEB_VNC_PORT|access inside of the container through web-ui on given port (default port 6080)|docker run ... -p 6081:6081 -e WEB_VNC=true -e WEB_VNC_PORT=6081 ...| + +Possible endpoints if WEB_VNC is activated: +|Endpoint |Description |Example| +|:---|:---|:---| +|autoconnect|access web-ui of vnc direclty|http://localhost:6080/?autoconnect=true| +|view_only|give only view access|http://localhost:6080/?autoconnect=true&view_only=true| +|password|access web-ui of vnc directly with protected password|http://localhost:6080/?autoconnect=true&password=thisissecret| + + +LOG-SHARING +----------- + +The user has possibility to access log-files through web-ui: +|Environment Variable |Description |Example| +|:---|:---|:---| +|WEB_LOG|access log-files through web-ui|docker run ... -e WEB_LOG=true ...| +|WEB_LOG_PORT|access log-files through web-ui on given port (default port 9000)|docker run ... -e WEB_LOG=true -e WEB_LOG_PORT=9001 ...| + + +EMULATOR +-------- + +Possible environment variable to configure the Emulator: +|Environment Variable |Description |Example| +|:---|:---|:---| +|EMULATOR_NAME|give emulator name (default name is a combination between Device name and Android version)|docker run ... -e EMULATOR_NAME=my_emu ...| +|EMULATOR_DATA_PARTITION|set data partition on emulator (default value 550m)|docker run ... -e EMULATOR_DATA_PARTITION=900m ...| +|EMULATOR_NO_SKIN|deploying emulator without skin|docker run ... -e EMULATOR_NO_SKIN=true ...| + +The user can also pass needed arguments to android emulator through environment variable ***EMULATOR_ADDITIONAL_ARGS***. Please check [this page](https://developer.android.com/studio/run/emulator-commandline) for possible arguments that can be passed. + + +[<- BACK TO README](../README.md) diff --git a/documentations/DOCKER-ANDROID-PRO.md b/documentations/DOCKER-ANDROID-PRO.md new file mode 100644 index 0000000..6716d71 --- /dev/null +++ b/documentations/DOCKER-ANDROID-PRO.md @@ -0,0 +1,85 @@ +Docker-Android-Pro +------------------ + +Docker-Android-Pro is a sponsor based project which mean that the docker image of pro-version can be pulled only by [active sponsor](https://github.com/sponsors/budtmo). After donation, please send email [here](mailto:budtmo2.os@gmail.com) with following format on subject email: ```--``` e.g. ```budtmo-30.01.2021-myemail@test.com```. The script will validate everything and it will send the access token to that email within 48 hours to be able to pull the pro version of docker-android image. Contact [@budtmo](https://github.com/budtmo) if you dont get access token after donation. The access token will be removed as soon as the user become inactive sponsor. + +The differences between normal version and pro version are: + +|Feature |Normal |Pro |Comment| +|:---|:---|:---|:---| +|user-behavior-analytics|Yes|No|-| +|proxy|No|Yes|Set up company proxy on Android emulator on fly| +|language|No|Yes|Set up language on Android emulator on fly| +|root-privileged|No|Yes|Able to run command with security privileged| +|headless-mode|No|Yes|Save resources by using headless mode| +|multiple Android-Simulators|No|Yes (soon)|Save resources by having multiple Android-Simulators on one docker-container| +|Google Play Store|No|Yes (soon)|-| +|Video Recording|No|Yes (soon)|Helpful for debugging| + + +List of Docker-Images +--------------------- +|Android |API |Type |Image with latest release version |Image with specific release version| +|:---|:---|:---|:---|:---| +|9.0|28|Normal|budtmo2/docker-android-pro:emulator_9.0_v2.0|budtmo2/docker-android-pro:emulator_9.0_| +|10.0|29|Normal|budtmo2/docker-android-pro:emulator_10.0|budtmo2/docker-android-pro:emulator_10.0_| +|11.0|30|Normal|budtmo2/docker-android-pro:emulator_11.0|budtmo2/docker-android-pro:emulator_11.0_| +|12.0|32|Normal|budtmo2/docker-android-pro:emulator_12.0|budtmo2/docker-android-pro:emulator_12.0_| +|13.0|33|Normal|budtmo2/docker-android-pro:emulator_13.0|budtmo2/docker-android-pro:emulator_13.0_| +|9.0|28|Headless|budtmo2/docker-android-pro:emulator_headless_9.0_v2.0|budtmo2/docker-android-pro:emulator_headless_9.0_| +|10.0|29|Headless|budtmo2/docker-android-pro:emulator_headless_10.0|budtmo2/docker-android-pro:emulator_headless_10.0_| +|11.0|30|Headless|budtmo2/docker-android-pro:emulator_headless_11.0|budtmo2/docker-android-pro:emulator_headless_11.0_| +|12.0|32|Headless|budtmo2/docker-android-pro:emulator_headless_12.0|budtmo2/docker-android-pro:emulator_headless_12.0_| +|13.0|33|Headless|budtmo2/docker-android-pro:emulator_headless_13.0|budtmo2/docker-android-pro:emulator_headless_13.0_| + +***Note: Headless mode does not have any Web-UI*** + +You can always pull the latest image tag. In case you want to see the release version that has been built with a changelog note and use that specific release version, you can see that information by logging into [docker-hub-ui](https://hub.docker.com) using given access token. + + +List of Devices +--------------- + +Type | Device Name +----- | ----- +Phone | Samsung Galaxy S10 +Phone | Samsung Galaxy S9 +Phone | Samsung Galaxy S8 +Phone | Samsung Galaxy S7 Edge +Phone | Samsung Galaxy S7 +Phone | Samsung Galaxy S6 +Phone | Nexus 4 +Phone | Nexus 5 +Phone | Nexus One +Phone | Nexus S +Tablet | Nexus 7 + + +Proxy +----- + +You can enable proxy inside container and Android emulator by passing following environment variables: + +- HTTP_PROXY="http://\:" +- HTTPS_PROXY="http://\:" +- NO_PROXY="localhost" +- EMULATOR_PROXY_URL="http://\:" +- EMULATOR_PROXY_USER="\" +- EMULATOR_PROXY_PASS="\" + + +Language +-------- + +You can change the language setting of Android Emulator on the fly by passing following environment variable: + +- EMULATOR_LANGUAGE="\" +- EMULATOR_COUNTRY="\" + + +Version +------- + + + +[<- BACK TO README](../README.md) diff --git a/documentations/THIRD_PARTY_GENYMOTION.md b/documentations/THIRD_PARTY_GENYMOTION.md new file mode 100644 index 0000000..811a746 --- /dev/null +++ b/documentations/THIRD_PARTY_GENYMOTION.md @@ -0,0 +1,44 @@ +Genymotion Cloud +---------------- + +![Genymotion](../images/logo_genymotion.png) + +You can use Genymotion Android virtual devices in the cloud. They are available on [SaaS](http://bit.ly/2YP0P1l) or as virtual images on AWS, GCP or Alibaba Cloud. + +1. On SaaS
+ Use [saas.json](../example/genymotion/saas.json) to define the devices that you want to use. You can specify the port on which the device will start so you don't need to change the device name in your tests every time you need to run those tests. Then run following command + + ``` + export USER="xxx" + export PASS="xxx" + + docker run -d -p 4723:4723 -v ${PWD}/example/genycloud/saas.json:/home/androidusr/genymotion_template/saas.json -e DEVICE_TYPE=geny_saas -e GENY_SAAS_USER=${USER} -e GENY_SAAS_PASS=${PASS} -e APPIUM=true --name android-container budtmo/docker-android:genymotion + ``` + + The deployed device(s) are automatically connected with adb inside docker container. Stopping the emulator will remove all deployed device(s) on Genymotion SaaS and user will be logged out at the end. + + ``` + docker stop android-container + ``` + + + In case you are interesed to play around with Genymotion on SaaS, you can register to [this link](http://bit.ly/2YP0P1l) to get free minutes for free. + +2. On AWS
+ Use [aws.json](../example/genymotion/aws.json) to define the devices that you want to use. You can specify the port on which the device will start so you don't need to change the device name in your tests every time you need to run those tests. Then run following command + + ``` + export AWS_ACCESS_KEY_ID="xxx" + export AWS_SECRET_ACCESS_KEY="xxx" + + docker run -it --rm -p 4723:4723 -v ${PWD}/example/genycloud/aws.json:/home/androidusr/genymotion_template/aws.json -e DEVICE_TYPE=geny_aws -e AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} -e GENY_SAAS_PASS=${AWS_SECRET_ACCESS_KEY} -e APPIUM=true budtmo/docker-android:genymotion + ``` + + The deployed device(s) are automatically connected with adb inside docker container. Stopping the emulator will remove all deployed device(s) on Genymotion SaaS and user will be logged out at the end. As destroying all deployed ressources take time in AWS (it takes around 3 min), you need to specify the waiting time on docker stop + + ``` + docker stop --time=180 android-container + ``` + + +[<- BACK TO README](../README.md) diff --git a/documentations/USER_BEHAVIOR_ANALYTICS.md b/documentations/USER_BEHAVIOR_ANALYTICS.md new file mode 100644 index 0000000..5a49a29 --- /dev/null +++ b/documentations/USER_BEHAVIOR_ANALYTICS.md @@ -0,0 +1,46 @@ +# Docker-Android's Anonymous Aggregate User Behavior Analytics +Docker-Android has begun gathering anonymous aggregate user behavior analytics and reporting these to Google Sheets through Google Forms API (Google Form ID: 1FAIpQLSdrKWQdMh6Nt8v8NQdYvTIntohebAgqWCpXT3T9NofAoxcpkw). You are notified about this when you start Docker-Android. + +## Why? +We don't have direct communication with its users nor time resources to ask directly for their feedback. As a result, we now use anonymous aggregate user behavior analytics to help us understand how Docker-Android is being used, the most common used features based on how, where and when people use it. With this information we can prioritize some features over other ones. + +## What? +Docker-Android's Sheets record some shared information for every event: + +* Date and time when Docker-Android started +* User (it will collect the information about Release Version of Machine), e.g. Linux-5.4.0-146-generic-x86_64-with-glibc2.29_#163-Ubuntu_SMP_Fri_Mar_17_18:26:02_UTC_2023. This does not allow us to track individual users but does enable us to accurately measure user counts +* City (the information come from https://ipinfo.io) +* Region (the information come from https://ipinfo.io) +* Country (the information come from https://ipinfo.io) +* Release version of Docker-Android +* Appium (Whether user use Appium or not - The possible value will be "true" or "false") +* Appium Additional Arguments +* Web-Log (Whether user use Web-Log feature or not - The possible value will be "true" or "false") +* Web-Vnc (Whether user use Web-Vnc feature or not - The possible value will be "true" or "false") +* Screen-Resolution +* Device Type (Which docker image is used - The possible value will be "emulator" or "geny_cloud" or "geny_aws") +* Emulator Device (Which device profile and skin is used if the user use device_type "emulator") +* Emulator Android Version (Which Android version is used if the user use device_type "emulator" +* Emulator No-Skin feature (Whether user use no-skin feature or not - The possible value will be "true" or "false") +* Emulator Data Partition +* Emulator Additional Arguments + +With the recorded information, it is not possible for us to match any particular real user. + +## When/Where? +Docker-Android's user behavior analytics are sent throughout Docker-Android's execution to Google Sheets through Google Forms API over HTTPS. + +## Who? +Docker-Android's analytics are accessible to Docker-Android's current maintainers. Contact [@budtmo](https://github.com/budtmo) if you are a maintainer and need access. + +## How? +The code is viewable in [these scripts](../cli/src/device). + +## Opting out before starting Docker-Android +Docker-Android analytics helps us, maintainers and leaving it on is appreciated. However, if you want to opt out and not send any information, you can do this by using passing environment variable USER_BEHAVIOR_ANALYTICS=false to the Docker container. + +## Disclaimer +This document and the implementation are based on the great idea implemented by [Homebrew](https://github.com/Homebrew/brew/blob/master/docs/Analytics.md) + + +[<- BACK TO LICENSE](../LICENSE.md) diff --git a/documentations/USE_CASE_APPIUM.md b/documentations/USE_CASE_APPIUM.md new file mode 100644 index 0000000..daf352f --- /dev/null +++ b/documentations/USE_CASE_APPIUM.md @@ -0,0 +1,19 @@ +Run Appium Server +----------------- + +Appium is automation test framework to test mobile website and mobile application, including Android. To be able to use Appium, you need to run Appium-Server. You run Appium-Server inside docker-android container by ***opening port 4723*** and ***passing an environment variable APPIUM=true***. + +``` +docker run -d -p 6080:6080 -p 4723:4723 -e EMULATOR_DEVICE="Samsung Galaxy S10" -e WEB_VNC=true -e APPIUM=true --device /dev/kvm --name android-container budtmo/docker-android:emulator_11.0 +``` + +### Additional parameters to Appium Server + +The user can pass the additional parameter to Appium Server through environment variable ***APPIUM_ADDITIONAL_ARGS***. Please check [this page](http://appium.io/docs/en/2.0/cli/args/) for possible arguments that can be passed to Appium 2.x. + +### Connect to Selenium Grid 4.x + +The user can connect docker-android that contains Appium 2.x to Selenium Grid 4.x without any additional configurations / changes in docker-android project. Please check [this page](http://appium.io/docs/en/2.0/guides/grid/) for detail information + + +[<- BACK TO README](../README.md) diff --git a/documentations/USE_CASE_BUILD_ANDROID_PROJECT.md b/documentations/USE_CASE_BUILD_ANDROID_PROJECT.md new file mode 100644 index 0000000..1b6b314 --- /dev/null +++ b/documentations/USE_CASE_BUILD_ANDROID_PROJECT.md @@ -0,0 +1,19 @@ +Build Android project +--------------------- + +Docker-Android can be used for building Android project and executing its unit test. This following steps will illustrate how to build Android project: + +1. Clone [this sample test project](https://github.com/android/testing-samples). + + ``` + git clone git@github.com:android/testing-samples.git + ``` + +2. Build the project + + ``` + docker run -it --rm -v $PWD/testing-samples/ui/espresso/BasicSample:/home/androidusr/tmp -w /home/androidusr/tmp --entrypoint "/bin/bash" budtmo/docker-android:emulator_11.0_v2.0 -c "./gradlew build" + ``` + + +[<- BACK TO README](../README.md) diff --git a/README_CLOUD.md b/documentations/USE_CASE_CLOUD.md similarity index 58% rename from README_CLOUD.md rename to documentations/USE_CASE_CLOUD.md index c37edb5..de66161 100644 --- a/README_CLOUD.md +++ b/documentations/USE_CASE_CLOUD.md @@ -14,12 +14,5 @@ Google Cloud (GCE) Make sure your instances for your emulators have Nested Virtualization enabled Reference: https://cloud.google.com/compute/docs/instances/enable-nested-virtualization-vm-instances -One the disk and instance are created as [specified here](https://cloud.google.com/compute/docs/instances/enable-nested-virtualization-vm-instances#enablenestedvirt), -the emulator can be brought up as follows: - # Assume app.apk is in /tmp - docker run --privileged -d -e DEVICE="Samsung Galaxy S6" --volume /tmp:/APK \ - --name android_em budtmo/docker-android-x86-8.1 - - docker exec android_em adb wait-for-device - docker exec android_em adb install /APK/app.apk +[<- BACK TO README](../README.md) diff --git a/documentations/USE_CASE_CONTROL_EMULATOR.md b/documentations/USE_CASE_CONTROL_EMULATOR.md new file mode 100644 index 0000000..78fd4cb --- /dev/null +++ b/documentations/USE_CASE_CONTROL_EMULATOR.md @@ -0,0 +1,17 @@ +Control emulator from host machine +---------------------------------- + +1. Open port 5554 and 5555 while running docker-android container + ``` + docker run ... -p 5554:5554 -p 5555:5555 ... + ``` + +2. Connect emulator inside docker-android container with host adb + ``` + adb connect :5555 + ``` + +![connect_emulator_with_host_machine](../images/use-case_control-emulator.png) + + +[<- BACK TO README](../README.md) diff --git a/README_JENKINS.md b/documentations/USE_CASE_JENKINS.md similarity index 85% rename from README_JENKINS.md rename to documentations/USE_CASE_JENKINS.md index 45d8051..ad8b91e 100644 --- a/README_JENKINS.md +++ b/documentations/USE_CASE_JENKINS.md @@ -4,3 +4,6 @@ Jenkins Following Jenkins plug-ins supports Docker-Android to optimize your work. 1. Live preview: [budtmo/jenkins-plugin-vncviewer-docker-container](https://github.com/budtmo/vncviewer-docker-container-plugin) + + +[<- BACK TO README](../README.md) diff --git a/documentations/USE_CASE_SMS.md b/documentations/USE_CASE_SMS.md new file mode 100644 index 0000000..87040a3 --- /dev/null +++ b/documentations/USE_CASE_SMS.md @@ -0,0 +1,15 @@ +SMS +--- + +- Example by using adb + + ```bash + docker exec -it android-container adb emu sms send + ``` + +- The user can also integrate it inside project using adb library. + +![sms](../images/use-case_sms.png) + + +[<- BACK TO README](../README.md) diff --git a/example/android/python/README.md b/example/android/python/README.md deleted file mode 100644 index e89bb65..0000000 --- a/example/android/python/README.md +++ /dev/null @@ -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]: diff --git a/example/android/python/app_simple.py b/example/android/python/app_simple.py deleted file mode 100644 index e151afe..0000000 --- a/example/android/python/app_simple.py +++ /dev/null @@ -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) diff --git a/example/android/python/msite_simple_chrome.py b/example/android/python/msite_simple_chrome.py deleted file mode 100644 index 55b0dd5..0000000 --- a/example/android/python/msite_simple_chrome.py +++ /dev/null @@ -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) diff --git a/example/android/python/msite_simple_default_browser.py b/example/android/python/msite_simple_default_browser.py deleted file mode 100644 index dc6990d..0000000 --- a/example/android/python/msite_simple_default_browser.py +++ /dev/null @@ -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) diff --git a/example/android/python/requirements.txt b/example/android/python/requirements.txt deleted file mode 100644 index 5c071b9..0000000 --- a/example/android/python/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -Appium-Python-Client==0.24 diff --git a/example/genymotion/aws.json b/example/genymotion/aws.json new file mode 100644 index 0000000..7ee0ec5 --- /dev/null +++ b/example/genymotion/aws.json @@ -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": "" + } +] diff --git a/example/genymotion/saas.json b/example/genymotion/saas.json new file mode 100644 index 0000000..66c6442 --- /dev/null +++ b/example/genymotion/saas.json @@ -0,0 +1,10 @@ +[ + { + "name": "SamsungS7V6", + "template": "a2a0c86c-7572-45fe-98d0-66f8efed9fa0", + "local_port": 51345 + }, + { + "template": "80a67ae9-430c-4824-a386-befbb19518b9" + } +] diff --git a/example/sample_apk/sample_apk_debug.apk b/example/sample_apk/sample_apk_debug.apk deleted file mode 100644 index fcaa8de..0000000 Binary files a/example/sample_apk/sample_apk_debug.apk and /dev/null differ diff --git a/genymotion/example/geny.yml b/genymotion/example/geny.yml deleted file mode 100755 index 22bacb3..0000000 --- a/genymotion/example/geny.yml +++ /dev/null @@ -1,42 +0,0 @@ -# Note: It requires docker-compose 1.13.0 -# -# Usage: docker-compose up -d -version: "2.2" - -services: - # Selenium hub - selenium_hub: - image: selenium/hub:3.14.0-curium - ports: - - 4444:4444 - - # Please stop this container by using docker stop instead of docker-compose stop - saas: - image: budtmo/docker-android-genymotion - depends_on: - - selenium_hub - privileged: true - volumes: - - $PWD/sample_apk:/root/tmp/sample_apk - - $PWD/sample_devices:/root/tmp - environment: - - TYPE=SaaS - - TEMPLATE=/root/tmp/devices.json - - USER=$USER - - PASS=$PASS - - CONNECT_TO_GRID=true - - # Please stop this container by using docker stop instead of docker-compose stop - aws: - image: budtmo/docker-android-genymotion - depends_on: - - selenium_hub - privileged: true - volumes: - - ~/.aws:/root/.aws - - $PWD/sample_apk:/root/tmp/sample_apk - - $PWD/sample_devices:/root/tmp - environment: - - TYPE=aws - - TEMPLATE=/root/tmp/aws.json - - CONNECT_TO_GRID=true diff --git a/genymotion/example/sample_apk/sample_apk_debug.apk b/genymotion/example/sample_apk/sample_apk_debug.apk deleted file mode 100644 index fcaa8de..0000000 Binary files a/genymotion/example/sample_apk/sample_apk_debug.apk and /dev/null differ diff --git a/genymotion/example/sample_devices/aws.json b/genymotion/example/sample_devices/aws.json deleted file mode 100755 index 48ba387..0000000 --- a/genymotion/example/sample_devices/aws.json +++ /dev/null @@ -1,60 +0,0 @@ -[ - { - "region": "eu-west-1", - "android_version": "8.0", - "instance": "t2.small" - }, - { - "region": "eu-west-1", - "instance": "t2.small", - "AMI": "ami-68d78411", - "SG": [ - { - "type": "ingress", - "configurations": [ - { - "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" - } - ] - }, - { - "type": "egress", - "configurations": [ - { - "from_port": 0, - "to_port": 65535, - "protocol": "udp", - "cidr_blocks": "0.0.0.0/0" - } - ] - } - ] - } -] diff --git a/genymotion/example/sample_devices/devices.json b/genymotion/example/sample_devices/devices.json deleted file mode 100755 index b635aaa..0000000 --- a/genymotion/example/sample_devices/devices.json +++ /dev/null @@ -1,11 +0,0 @@ -[ - { - "template": "a2a0c86c-7572-45fe-98d0-66f8efed9fa0", - "device": "SamsungS7V6", - "port": 38727 - }, - { - "template": "80a67ae9-430c-4824-a386-befbb19518b9", - "device": "Nexus6V8" - } -] diff --git a/genymotion/example/start_compose.sh b/genymotion/example/start_compose.sh deleted file mode 100755 index 65fbdc6..0000000 --- a/genymotion/example/start_compose.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -(export USER=$USER && export PASS=$PASS && docker-compose -f geny.yml up -d) diff --git a/genymotion/generate_config.sh b/genymotion/generate_config.sh deleted file mode 100755 index e11dd08..0000000 --- a/genymotion/generate_config.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/bash - -node_config_json=$1 - -if [ -z "$PLATFORM_NAME" ]; then - PLATFORM_NAME="Android" -fi - -if [ -z "$APPIUM_HOST" ]; then - APPIUM_HOST=$(hostname -i) -fi - -if [ -z "$APPIUM_PORT" ]; then - APPIUM_PORT=4723 -fi - -if [ -z "$SELENIUM_HOST" ]; then - SELENIUM_HOST="172.17.0.1" -fi - -if [ -z "$SELENIUM_PORT" ]; then - SELENIUM_PORT=4444 -fi - -if [ -z "$BROWSER_NAME" ]; then - BROWSER_NAME="android" -fi - -if [ -z "$NODE_TIMEOUT" ]; then - NODE_TIMEOUT=300 -fi - -#Get device names -devices=($(adb devices | grep -oP "\K([^ ]+)(?=\sdevice(\W|$))")) -echo "Devices found: ${#devices[@]}" - -#Create capabilities json configs -function create_capabilities() { - capabilities="" - for name in ${devices[@]}; do - os_version="$(adb -s $name shell getprop ro.build.version.release | tr -d '\r')" - capabilities+=$(cat <<_EOF -{ - "platform": "$PLATFORM_NAME", - "platformName": "$PLATFORM_NAME", - "version": "$os_version", - "browserName": "$BROWSER_NAME", - "deviceName": "$name", - "maxInstances": 1, - "applicationName": "$name" - } -_EOF - ) - if [ ${devices[-1]} != $name ]; then - capabilities+=', ' - fi - done - echo "$capabilities" -} - -#Final node configuration json string -nodeconfig=$(cat <<_EOF -{ - "capabilities": [$(create_capabilities)], - "configuration": { - "cleanUpCycle": 2000, - "timeout": $NODE_TIMEOUT, - "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy", - "url": "http://$APPIUM_HOST:$APPIUM_PORT/wd/hub", - "host": "$APPIUM_HOST", - "port": $APPIUM_PORT, - "maxSession": 6, - "register": true, - "registerCycle": 5000, - "hubHost": "$SELENIUM_HOST", - "hubPort": $SELENIUM_PORT - } -} -_EOF -) -echo "$nodeconfig" > $node_config_json diff --git a/genymotion/geny_start.sh b/genymotion/geny_start.sh deleted file mode 100755 index cf9da4a..0000000 --- a/genymotion/geny_start.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash -# This script is needed because of https://www.ctl.io/developers/blog/post/gracefully-stopping-docker-containers/ - -types=(saas aws) - -if [ -z "$TYPE" ]; then - echo "Please specify one of following types: ${types[@]}" - exit 1 -fi -TYPE=$(echo "$TYPE" | tr '[:upper:]' '[:lower:]') - -if [ -z "$TEMPLATE" ]; then - case $TYPE in - "${types[0]}" ) - TEMPLATE="/root/tmp/devices.json" - ;; - "${types[1]}" ) - TEMPLATE="/root/tmp/aws.json" - ;; - *) - "Type $TYPE is not supported! Valid types: ${types[@]}" - exit 1 - ;; - esac -fi - -if [ ! -f "$TEMPLATE" ]; then - echo "File not found! Nothing to do!" - exit 1 -fi - -echo "[geny_start] Available types: ${types[@]}" -echo "[geny_start] Selected type of deployment: $TYPE, Template file: $TEMPLATE" -export TYPE=$TYPE -export TEMPLATE=$TEMPLATE -export TYPES=${types[@]} - -getAbort() { - case $TYPE in - "${types[0]}" ) - echo "ABORT SIGNAL detected! Stopping all created instances / emulators..." - - # Get the list of created instances from the instance.txt - if [ ! -f "$INSTANCES_PATH" ]; then - echo "File not found! Nothing to do!" - exit 1 - else - content=$(cat ${INSTANCES_PATH}) - read -a instances <<< $content - echo "All created instances: ${instances[@]}" - - # Stop the instance one by one - for i in "${instances[@]}" - do - echo "stop instance with id \"${i}\"" - gmsaas instances stop "${i}" - echo "stopped" - done - echo "Done" - fi - ;; - "${types[1]}" ) - contents=$(cat $TEMPLATE) - echo "ABORT SIGNAL detected! Detroy all EC2 instance(s)..." - ./terraform destroy -auto-approve -lock=false - ;; - esac -} -trap 'getAbort; exit' EXIT - -/usr/bin/supervisord --configuration supervisord.conf diff --git a/images/Genymotion_cloud.png b/images/Genymotion_cloud.png deleted file mode 100644 index ba1aa04..0000000 Binary files a/images/Genymotion_cloud.png and /dev/null differ diff --git a/images/SMS.png b/images/SMS.png deleted file mode 100644 index a3d14c8..0000000 Binary files a/images/SMS.png and /dev/null differ diff --git a/images/appiumconf2018.png b/images/appiumconf2018.png deleted file mode 100644 index 78f9c61..0000000 Binary files a/images/appiumconf2018.png and /dev/null differ diff --git a/images/compose.png b/images/compose.png deleted file mode 100644 index 4904f21..0000000 Binary files a/images/compose.png and /dev/null differ diff --git a/images/docker-android_users.png b/images/docker-android_users.png deleted file mode 100644 index 1df1830..0000000 Binary files a/images/docker-android_users.png and /dev/null differ diff --git a/images/emulator_nexus_5.png b/images/emulator_nexus_5.png deleted file mode 100644 index 21cd49e..0000000 Binary files a/images/emulator_nexus_5.png and /dev/null differ diff --git a/images/emulator_samsung_galaxy_s6.png b/images/emulator_samsung_galaxy_s6.png deleted file mode 100644 index 6e758c8..0000000 Binary files a/images/emulator_samsung_galaxy_s6.png and /dev/null differ diff --git a/images/logo_dockerandroid_small.png b/images/logo_docker-android.png similarity index 100% rename from images/logo_dockerandroid_small.png rename to images/logo_docker-android.png diff --git a/images/parallels_enable_nested_virtualization.png b/images/parallels_enable_nested_virtualization.png deleted file mode 100644 index d5dfd3a..0000000 Binary files a/images/parallels_enable_nested_virtualization.png and /dev/null differ diff --git a/images/real_device.png b/images/real_device.png deleted file mode 100644 index 648beab..0000000 Binary files a/images/real_device.png and /dev/null differ diff --git a/images/adb_connection.png b/images/use-case_control-emulator.png similarity index 100% rename from images/adb_connection.png rename to images/use-case_control-emulator.png diff --git a/images/use-case_sms.png b/images/use-case_sms.png new file mode 100644 index 0000000..360f98a Binary files /dev/null and b/images/use-case_sms.png differ diff --git a/images/vmwarefusion_enable_nested_virtualization.png b/images/vmwarefusion_enable_nested_virtualization.png deleted file mode 100644 index 29fa843..0000000 Binary files a/images/vmwarefusion_enable_nested_virtualization.png and /dev/null differ diff --git a/devices/profiles/samsung_galaxy_s10.xml b/mixins/configs/devices/profiles/samsung_galaxy_s10.xml similarity index 100% rename from devices/profiles/samsung_galaxy_s10.xml rename to mixins/configs/devices/profiles/samsung_galaxy_s10.xml diff --git a/devices/profiles/samsung_galaxy_s6.xml b/mixins/configs/devices/profiles/samsung_galaxy_s6.xml similarity index 100% rename from devices/profiles/samsung_galaxy_s6.xml rename to mixins/configs/devices/profiles/samsung_galaxy_s6.xml diff --git a/devices/profiles/samsung_galaxy_s7.xml b/mixins/configs/devices/profiles/samsung_galaxy_s7.xml similarity index 100% rename from devices/profiles/samsung_galaxy_s7.xml rename to mixins/configs/devices/profiles/samsung_galaxy_s7.xml diff --git a/devices/profiles/samsung_galaxy_s7_edge.xml b/mixins/configs/devices/profiles/samsung_galaxy_s7_edge.xml similarity index 100% rename from devices/profiles/samsung_galaxy_s7_edge.xml rename to mixins/configs/devices/profiles/samsung_galaxy_s7_edge.xml diff --git a/devices/profiles/samsung_galaxy_s8.xml b/mixins/configs/devices/profiles/samsung_galaxy_s8.xml similarity index 100% rename from devices/profiles/samsung_galaxy_s8.xml rename to mixins/configs/devices/profiles/samsung_galaxy_s8.xml diff --git a/devices/profiles/samsung_galaxy_s9.xml b/mixins/configs/devices/profiles/samsung_galaxy_s9.xml similarity index 100% rename from devices/profiles/samsung_galaxy_s9.xml rename to mixins/configs/devices/profiles/samsung_galaxy_s9.xml diff --git a/devices/skins/README.md b/mixins/configs/devices/skins/README.md similarity index 100% rename from devices/skins/README.md rename to mixins/configs/devices/skins/README.md diff --git a/devices/skins/nexus_4/land_back.png b/mixins/configs/devices/skins/nexus_4/land_back.png similarity index 100% rename from devices/skins/nexus_4/land_back.png rename to mixins/configs/devices/skins/nexus_4/land_back.png diff --git a/devices/skins/nexus_4/land_fore.png b/mixins/configs/devices/skins/nexus_4/land_fore.png similarity index 100% rename from devices/skins/nexus_4/land_fore.png rename to mixins/configs/devices/skins/nexus_4/land_fore.png diff --git a/devices/skins/nexus_4/land_shadow.png b/mixins/configs/devices/skins/nexus_4/land_shadow.png similarity index 100% rename from devices/skins/nexus_4/land_shadow.png rename to mixins/configs/devices/skins/nexus_4/land_shadow.png diff --git a/devices/skins/nexus_4/layout b/mixins/configs/devices/skins/nexus_4/layout similarity index 100% rename from devices/skins/nexus_4/layout rename to mixins/configs/devices/skins/nexus_4/layout diff --git a/devices/skins/nexus_4/port_back.png b/mixins/configs/devices/skins/nexus_4/port_back.png similarity index 100% rename from devices/skins/nexus_4/port_back.png rename to mixins/configs/devices/skins/nexus_4/port_back.png diff --git a/devices/skins/nexus_4/port_fore.png b/mixins/configs/devices/skins/nexus_4/port_fore.png similarity index 100% rename from devices/skins/nexus_4/port_fore.png rename to mixins/configs/devices/skins/nexus_4/port_fore.png diff --git a/devices/skins/nexus_4/port_shadow.png b/mixins/configs/devices/skins/nexus_4/port_shadow.png similarity index 100% rename from devices/skins/nexus_4/port_shadow.png rename to mixins/configs/devices/skins/nexus_4/port_shadow.png diff --git a/devices/skins/nexus_4/thumb.png b/mixins/configs/devices/skins/nexus_4/thumb.png similarity index 100% rename from devices/skins/nexus_4/thumb.png rename to mixins/configs/devices/skins/nexus_4/thumb.png diff --git a/devices/skins/nexus_5/land_back.png b/mixins/configs/devices/skins/nexus_5/land_back.png similarity index 100% rename from devices/skins/nexus_5/land_back.png rename to mixins/configs/devices/skins/nexus_5/land_back.png diff --git a/devices/skins/nexus_5/land_fore.png b/mixins/configs/devices/skins/nexus_5/land_fore.png similarity index 100% rename from devices/skins/nexus_5/land_fore.png rename to mixins/configs/devices/skins/nexus_5/land_fore.png diff --git a/devices/skins/nexus_5/land_shadow.png b/mixins/configs/devices/skins/nexus_5/land_shadow.png similarity index 100% rename from devices/skins/nexus_5/land_shadow.png rename to mixins/configs/devices/skins/nexus_5/land_shadow.png diff --git a/devices/skins/nexus_5/layout b/mixins/configs/devices/skins/nexus_5/layout similarity index 100% rename from devices/skins/nexus_5/layout rename to mixins/configs/devices/skins/nexus_5/layout diff --git a/devices/skins/nexus_5/port_back.png b/mixins/configs/devices/skins/nexus_5/port_back.png similarity index 100% rename from devices/skins/nexus_5/port_back.png rename to mixins/configs/devices/skins/nexus_5/port_back.png diff --git a/devices/skins/nexus_5/port_fore.png b/mixins/configs/devices/skins/nexus_5/port_fore.png similarity index 100% rename from devices/skins/nexus_5/port_fore.png rename to mixins/configs/devices/skins/nexus_5/port_fore.png diff --git a/devices/skins/nexus_5/port_shadow.png b/mixins/configs/devices/skins/nexus_5/port_shadow.png similarity index 100% rename from devices/skins/nexus_5/port_shadow.png rename to mixins/configs/devices/skins/nexus_5/port_shadow.png diff --git a/devices/skins/nexus_7/land_back.png b/mixins/configs/devices/skins/nexus_7/land_back.png similarity index 100% rename from devices/skins/nexus_7/land_back.png rename to mixins/configs/devices/skins/nexus_7/land_back.png diff --git a/devices/skins/nexus_7/land_fore.png b/mixins/configs/devices/skins/nexus_7/land_fore.png similarity index 100% rename from devices/skins/nexus_7/land_fore.png rename to mixins/configs/devices/skins/nexus_7/land_fore.png diff --git a/devices/skins/nexus_7/land_shadow.png b/mixins/configs/devices/skins/nexus_7/land_shadow.png similarity index 100% rename from devices/skins/nexus_7/land_shadow.png rename to mixins/configs/devices/skins/nexus_7/land_shadow.png diff --git a/devices/skins/nexus_7/layout b/mixins/configs/devices/skins/nexus_7/layout similarity index 100% rename from devices/skins/nexus_7/layout rename to mixins/configs/devices/skins/nexus_7/layout diff --git a/devices/skins/nexus_7/port_back.png b/mixins/configs/devices/skins/nexus_7/port_back.png similarity index 100% rename from devices/skins/nexus_7/port_back.png rename to mixins/configs/devices/skins/nexus_7/port_back.png diff --git a/devices/skins/nexus_7/port_fore.png b/mixins/configs/devices/skins/nexus_7/port_fore.png similarity index 100% rename from devices/skins/nexus_7/port_fore.png rename to mixins/configs/devices/skins/nexus_7/port_fore.png diff --git a/devices/skins/nexus_7/port_shadow.png b/mixins/configs/devices/skins/nexus_7/port_shadow.png similarity index 100% rename from devices/skins/nexus_7/port_shadow.png rename to mixins/configs/devices/skins/nexus_7/port_shadow.png diff --git a/devices/skins/nexus_7/thumb.png b/mixins/configs/devices/skins/nexus_7/thumb.png similarity index 100% rename from devices/skins/nexus_7/thumb.png rename to mixins/configs/devices/skins/nexus_7/thumb.png diff --git a/devices/skins/nexus_one/button.png b/mixins/configs/devices/skins/nexus_one/button.png similarity index 100% rename from devices/skins/nexus_one/button.png rename to mixins/configs/devices/skins/nexus_one/button.png diff --git a/devices/skins/nexus_one/land_back.png b/mixins/configs/devices/skins/nexus_one/land_back.png similarity index 100% rename from devices/skins/nexus_one/land_back.png rename to mixins/configs/devices/skins/nexus_one/land_back.png diff --git a/devices/skins/nexus_one/land_shadow.png b/mixins/configs/devices/skins/nexus_one/land_shadow.png similarity index 100% rename from devices/skins/nexus_one/land_shadow.png rename to mixins/configs/devices/skins/nexus_one/land_shadow.png diff --git a/devices/skins/nexus_one/layout b/mixins/configs/devices/skins/nexus_one/layout similarity index 100% rename from devices/skins/nexus_one/layout rename to mixins/configs/devices/skins/nexus_one/layout diff --git a/devices/skins/nexus_one/port_back.png b/mixins/configs/devices/skins/nexus_one/port_back.png similarity index 100% rename from devices/skins/nexus_one/port_back.png rename to mixins/configs/devices/skins/nexus_one/port_back.png diff --git a/devices/skins/nexus_one/port_shadow.png b/mixins/configs/devices/skins/nexus_one/port_shadow.png similarity index 100% rename from devices/skins/nexus_one/port_shadow.png rename to mixins/configs/devices/skins/nexus_one/port_shadow.png diff --git a/devices/skins/nexus_one/power.png b/mixins/configs/devices/skins/nexus_one/power.png similarity index 100% rename from devices/skins/nexus_one/power.png rename to mixins/configs/devices/skins/nexus_one/power.png diff --git a/devices/skins/nexus_one/power_land.png b/mixins/configs/devices/skins/nexus_one/power_land.png similarity index 100% rename from devices/skins/nexus_one/power_land.png rename to mixins/configs/devices/skins/nexus_one/power_land.png diff --git a/devices/skins/nexus_one/thumb.png b/mixins/configs/devices/skins/nexus_one/thumb.png similarity index 100% rename from devices/skins/nexus_one/thumb.png rename to mixins/configs/devices/skins/nexus_one/thumb.png diff --git a/devices/skins/nexus_one/volume_down.png b/mixins/configs/devices/skins/nexus_one/volume_down.png similarity index 100% rename from devices/skins/nexus_one/volume_down.png rename to mixins/configs/devices/skins/nexus_one/volume_down.png diff --git a/devices/skins/nexus_one/volume_down_land.png b/mixins/configs/devices/skins/nexus_one/volume_down_land.png similarity index 100% rename from devices/skins/nexus_one/volume_down_land.png rename to mixins/configs/devices/skins/nexus_one/volume_down_land.png diff --git a/devices/skins/nexus_one/volume_up.png b/mixins/configs/devices/skins/nexus_one/volume_up.png similarity index 100% rename from devices/skins/nexus_one/volume_up.png rename to mixins/configs/devices/skins/nexus_one/volume_up.png diff --git a/devices/skins/nexus_one/volume_up_land.png b/mixins/configs/devices/skins/nexus_one/volume_up_land.png similarity index 100% rename from devices/skins/nexus_one/volume_up_land.png rename to mixins/configs/devices/skins/nexus_one/volume_up_land.png diff --git a/devices/skins/nexus_s/button.png b/mixins/configs/devices/skins/nexus_s/button.png similarity index 100% rename from devices/skins/nexus_s/button.png rename to mixins/configs/devices/skins/nexus_s/button.png diff --git a/devices/skins/nexus_s/land_back.png b/mixins/configs/devices/skins/nexus_s/land_back.png similarity index 100% rename from devices/skins/nexus_s/land_back.png rename to mixins/configs/devices/skins/nexus_s/land_back.png diff --git a/devices/skins/nexus_s/land_fore.png b/mixins/configs/devices/skins/nexus_s/land_fore.png similarity index 100% rename from devices/skins/nexus_s/land_fore.png rename to mixins/configs/devices/skins/nexus_s/land_fore.png diff --git a/devices/skins/nexus_s/land_shadow.png b/mixins/configs/devices/skins/nexus_s/land_shadow.png similarity index 100% rename from devices/skins/nexus_s/land_shadow.png rename to mixins/configs/devices/skins/nexus_s/land_shadow.png diff --git a/devices/skins/nexus_s/layout b/mixins/configs/devices/skins/nexus_s/layout similarity index 100% rename from devices/skins/nexus_s/layout rename to mixins/configs/devices/skins/nexus_s/layout diff --git a/devices/skins/nexus_s/port_back.png b/mixins/configs/devices/skins/nexus_s/port_back.png similarity index 100% rename from devices/skins/nexus_s/port_back.png rename to mixins/configs/devices/skins/nexus_s/port_back.png diff --git a/devices/skins/nexus_s/port_fore.png b/mixins/configs/devices/skins/nexus_s/port_fore.png similarity index 100% rename from devices/skins/nexus_s/port_fore.png rename to mixins/configs/devices/skins/nexus_s/port_fore.png diff --git a/devices/skins/nexus_s/port_shadow.png b/mixins/configs/devices/skins/nexus_s/port_shadow.png similarity index 100% rename from devices/skins/nexus_s/port_shadow.png rename to mixins/configs/devices/skins/nexus_s/port_shadow.png diff --git a/devices/skins/nexus_s/power.png b/mixins/configs/devices/skins/nexus_s/power.png similarity index 100% rename from devices/skins/nexus_s/power.png rename to mixins/configs/devices/skins/nexus_s/power.png diff --git a/devices/skins/nexus_s/power_land.png b/mixins/configs/devices/skins/nexus_s/power_land.png similarity index 100% rename from devices/skins/nexus_s/power_land.png rename to mixins/configs/devices/skins/nexus_s/power_land.png diff --git a/devices/skins/nexus_s/thumb.png b/mixins/configs/devices/skins/nexus_s/thumb.png similarity index 100% rename from devices/skins/nexus_s/thumb.png rename to mixins/configs/devices/skins/nexus_s/thumb.png diff --git a/devices/skins/nexus_s/volume_down.png b/mixins/configs/devices/skins/nexus_s/volume_down.png similarity index 100% rename from devices/skins/nexus_s/volume_down.png rename to mixins/configs/devices/skins/nexus_s/volume_down.png diff --git a/devices/skins/nexus_s/volume_down_land.png b/mixins/configs/devices/skins/nexus_s/volume_down_land.png similarity index 100% rename from devices/skins/nexus_s/volume_down_land.png rename to mixins/configs/devices/skins/nexus_s/volume_down_land.png diff --git a/devices/skins/nexus_s/volume_up.png b/mixins/configs/devices/skins/nexus_s/volume_up.png similarity index 100% rename from devices/skins/nexus_s/volume_up.png rename to mixins/configs/devices/skins/nexus_s/volume_up.png diff --git a/devices/skins/nexus_s/volume_up_land.png b/mixins/configs/devices/skins/nexus_s/volume_up_land.png similarity index 100% rename from devices/skins/nexus_s/volume_up_land.png rename to mixins/configs/devices/skins/nexus_s/volume_up_land.png diff --git a/devices/skins/samsung_galaxy_s10/.picasa.ini b/mixins/configs/devices/skins/samsung_galaxy_s10/.picasa.ini similarity index 100% rename from devices/skins/samsung_galaxy_s10/.picasa.ini rename to mixins/configs/devices/skins/samsung_galaxy_s10/.picasa.ini diff --git a/devices/skins/samsung_galaxy_s10/Thumbs.db b/mixins/configs/devices/skins/samsung_galaxy_s10/Thumbs.db similarity index 100% rename from devices/skins/samsung_galaxy_s10/Thumbs.db rename to mixins/configs/devices/skins/samsung_galaxy_s10/Thumbs.db diff --git a/devices/skins/samsung_galaxy_s10/arrow_down.png b/mixins/configs/devices/skins/samsung_galaxy_s10/arrow_down.png similarity index 100% rename from devices/skins/samsung_galaxy_s10/arrow_down.png rename to mixins/configs/devices/skins/samsung_galaxy_s10/arrow_down.png diff --git a/devices/skins/samsung_galaxy_s10/arrow_left.png b/mixins/configs/devices/skins/samsung_galaxy_s10/arrow_left.png similarity index 100% rename from devices/skins/samsung_galaxy_s10/arrow_left.png rename to mixins/configs/devices/skins/samsung_galaxy_s10/arrow_left.png diff --git a/devices/skins/samsung_galaxy_s10/arrow_right.png b/mixins/configs/devices/skins/samsung_galaxy_s10/arrow_right.png similarity index 100% rename from devices/skins/samsung_galaxy_s10/arrow_right.png rename to mixins/configs/devices/skins/samsung_galaxy_s10/arrow_right.png diff --git a/devices/skins/samsung_galaxy_s10/arrow_up.png b/mixins/configs/devices/skins/samsung_galaxy_s10/arrow_up.png similarity index 100% rename from devices/skins/samsung_galaxy_s10/arrow_up.png rename to mixins/configs/devices/skins/samsung_galaxy_s10/arrow_up.png diff --git a/devices/skins/samsung_galaxy_s10/button.png b/mixins/configs/devices/skins/samsung_galaxy_s10/button.png similarity index 100% rename from devices/skins/samsung_galaxy_s10/button.png rename to mixins/configs/devices/skins/samsung_galaxy_s10/button.png diff --git a/devices/skins/samsung_galaxy_s10/controls.png b/mixins/configs/devices/skins/samsung_galaxy_s10/controls.png similarity index 100% rename from devices/skins/samsung_galaxy_s10/controls.png rename to mixins/configs/devices/skins/samsung_galaxy_s10/controls.png diff --git a/devices/skins/samsung_galaxy_s10/device_Land.png b/mixins/configs/devices/skins/samsung_galaxy_s10/device_Land.png similarity index 100% rename from devices/skins/samsung_galaxy_s10/device_Land.png rename to mixins/configs/devices/skins/samsung_galaxy_s10/device_Land.png diff --git a/devices/skins/samsung_galaxy_s10/device_Port.png b/mixins/configs/devices/skins/samsung_galaxy_s10/device_Port.png similarity index 100% rename from devices/skins/samsung_galaxy_s10/device_Port.png rename to mixins/configs/devices/skins/samsung_galaxy_s10/device_Port.png diff --git a/devices/skins/samsung_galaxy_s10/hardware.ini b/mixins/configs/devices/skins/samsung_galaxy_s10/hardware.ini similarity index 100% rename from devices/skins/samsung_galaxy_s10/hardware.ini rename to mixins/configs/devices/skins/samsung_galaxy_s10/hardware.ini diff --git a/devices/skins/samsung_galaxy_s10/key-num.png b/mixins/configs/devices/skins/samsung_galaxy_s10/key-num.png similarity index 100% rename from devices/skins/samsung_galaxy_s10/key-num.png rename to mixins/configs/devices/skins/samsung_galaxy_s10/key-num.png diff --git a/devices/skins/samsung_galaxy_s10/key.png b/mixins/configs/devices/skins/samsung_galaxy_s10/key.png similarity index 100% rename from devices/skins/samsung_galaxy_s10/key.png rename to mixins/configs/devices/skins/samsung_galaxy_s10/key.png diff --git a/devices/skins/samsung_galaxy_s10/key2.png b/mixins/configs/devices/skins/samsung_galaxy_s10/key2.png similarity index 100% rename from devices/skins/samsung_galaxy_s10/key2.png rename to mixins/configs/devices/skins/samsung_galaxy_s10/key2.png diff --git a/devices/skins/samsung_galaxy_s10/keyboard.png b/mixins/configs/devices/skins/samsung_galaxy_s10/keyboard.png similarity index 100% rename from devices/skins/samsung_galaxy_s10/keyboard.png rename to mixins/configs/devices/skins/samsung_galaxy_s10/keyboard.png diff --git a/devices/skins/samsung_galaxy_s10/land-button1.png b/mixins/configs/devices/skins/samsung_galaxy_s10/land-button1.png similarity index 100% rename from devices/skins/samsung_galaxy_s10/land-button1.png rename to mixins/configs/devices/skins/samsung_galaxy_s10/land-button1.png diff --git a/devices/skins/samsung_galaxy_s10/land-button2.png b/mixins/configs/devices/skins/samsung_galaxy_s10/land-button2.png similarity index 100% rename from devices/skins/samsung_galaxy_s10/land-button2.png rename to mixins/configs/devices/skins/samsung_galaxy_s10/land-button2.png diff --git a/devices/skins/samsung_galaxy_s10/land-button3.png b/mixins/configs/devices/skins/samsung_galaxy_s10/land-button3.png similarity index 100% rename from devices/skins/samsung_galaxy_s10/land-button3.png rename to mixins/configs/devices/skins/samsung_galaxy_s10/land-button3.png diff --git a/devices/skins/samsung_galaxy_s10/layout b/mixins/configs/devices/skins/samsung_galaxy_s10/layout similarity index 100% rename from devices/skins/samsung_galaxy_s10/layout rename to mixins/configs/devices/skins/samsung_galaxy_s10/layout diff --git a/devices/skins/samsung_galaxy_s10/manifest.ini b/mixins/configs/devices/skins/samsung_galaxy_s10/manifest.ini similarity index 100% rename from devices/skins/samsung_galaxy_s10/manifest.ini rename to mixins/configs/devices/skins/samsung_galaxy_s10/manifest.ini diff --git a/devices/skins/samsung_galaxy_s10/port-button1.png b/mixins/configs/devices/skins/samsung_galaxy_s10/port-button1.png similarity index 100% rename from devices/skins/samsung_galaxy_s10/port-button1.png rename to mixins/configs/devices/skins/samsung_galaxy_s10/port-button1.png diff --git a/devices/skins/samsung_galaxy_s10/port-button2.png b/mixins/configs/devices/skins/samsung_galaxy_s10/port-button2.png similarity index 100% rename from devices/skins/samsung_galaxy_s10/port-button2.png rename to mixins/configs/devices/skins/samsung_galaxy_s10/port-button2.png diff --git a/devices/skins/samsung_galaxy_s10/port-button3.png b/mixins/configs/devices/skins/samsung_galaxy_s10/port-button3.png similarity index 100% rename from devices/skins/samsung_galaxy_s10/port-button3.png rename to mixins/configs/devices/skins/samsung_galaxy_s10/port-button3.png diff --git a/devices/skins/samsung_galaxy_s10/power_l.png b/mixins/configs/devices/skins/samsung_galaxy_s10/power_l.png similarity index 100% rename from devices/skins/samsung_galaxy_s10/power_l.png rename to mixins/configs/devices/skins/samsung_galaxy_s10/power_l.png diff --git a/devices/skins/samsung_galaxy_s10/power_p.png b/mixins/configs/devices/skins/samsung_galaxy_s10/power_p.png similarity index 100% rename from devices/skins/samsung_galaxy_s10/power_p.png rename to mixins/configs/devices/skins/samsung_galaxy_s10/power_p.png diff --git a/devices/skins/samsung_galaxy_s10/select.png b/mixins/configs/devices/skins/samsung_galaxy_s10/select.png similarity index 100% rename from devices/skins/samsung_galaxy_s10/select.png rename to mixins/configs/devices/skins/samsung_galaxy_s10/select.png diff --git a/devices/skins/samsung_galaxy_s10/spacebar.png b/mixins/configs/devices/skins/samsung_galaxy_s10/spacebar.png similarity index 100% rename from devices/skins/samsung_galaxy_s10/spacebar.png rename to mixins/configs/devices/skins/samsung_galaxy_s10/spacebar.png diff --git a/devices/skins/samsung_galaxy_s10/volume_down_l.png b/mixins/configs/devices/skins/samsung_galaxy_s10/volume_down_l.png similarity index 100% rename from devices/skins/samsung_galaxy_s10/volume_down_l.png rename to mixins/configs/devices/skins/samsung_galaxy_s10/volume_down_l.png diff --git a/devices/skins/samsung_galaxy_s10/volume_down_p.png b/mixins/configs/devices/skins/samsung_galaxy_s10/volume_down_p.png similarity index 100% rename from devices/skins/samsung_galaxy_s10/volume_down_p.png rename to mixins/configs/devices/skins/samsung_galaxy_s10/volume_down_p.png diff --git a/devices/skins/samsung_galaxy_s10/volume_up_l.png b/mixins/configs/devices/skins/samsung_galaxy_s10/volume_up_l.png similarity index 100% rename from devices/skins/samsung_galaxy_s10/volume_up_l.png rename to mixins/configs/devices/skins/samsung_galaxy_s10/volume_up_l.png diff --git a/devices/skins/samsung_galaxy_s10/volume_up_p.png b/mixins/configs/devices/skins/samsung_galaxy_s10/volume_up_p.png similarity index 100% rename from devices/skins/samsung_galaxy_s10/volume_up_p.png rename to mixins/configs/devices/skins/samsung_galaxy_s10/volume_up_p.png diff --git a/devices/skins/samsung_galaxy_s6/S6_Land.png b/mixins/configs/devices/skins/samsung_galaxy_s6/S6_Land.png similarity index 100% rename from devices/skins/samsung_galaxy_s6/S6_Land.png rename to mixins/configs/devices/skins/samsung_galaxy_s6/S6_Land.png diff --git a/devices/skins/samsung_galaxy_s6/S6_Port.png b/mixins/configs/devices/skins/samsung_galaxy_s6/S6_Port.png similarity index 100% rename from devices/skins/samsung_galaxy_s6/S6_Port.png rename to mixins/configs/devices/skins/samsung_galaxy_s6/S6_Port.png diff --git a/devices/skins/samsung_galaxy_s6/arrow_down.png b/mixins/configs/devices/skins/samsung_galaxy_s6/arrow_down.png similarity index 100% rename from devices/skins/samsung_galaxy_s6/arrow_down.png rename to mixins/configs/devices/skins/samsung_galaxy_s6/arrow_down.png diff --git a/devices/skins/samsung_galaxy_s6/arrow_left.png b/mixins/configs/devices/skins/samsung_galaxy_s6/arrow_left.png similarity index 100% rename from devices/skins/samsung_galaxy_s6/arrow_left.png rename to mixins/configs/devices/skins/samsung_galaxy_s6/arrow_left.png diff --git a/devices/skins/samsung_galaxy_s6/arrow_right.png b/mixins/configs/devices/skins/samsung_galaxy_s6/arrow_right.png similarity index 100% rename from devices/skins/samsung_galaxy_s6/arrow_right.png rename to mixins/configs/devices/skins/samsung_galaxy_s6/arrow_right.png diff --git a/devices/skins/samsung_galaxy_s6/arrow_up.png b/mixins/configs/devices/skins/samsung_galaxy_s6/arrow_up.png similarity index 100% rename from devices/skins/samsung_galaxy_s6/arrow_up.png rename to mixins/configs/devices/skins/samsung_galaxy_s6/arrow_up.png diff --git a/devices/skins/samsung_galaxy_s6/button.png b/mixins/configs/devices/skins/samsung_galaxy_s6/button.png similarity index 100% rename from devices/skins/samsung_galaxy_s6/button.png rename to mixins/configs/devices/skins/samsung_galaxy_s6/button.png diff --git a/devices/skins/samsung_galaxy_s6/controls.png b/mixins/configs/devices/skins/samsung_galaxy_s6/controls.png similarity index 100% rename from devices/skins/samsung_galaxy_s6/controls.png rename to mixins/configs/devices/skins/samsung_galaxy_s6/controls.png diff --git a/devices/skins/samsung_galaxy_s6/hardware.ini b/mixins/configs/devices/skins/samsung_galaxy_s6/hardware.ini similarity index 100% rename from devices/skins/samsung_galaxy_s6/hardware.ini rename to mixins/configs/devices/skins/samsung_galaxy_s6/hardware.ini diff --git a/devices/skins/samsung_galaxy_s6/key-num.png b/mixins/configs/devices/skins/samsung_galaxy_s6/key-num.png similarity index 100% rename from devices/skins/samsung_galaxy_s6/key-num.png rename to mixins/configs/devices/skins/samsung_galaxy_s6/key-num.png diff --git a/devices/skins/samsung_galaxy_s6/key.png b/mixins/configs/devices/skins/samsung_galaxy_s6/key.png similarity index 100% rename from devices/skins/samsung_galaxy_s6/key.png rename to mixins/configs/devices/skins/samsung_galaxy_s6/key.png diff --git a/devices/skins/samsung_galaxy_s6/key2.png b/mixins/configs/devices/skins/samsung_galaxy_s6/key2.png similarity index 100% rename from devices/skins/samsung_galaxy_s6/key2.png rename to mixins/configs/devices/skins/samsung_galaxy_s6/key2.png diff --git a/devices/skins/samsung_galaxy_s6/keyboard.png b/mixins/configs/devices/skins/samsung_galaxy_s6/keyboard.png similarity index 100% rename from devices/skins/samsung_galaxy_s6/keyboard.png rename to mixins/configs/devices/skins/samsung_galaxy_s6/keyboard.png diff --git a/devices/skins/samsung_galaxy_s6/land-button1.png b/mixins/configs/devices/skins/samsung_galaxy_s6/land-button1.png similarity index 100% rename from devices/skins/samsung_galaxy_s6/land-button1.png rename to mixins/configs/devices/skins/samsung_galaxy_s6/land-button1.png diff --git a/devices/skins/samsung_galaxy_s6/land-button2.png b/mixins/configs/devices/skins/samsung_galaxy_s6/land-button2.png similarity index 100% rename from devices/skins/samsung_galaxy_s6/land-button2.png rename to mixins/configs/devices/skins/samsung_galaxy_s6/land-button2.png diff --git a/devices/skins/samsung_galaxy_s6/land-button3.png b/mixins/configs/devices/skins/samsung_galaxy_s6/land-button3.png similarity index 100% rename from devices/skins/samsung_galaxy_s6/land-button3.png rename to mixins/configs/devices/skins/samsung_galaxy_s6/land-button3.png diff --git a/devices/skins/samsung_galaxy_s6/layout b/mixins/configs/devices/skins/samsung_galaxy_s6/layout similarity index 100% rename from devices/skins/samsung_galaxy_s6/layout rename to mixins/configs/devices/skins/samsung_galaxy_s6/layout diff --git a/devices/skins/samsung_galaxy_s6/manifest.ini b/mixins/configs/devices/skins/samsung_galaxy_s6/manifest.ini similarity index 100% rename from devices/skins/samsung_galaxy_s6/manifest.ini rename to mixins/configs/devices/skins/samsung_galaxy_s6/manifest.ini diff --git a/devices/skins/samsung_galaxy_s6/port-button1.png b/mixins/configs/devices/skins/samsung_galaxy_s6/port-button1.png similarity index 100% rename from devices/skins/samsung_galaxy_s6/port-button1.png rename to mixins/configs/devices/skins/samsung_galaxy_s6/port-button1.png diff --git a/devices/skins/samsung_galaxy_s6/port-button2.png b/mixins/configs/devices/skins/samsung_galaxy_s6/port-button2.png similarity index 100% rename from devices/skins/samsung_galaxy_s6/port-button2.png rename to mixins/configs/devices/skins/samsung_galaxy_s6/port-button2.png diff --git a/devices/skins/samsung_galaxy_s6/port-button3.png b/mixins/configs/devices/skins/samsung_galaxy_s6/port-button3.png similarity index 100% rename from devices/skins/samsung_galaxy_s6/port-button3.png rename to mixins/configs/devices/skins/samsung_galaxy_s6/port-button3.png diff --git a/devices/skins/samsung_galaxy_s6/power_l.png b/mixins/configs/devices/skins/samsung_galaxy_s6/power_l.png similarity index 100% rename from devices/skins/samsung_galaxy_s6/power_l.png rename to mixins/configs/devices/skins/samsung_galaxy_s6/power_l.png diff --git a/devices/skins/samsung_galaxy_s6/power_p.png b/mixins/configs/devices/skins/samsung_galaxy_s6/power_p.png similarity index 100% rename from devices/skins/samsung_galaxy_s6/power_p.png rename to mixins/configs/devices/skins/samsung_galaxy_s6/power_p.png diff --git a/devices/skins/samsung_galaxy_s6/select.png b/mixins/configs/devices/skins/samsung_galaxy_s6/select.png similarity index 100% rename from devices/skins/samsung_galaxy_s6/select.png rename to mixins/configs/devices/skins/samsung_galaxy_s6/select.png diff --git a/devices/skins/samsung_galaxy_s6/spacebar.png b/mixins/configs/devices/skins/samsung_galaxy_s6/spacebar.png similarity index 100% rename from devices/skins/samsung_galaxy_s6/spacebar.png rename to mixins/configs/devices/skins/samsung_galaxy_s6/spacebar.png diff --git a/devices/skins/samsung_galaxy_s6/volume_down_l.png b/mixins/configs/devices/skins/samsung_galaxy_s6/volume_down_l.png similarity index 100% rename from devices/skins/samsung_galaxy_s6/volume_down_l.png rename to mixins/configs/devices/skins/samsung_galaxy_s6/volume_down_l.png diff --git a/devices/skins/samsung_galaxy_s6/volume_down_p.png b/mixins/configs/devices/skins/samsung_galaxy_s6/volume_down_p.png similarity index 100% rename from devices/skins/samsung_galaxy_s6/volume_down_p.png rename to mixins/configs/devices/skins/samsung_galaxy_s6/volume_down_p.png diff --git a/devices/skins/samsung_galaxy_s6/volume_up_l.png b/mixins/configs/devices/skins/samsung_galaxy_s6/volume_up_l.png similarity index 100% rename from devices/skins/samsung_galaxy_s6/volume_up_l.png rename to mixins/configs/devices/skins/samsung_galaxy_s6/volume_up_l.png diff --git a/devices/skins/samsung_galaxy_s6/volume_up_p.png b/mixins/configs/devices/skins/samsung_galaxy_s6/volume_up_p.png similarity index 100% rename from devices/skins/samsung_galaxy_s6/volume_up_p.png rename to mixins/configs/devices/skins/samsung_galaxy_s6/volume_up_p.png diff --git a/devices/skins/samsung_galaxy_s7/.picasa.ini b/mixins/configs/devices/skins/samsung_galaxy_s7/.picasa.ini similarity index 100% rename from devices/skins/samsung_galaxy_s7/.picasa.ini rename to mixins/configs/devices/skins/samsung_galaxy_s7/.picasa.ini diff --git a/devices/skins/samsung_galaxy_s7/arrow_down.png b/mixins/configs/devices/skins/samsung_galaxy_s7/arrow_down.png similarity index 100% rename from devices/skins/samsung_galaxy_s7/arrow_down.png rename to mixins/configs/devices/skins/samsung_galaxy_s7/arrow_down.png diff --git a/devices/skins/samsung_galaxy_s7/arrow_left.png b/mixins/configs/devices/skins/samsung_galaxy_s7/arrow_left.png similarity index 100% rename from devices/skins/samsung_galaxy_s7/arrow_left.png rename to mixins/configs/devices/skins/samsung_galaxy_s7/arrow_left.png diff --git a/devices/skins/samsung_galaxy_s7/arrow_right.png b/mixins/configs/devices/skins/samsung_galaxy_s7/arrow_right.png similarity index 100% rename from devices/skins/samsung_galaxy_s7/arrow_right.png rename to mixins/configs/devices/skins/samsung_galaxy_s7/arrow_right.png diff --git a/devices/skins/samsung_galaxy_s7/arrow_up.png b/mixins/configs/devices/skins/samsung_galaxy_s7/arrow_up.png similarity index 100% rename from devices/skins/samsung_galaxy_s7/arrow_up.png rename to mixins/configs/devices/skins/samsung_galaxy_s7/arrow_up.png diff --git a/devices/skins/samsung_galaxy_s7/button.png b/mixins/configs/devices/skins/samsung_galaxy_s7/button.png similarity index 100% rename from devices/skins/samsung_galaxy_s7/button.png rename to mixins/configs/devices/skins/samsung_galaxy_s7/button.png diff --git a/devices/skins/samsung_galaxy_s7/controls.png b/mixins/configs/devices/skins/samsung_galaxy_s7/controls.png similarity index 100% rename from devices/skins/samsung_galaxy_s7/controls.png rename to mixins/configs/devices/skins/samsung_galaxy_s7/controls.png diff --git a/devices/skins/samsung_galaxy_s7/device_Land.png b/mixins/configs/devices/skins/samsung_galaxy_s7/device_Land.png similarity index 100% rename from devices/skins/samsung_galaxy_s7/device_Land.png rename to mixins/configs/devices/skins/samsung_galaxy_s7/device_Land.png diff --git a/devices/skins/samsung_galaxy_s7/device_Port.png b/mixins/configs/devices/skins/samsung_galaxy_s7/device_Port.png similarity index 100% rename from devices/skins/samsung_galaxy_s7/device_Port.png rename to mixins/configs/devices/skins/samsung_galaxy_s7/device_Port.png diff --git a/devices/skins/samsung_galaxy_s7/hardware.ini b/mixins/configs/devices/skins/samsung_galaxy_s7/hardware.ini similarity index 100% rename from devices/skins/samsung_galaxy_s7/hardware.ini rename to mixins/configs/devices/skins/samsung_galaxy_s7/hardware.ini diff --git a/devices/skins/samsung_galaxy_s7/key-num.png b/mixins/configs/devices/skins/samsung_galaxy_s7/key-num.png similarity index 100% rename from devices/skins/samsung_galaxy_s7/key-num.png rename to mixins/configs/devices/skins/samsung_galaxy_s7/key-num.png diff --git a/devices/skins/samsung_galaxy_s7/key.png b/mixins/configs/devices/skins/samsung_galaxy_s7/key.png similarity index 100% rename from devices/skins/samsung_galaxy_s7/key.png rename to mixins/configs/devices/skins/samsung_galaxy_s7/key.png diff --git a/devices/skins/samsung_galaxy_s7/key2.png b/mixins/configs/devices/skins/samsung_galaxy_s7/key2.png similarity index 100% rename from devices/skins/samsung_galaxy_s7/key2.png rename to mixins/configs/devices/skins/samsung_galaxy_s7/key2.png diff --git a/devices/skins/samsung_galaxy_s7/keyboard.png b/mixins/configs/devices/skins/samsung_galaxy_s7/keyboard.png similarity index 100% rename from devices/skins/samsung_galaxy_s7/keyboard.png rename to mixins/configs/devices/skins/samsung_galaxy_s7/keyboard.png diff --git a/devices/skins/samsung_galaxy_s7/land-button1.png b/mixins/configs/devices/skins/samsung_galaxy_s7/land-button1.png similarity index 100% rename from devices/skins/samsung_galaxy_s7/land-button1.png rename to mixins/configs/devices/skins/samsung_galaxy_s7/land-button1.png diff --git a/devices/skins/samsung_galaxy_s7/land-button2.png b/mixins/configs/devices/skins/samsung_galaxy_s7/land-button2.png similarity index 100% rename from devices/skins/samsung_galaxy_s7/land-button2.png rename to mixins/configs/devices/skins/samsung_galaxy_s7/land-button2.png diff --git a/devices/skins/samsung_galaxy_s7/land-button3.png b/mixins/configs/devices/skins/samsung_galaxy_s7/land-button3.png similarity index 100% rename from devices/skins/samsung_galaxy_s7/land-button3.png rename to mixins/configs/devices/skins/samsung_galaxy_s7/land-button3.png diff --git a/devices/skins/samsung_galaxy_s7/layout b/mixins/configs/devices/skins/samsung_galaxy_s7/layout similarity index 100% rename from devices/skins/samsung_galaxy_s7/layout rename to mixins/configs/devices/skins/samsung_galaxy_s7/layout diff --git a/devices/skins/samsung_galaxy_s7/manifest.ini b/mixins/configs/devices/skins/samsung_galaxy_s7/manifest.ini similarity index 100% rename from devices/skins/samsung_galaxy_s7/manifest.ini rename to mixins/configs/devices/skins/samsung_galaxy_s7/manifest.ini diff --git a/devices/skins/samsung_galaxy_s7/port-button1.png b/mixins/configs/devices/skins/samsung_galaxy_s7/port-button1.png similarity index 100% rename from devices/skins/samsung_galaxy_s7/port-button1.png rename to mixins/configs/devices/skins/samsung_galaxy_s7/port-button1.png diff --git a/devices/skins/samsung_galaxy_s7/port-button2.png b/mixins/configs/devices/skins/samsung_galaxy_s7/port-button2.png similarity index 100% rename from devices/skins/samsung_galaxy_s7/port-button2.png rename to mixins/configs/devices/skins/samsung_galaxy_s7/port-button2.png diff --git a/devices/skins/samsung_galaxy_s7/port-button3.png b/mixins/configs/devices/skins/samsung_galaxy_s7/port-button3.png similarity index 100% rename from devices/skins/samsung_galaxy_s7/port-button3.png rename to mixins/configs/devices/skins/samsung_galaxy_s7/port-button3.png diff --git a/devices/skins/samsung_galaxy_s7/power_l.png b/mixins/configs/devices/skins/samsung_galaxy_s7/power_l.png similarity index 100% rename from devices/skins/samsung_galaxy_s7/power_l.png rename to mixins/configs/devices/skins/samsung_galaxy_s7/power_l.png diff --git a/devices/skins/samsung_galaxy_s7/power_p.png b/mixins/configs/devices/skins/samsung_galaxy_s7/power_p.png similarity index 100% rename from devices/skins/samsung_galaxy_s7/power_p.png rename to mixins/configs/devices/skins/samsung_galaxy_s7/power_p.png diff --git a/devices/skins/samsung_galaxy_s7/select.png b/mixins/configs/devices/skins/samsung_galaxy_s7/select.png similarity index 100% rename from devices/skins/samsung_galaxy_s7/select.png rename to mixins/configs/devices/skins/samsung_galaxy_s7/select.png diff --git a/devices/skins/samsung_galaxy_s7/spacebar.png b/mixins/configs/devices/skins/samsung_galaxy_s7/spacebar.png similarity index 100% rename from devices/skins/samsung_galaxy_s7/spacebar.png rename to mixins/configs/devices/skins/samsung_galaxy_s7/spacebar.png diff --git a/devices/skins/samsung_galaxy_s7/volume_down_l.png b/mixins/configs/devices/skins/samsung_galaxy_s7/volume_down_l.png similarity index 100% rename from devices/skins/samsung_galaxy_s7/volume_down_l.png rename to mixins/configs/devices/skins/samsung_galaxy_s7/volume_down_l.png diff --git a/devices/skins/samsung_galaxy_s7/volume_down_p.png b/mixins/configs/devices/skins/samsung_galaxy_s7/volume_down_p.png similarity index 100% rename from devices/skins/samsung_galaxy_s7/volume_down_p.png rename to mixins/configs/devices/skins/samsung_galaxy_s7/volume_down_p.png diff --git a/devices/skins/samsung_galaxy_s7/volume_up_l.png b/mixins/configs/devices/skins/samsung_galaxy_s7/volume_up_l.png similarity index 100% rename from devices/skins/samsung_galaxy_s7/volume_up_l.png rename to mixins/configs/devices/skins/samsung_galaxy_s7/volume_up_l.png diff --git a/devices/skins/samsung_galaxy_s7/volume_up_p.png b/mixins/configs/devices/skins/samsung_galaxy_s7/volume_up_p.png similarity index 100% rename from devices/skins/samsung_galaxy_s7/volume_up_p.png rename to mixins/configs/devices/skins/samsung_galaxy_s7/volume_up_p.png diff --git a/devices/skins/samsung_galaxy_s7_edge/.picasa.ini b/mixins/configs/devices/skins/samsung_galaxy_s7_edge/.picasa.ini similarity index 100% rename from devices/skins/samsung_galaxy_s7_edge/.picasa.ini rename to mixins/configs/devices/skins/samsung_galaxy_s7_edge/.picasa.ini diff --git a/devices/skins/samsung_galaxy_s7_edge/arrow_down.png b/mixins/configs/devices/skins/samsung_galaxy_s7_edge/arrow_down.png similarity index 100% rename from devices/skins/samsung_galaxy_s7_edge/arrow_down.png rename to mixins/configs/devices/skins/samsung_galaxy_s7_edge/arrow_down.png diff --git a/devices/skins/samsung_galaxy_s7_edge/arrow_left.png b/mixins/configs/devices/skins/samsung_galaxy_s7_edge/arrow_left.png similarity index 100% rename from devices/skins/samsung_galaxy_s7_edge/arrow_left.png rename to mixins/configs/devices/skins/samsung_galaxy_s7_edge/arrow_left.png diff --git a/devices/skins/samsung_galaxy_s7_edge/arrow_right.png b/mixins/configs/devices/skins/samsung_galaxy_s7_edge/arrow_right.png similarity index 100% rename from devices/skins/samsung_galaxy_s7_edge/arrow_right.png rename to mixins/configs/devices/skins/samsung_galaxy_s7_edge/arrow_right.png diff --git a/devices/skins/samsung_galaxy_s7_edge/arrow_up.png b/mixins/configs/devices/skins/samsung_galaxy_s7_edge/arrow_up.png similarity index 100% rename from devices/skins/samsung_galaxy_s7_edge/arrow_up.png rename to mixins/configs/devices/skins/samsung_galaxy_s7_edge/arrow_up.png diff --git a/devices/skins/samsung_galaxy_s7_edge/button.png b/mixins/configs/devices/skins/samsung_galaxy_s7_edge/button.png similarity index 100% rename from devices/skins/samsung_galaxy_s7_edge/button.png rename to mixins/configs/devices/skins/samsung_galaxy_s7_edge/button.png diff --git a/devices/skins/samsung_galaxy_s7_edge/controls.png b/mixins/configs/devices/skins/samsung_galaxy_s7_edge/controls.png similarity index 100% rename from devices/skins/samsung_galaxy_s7_edge/controls.png rename to mixins/configs/devices/skins/samsung_galaxy_s7_edge/controls.png diff --git a/devices/skins/samsung_galaxy_s7_edge/device_Land.png b/mixins/configs/devices/skins/samsung_galaxy_s7_edge/device_Land.png similarity index 100% rename from devices/skins/samsung_galaxy_s7_edge/device_Land.png rename to mixins/configs/devices/skins/samsung_galaxy_s7_edge/device_Land.png diff --git a/devices/skins/samsung_galaxy_s7_edge/device_Port.png b/mixins/configs/devices/skins/samsung_galaxy_s7_edge/device_Port.png similarity index 100% rename from devices/skins/samsung_galaxy_s7_edge/device_Port.png rename to mixins/configs/devices/skins/samsung_galaxy_s7_edge/device_Port.png diff --git a/devices/skins/samsung_galaxy_s7_edge/hardware.ini b/mixins/configs/devices/skins/samsung_galaxy_s7_edge/hardware.ini similarity index 100% rename from devices/skins/samsung_galaxy_s7_edge/hardware.ini rename to mixins/configs/devices/skins/samsung_galaxy_s7_edge/hardware.ini diff --git a/devices/skins/samsung_galaxy_s7_edge/key-num.png b/mixins/configs/devices/skins/samsung_galaxy_s7_edge/key-num.png similarity index 100% rename from devices/skins/samsung_galaxy_s7_edge/key-num.png rename to mixins/configs/devices/skins/samsung_galaxy_s7_edge/key-num.png diff --git a/devices/skins/samsung_galaxy_s7_edge/key.png b/mixins/configs/devices/skins/samsung_galaxy_s7_edge/key.png similarity index 100% rename from devices/skins/samsung_galaxy_s7_edge/key.png rename to mixins/configs/devices/skins/samsung_galaxy_s7_edge/key.png diff --git a/devices/skins/samsung_galaxy_s7_edge/key2.png b/mixins/configs/devices/skins/samsung_galaxy_s7_edge/key2.png similarity index 100% rename from devices/skins/samsung_galaxy_s7_edge/key2.png rename to mixins/configs/devices/skins/samsung_galaxy_s7_edge/key2.png diff --git a/devices/skins/samsung_galaxy_s7_edge/keyboard.png b/mixins/configs/devices/skins/samsung_galaxy_s7_edge/keyboard.png similarity index 100% rename from devices/skins/samsung_galaxy_s7_edge/keyboard.png rename to mixins/configs/devices/skins/samsung_galaxy_s7_edge/keyboard.png diff --git a/devices/skins/samsung_galaxy_s7_edge/land-button1.png b/mixins/configs/devices/skins/samsung_galaxy_s7_edge/land-button1.png similarity index 100% rename from devices/skins/samsung_galaxy_s7_edge/land-button1.png rename to mixins/configs/devices/skins/samsung_galaxy_s7_edge/land-button1.png diff --git a/devices/skins/samsung_galaxy_s7_edge/land-button2.png b/mixins/configs/devices/skins/samsung_galaxy_s7_edge/land-button2.png similarity index 100% rename from devices/skins/samsung_galaxy_s7_edge/land-button2.png rename to mixins/configs/devices/skins/samsung_galaxy_s7_edge/land-button2.png diff --git a/devices/skins/samsung_galaxy_s7_edge/land-button3.png b/mixins/configs/devices/skins/samsung_galaxy_s7_edge/land-button3.png similarity index 100% rename from devices/skins/samsung_galaxy_s7_edge/land-button3.png rename to mixins/configs/devices/skins/samsung_galaxy_s7_edge/land-button3.png diff --git a/devices/skins/samsung_galaxy_s7_edge/layout b/mixins/configs/devices/skins/samsung_galaxy_s7_edge/layout similarity index 100% rename from devices/skins/samsung_galaxy_s7_edge/layout rename to mixins/configs/devices/skins/samsung_galaxy_s7_edge/layout diff --git a/devices/skins/samsung_galaxy_s7_edge/manifest.ini b/mixins/configs/devices/skins/samsung_galaxy_s7_edge/manifest.ini similarity index 100% rename from devices/skins/samsung_galaxy_s7_edge/manifest.ini rename to mixins/configs/devices/skins/samsung_galaxy_s7_edge/manifest.ini diff --git a/devices/skins/samsung_galaxy_s7_edge/port-button1.png b/mixins/configs/devices/skins/samsung_galaxy_s7_edge/port-button1.png similarity index 100% rename from devices/skins/samsung_galaxy_s7_edge/port-button1.png rename to mixins/configs/devices/skins/samsung_galaxy_s7_edge/port-button1.png diff --git a/devices/skins/samsung_galaxy_s7_edge/port-button2.png b/mixins/configs/devices/skins/samsung_galaxy_s7_edge/port-button2.png similarity index 100% rename from devices/skins/samsung_galaxy_s7_edge/port-button2.png rename to mixins/configs/devices/skins/samsung_galaxy_s7_edge/port-button2.png diff --git a/devices/skins/samsung_galaxy_s7_edge/port-button3.png b/mixins/configs/devices/skins/samsung_galaxy_s7_edge/port-button3.png similarity index 100% rename from devices/skins/samsung_galaxy_s7_edge/port-button3.png rename to mixins/configs/devices/skins/samsung_galaxy_s7_edge/port-button3.png diff --git a/devices/skins/samsung_galaxy_s7_edge/power_l.png b/mixins/configs/devices/skins/samsung_galaxy_s7_edge/power_l.png similarity index 100% rename from devices/skins/samsung_galaxy_s7_edge/power_l.png rename to mixins/configs/devices/skins/samsung_galaxy_s7_edge/power_l.png diff --git a/devices/skins/samsung_galaxy_s7_edge/power_p.png b/mixins/configs/devices/skins/samsung_galaxy_s7_edge/power_p.png similarity index 100% rename from devices/skins/samsung_galaxy_s7_edge/power_p.png rename to mixins/configs/devices/skins/samsung_galaxy_s7_edge/power_p.png diff --git a/devices/skins/samsung_galaxy_s7_edge/select.png b/mixins/configs/devices/skins/samsung_galaxy_s7_edge/select.png similarity index 100% rename from devices/skins/samsung_galaxy_s7_edge/select.png rename to mixins/configs/devices/skins/samsung_galaxy_s7_edge/select.png diff --git a/devices/skins/samsung_galaxy_s7_edge/spacebar.png b/mixins/configs/devices/skins/samsung_galaxy_s7_edge/spacebar.png similarity index 100% rename from devices/skins/samsung_galaxy_s7_edge/spacebar.png rename to mixins/configs/devices/skins/samsung_galaxy_s7_edge/spacebar.png diff --git a/devices/skins/samsung_galaxy_s7_edge/volume_down_l.png b/mixins/configs/devices/skins/samsung_galaxy_s7_edge/volume_down_l.png similarity index 100% rename from devices/skins/samsung_galaxy_s7_edge/volume_down_l.png rename to mixins/configs/devices/skins/samsung_galaxy_s7_edge/volume_down_l.png diff --git a/devices/skins/samsung_galaxy_s7_edge/volume_down_p.png b/mixins/configs/devices/skins/samsung_galaxy_s7_edge/volume_down_p.png similarity index 100% rename from devices/skins/samsung_galaxy_s7_edge/volume_down_p.png rename to mixins/configs/devices/skins/samsung_galaxy_s7_edge/volume_down_p.png diff --git a/devices/skins/samsung_galaxy_s7_edge/volume_up_l.png b/mixins/configs/devices/skins/samsung_galaxy_s7_edge/volume_up_l.png similarity index 100% rename from devices/skins/samsung_galaxy_s7_edge/volume_up_l.png rename to mixins/configs/devices/skins/samsung_galaxy_s7_edge/volume_up_l.png diff --git a/devices/skins/samsung_galaxy_s7_edge/volume_up_p.png b/mixins/configs/devices/skins/samsung_galaxy_s7_edge/volume_up_p.png similarity index 100% rename from devices/skins/samsung_galaxy_s7_edge/volume_up_p.png rename to mixins/configs/devices/skins/samsung_galaxy_s7_edge/volume_up_p.png diff --git a/devices/skins/samsung_galaxy_s8/.picasa.ini b/mixins/configs/devices/skins/samsung_galaxy_s8/.picasa.ini similarity index 100% rename from devices/skins/samsung_galaxy_s8/.picasa.ini rename to mixins/configs/devices/skins/samsung_galaxy_s8/.picasa.ini diff --git a/devices/skins/samsung_galaxy_s8/Thumbs.db b/mixins/configs/devices/skins/samsung_galaxy_s8/Thumbs.db similarity index 100% rename from devices/skins/samsung_galaxy_s8/Thumbs.db rename to mixins/configs/devices/skins/samsung_galaxy_s8/Thumbs.db diff --git a/devices/skins/samsung_galaxy_s8/arrow_down.png b/mixins/configs/devices/skins/samsung_galaxy_s8/arrow_down.png similarity index 100% rename from devices/skins/samsung_galaxy_s8/arrow_down.png rename to mixins/configs/devices/skins/samsung_galaxy_s8/arrow_down.png diff --git a/devices/skins/samsung_galaxy_s8/arrow_left.png b/mixins/configs/devices/skins/samsung_galaxy_s8/arrow_left.png similarity index 100% rename from devices/skins/samsung_galaxy_s8/arrow_left.png rename to mixins/configs/devices/skins/samsung_galaxy_s8/arrow_left.png diff --git a/devices/skins/samsung_galaxy_s8/arrow_right.png b/mixins/configs/devices/skins/samsung_galaxy_s8/arrow_right.png similarity index 100% rename from devices/skins/samsung_galaxy_s8/arrow_right.png rename to mixins/configs/devices/skins/samsung_galaxy_s8/arrow_right.png diff --git a/devices/skins/samsung_galaxy_s8/arrow_up.png b/mixins/configs/devices/skins/samsung_galaxy_s8/arrow_up.png similarity index 100% rename from devices/skins/samsung_galaxy_s8/arrow_up.png rename to mixins/configs/devices/skins/samsung_galaxy_s8/arrow_up.png diff --git a/devices/skins/samsung_galaxy_s8/button.png b/mixins/configs/devices/skins/samsung_galaxy_s8/button.png similarity index 100% rename from devices/skins/samsung_galaxy_s8/button.png rename to mixins/configs/devices/skins/samsung_galaxy_s8/button.png diff --git a/devices/skins/samsung_galaxy_s8/controls.png b/mixins/configs/devices/skins/samsung_galaxy_s8/controls.png similarity index 100% rename from devices/skins/samsung_galaxy_s8/controls.png rename to mixins/configs/devices/skins/samsung_galaxy_s8/controls.png diff --git a/devices/skins/samsung_galaxy_s8/device_Land.png b/mixins/configs/devices/skins/samsung_galaxy_s8/device_Land.png similarity index 100% rename from devices/skins/samsung_galaxy_s8/device_Land.png rename to mixins/configs/devices/skins/samsung_galaxy_s8/device_Land.png diff --git a/devices/skins/samsung_galaxy_s8/device_Port.png b/mixins/configs/devices/skins/samsung_galaxy_s8/device_Port.png similarity index 100% rename from devices/skins/samsung_galaxy_s8/device_Port.png rename to mixins/configs/devices/skins/samsung_galaxy_s8/device_Port.png diff --git a/devices/skins/samsung_galaxy_s8/hardware.ini b/mixins/configs/devices/skins/samsung_galaxy_s8/hardware.ini similarity index 100% rename from devices/skins/samsung_galaxy_s8/hardware.ini rename to mixins/configs/devices/skins/samsung_galaxy_s8/hardware.ini diff --git a/devices/skins/samsung_galaxy_s8/key-num.png b/mixins/configs/devices/skins/samsung_galaxy_s8/key-num.png similarity index 100% rename from devices/skins/samsung_galaxy_s8/key-num.png rename to mixins/configs/devices/skins/samsung_galaxy_s8/key-num.png diff --git a/devices/skins/samsung_galaxy_s8/key.png b/mixins/configs/devices/skins/samsung_galaxy_s8/key.png similarity index 100% rename from devices/skins/samsung_galaxy_s8/key.png rename to mixins/configs/devices/skins/samsung_galaxy_s8/key.png diff --git a/devices/skins/samsung_galaxy_s8/key2.png b/mixins/configs/devices/skins/samsung_galaxy_s8/key2.png similarity index 100% rename from devices/skins/samsung_galaxy_s8/key2.png rename to mixins/configs/devices/skins/samsung_galaxy_s8/key2.png diff --git a/devices/skins/samsung_galaxy_s8/keyboard.png b/mixins/configs/devices/skins/samsung_galaxy_s8/keyboard.png similarity index 100% rename from devices/skins/samsung_galaxy_s8/keyboard.png rename to mixins/configs/devices/skins/samsung_galaxy_s8/keyboard.png diff --git a/devices/skins/samsung_galaxy_s8/land-button1.png b/mixins/configs/devices/skins/samsung_galaxy_s8/land-button1.png similarity index 100% rename from devices/skins/samsung_galaxy_s8/land-button1.png rename to mixins/configs/devices/skins/samsung_galaxy_s8/land-button1.png diff --git a/devices/skins/samsung_galaxy_s8/land-button2.png b/mixins/configs/devices/skins/samsung_galaxy_s8/land-button2.png similarity index 100% rename from devices/skins/samsung_galaxy_s8/land-button2.png rename to mixins/configs/devices/skins/samsung_galaxy_s8/land-button2.png diff --git a/devices/skins/samsung_galaxy_s8/land-button3.png b/mixins/configs/devices/skins/samsung_galaxy_s8/land-button3.png similarity index 100% rename from devices/skins/samsung_galaxy_s8/land-button3.png rename to mixins/configs/devices/skins/samsung_galaxy_s8/land-button3.png diff --git a/devices/skins/samsung_galaxy_s8/layout b/mixins/configs/devices/skins/samsung_galaxy_s8/layout similarity index 100% rename from devices/skins/samsung_galaxy_s8/layout rename to mixins/configs/devices/skins/samsung_galaxy_s8/layout diff --git a/devices/skins/samsung_galaxy_s8/manifest.ini b/mixins/configs/devices/skins/samsung_galaxy_s8/manifest.ini similarity index 100% rename from devices/skins/samsung_galaxy_s8/manifest.ini rename to mixins/configs/devices/skins/samsung_galaxy_s8/manifest.ini diff --git a/devices/skins/samsung_galaxy_s8/port-button1.png b/mixins/configs/devices/skins/samsung_galaxy_s8/port-button1.png similarity index 100% rename from devices/skins/samsung_galaxy_s8/port-button1.png rename to mixins/configs/devices/skins/samsung_galaxy_s8/port-button1.png diff --git a/devices/skins/samsung_galaxy_s8/port-button2.png b/mixins/configs/devices/skins/samsung_galaxy_s8/port-button2.png similarity index 100% rename from devices/skins/samsung_galaxy_s8/port-button2.png rename to mixins/configs/devices/skins/samsung_galaxy_s8/port-button2.png diff --git a/devices/skins/samsung_galaxy_s8/port-button3.png b/mixins/configs/devices/skins/samsung_galaxy_s8/port-button3.png similarity index 100% rename from devices/skins/samsung_galaxy_s8/port-button3.png rename to mixins/configs/devices/skins/samsung_galaxy_s8/port-button3.png diff --git a/devices/skins/samsung_galaxy_s8/power_l.png b/mixins/configs/devices/skins/samsung_galaxy_s8/power_l.png similarity index 100% rename from devices/skins/samsung_galaxy_s8/power_l.png rename to mixins/configs/devices/skins/samsung_galaxy_s8/power_l.png diff --git a/devices/skins/samsung_galaxy_s8/power_p.png b/mixins/configs/devices/skins/samsung_galaxy_s8/power_p.png similarity index 100% rename from devices/skins/samsung_galaxy_s8/power_p.png rename to mixins/configs/devices/skins/samsung_galaxy_s8/power_p.png diff --git a/devices/skins/samsung_galaxy_s8/select.png b/mixins/configs/devices/skins/samsung_galaxy_s8/select.png similarity index 100% rename from devices/skins/samsung_galaxy_s8/select.png rename to mixins/configs/devices/skins/samsung_galaxy_s8/select.png diff --git a/devices/skins/samsung_galaxy_s8/spacebar.png b/mixins/configs/devices/skins/samsung_galaxy_s8/spacebar.png similarity index 100% rename from devices/skins/samsung_galaxy_s8/spacebar.png rename to mixins/configs/devices/skins/samsung_galaxy_s8/spacebar.png diff --git a/devices/skins/samsung_galaxy_s8/volume_down_l.png b/mixins/configs/devices/skins/samsung_galaxy_s8/volume_down_l.png similarity index 100% rename from devices/skins/samsung_galaxy_s8/volume_down_l.png rename to mixins/configs/devices/skins/samsung_galaxy_s8/volume_down_l.png diff --git a/devices/skins/samsung_galaxy_s8/volume_down_p.png b/mixins/configs/devices/skins/samsung_galaxy_s8/volume_down_p.png similarity index 100% rename from devices/skins/samsung_galaxy_s8/volume_down_p.png rename to mixins/configs/devices/skins/samsung_galaxy_s8/volume_down_p.png diff --git a/devices/skins/samsung_galaxy_s8/volume_up_l.png b/mixins/configs/devices/skins/samsung_galaxy_s8/volume_up_l.png similarity index 100% rename from devices/skins/samsung_galaxy_s8/volume_up_l.png rename to mixins/configs/devices/skins/samsung_galaxy_s8/volume_up_l.png diff --git a/devices/skins/samsung_galaxy_s8/volume_up_p.png b/mixins/configs/devices/skins/samsung_galaxy_s8/volume_up_p.png similarity index 100% rename from devices/skins/samsung_galaxy_s8/volume_up_p.png rename to mixins/configs/devices/skins/samsung_galaxy_s8/volume_up_p.png diff --git a/devices/skins/samsung_galaxy_s9/.picasa.ini b/mixins/configs/devices/skins/samsung_galaxy_s9/.picasa.ini similarity index 100% rename from devices/skins/samsung_galaxy_s9/.picasa.ini rename to mixins/configs/devices/skins/samsung_galaxy_s9/.picasa.ini diff --git a/devices/skins/samsung_galaxy_s9/Thumbs.db b/mixins/configs/devices/skins/samsung_galaxy_s9/Thumbs.db similarity index 100% rename from devices/skins/samsung_galaxy_s9/Thumbs.db rename to mixins/configs/devices/skins/samsung_galaxy_s9/Thumbs.db diff --git a/devices/skins/samsung_galaxy_s9/arrow_down.png b/mixins/configs/devices/skins/samsung_galaxy_s9/arrow_down.png similarity index 100% rename from devices/skins/samsung_galaxy_s9/arrow_down.png rename to mixins/configs/devices/skins/samsung_galaxy_s9/arrow_down.png diff --git a/devices/skins/samsung_galaxy_s9/arrow_left.png b/mixins/configs/devices/skins/samsung_galaxy_s9/arrow_left.png similarity index 100% rename from devices/skins/samsung_galaxy_s9/arrow_left.png rename to mixins/configs/devices/skins/samsung_galaxy_s9/arrow_left.png diff --git a/devices/skins/samsung_galaxy_s9/arrow_right.png b/mixins/configs/devices/skins/samsung_galaxy_s9/arrow_right.png similarity index 100% rename from devices/skins/samsung_galaxy_s9/arrow_right.png rename to mixins/configs/devices/skins/samsung_galaxy_s9/arrow_right.png diff --git a/devices/skins/samsung_galaxy_s9/arrow_up.png b/mixins/configs/devices/skins/samsung_galaxy_s9/arrow_up.png similarity index 100% rename from devices/skins/samsung_galaxy_s9/arrow_up.png rename to mixins/configs/devices/skins/samsung_galaxy_s9/arrow_up.png diff --git a/devices/skins/samsung_galaxy_s9/button.png b/mixins/configs/devices/skins/samsung_galaxy_s9/button.png similarity index 100% rename from devices/skins/samsung_galaxy_s9/button.png rename to mixins/configs/devices/skins/samsung_galaxy_s9/button.png diff --git a/devices/skins/samsung_galaxy_s9/controls.png b/mixins/configs/devices/skins/samsung_galaxy_s9/controls.png similarity index 100% rename from devices/skins/samsung_galaxy_s9/controls.png rename to mixins/configs/devices/skins/samsung_galaxy_s9/controls.png diff --git a/devices/skins/samsung_galaxy_s9/device_Land.png b/mixins/configs/devices/skins/samsung_galaxy_s9/device_Land.png similarity index 100% rename from devices/skins/samsung_galaxy_s9/device_Land.png rename to mixins/configs/devices/skins/samsung_galaxy_s9/device_Land.png diff --git a/devices/skins/samsung_galaxy_s9/device_Port.png b/mixins/configs/devices/skins/samsung_galaxy_s9/device_Port.png similarity index 100% rename from devices/skins/samsung_galaxy_s9/device_Port.png rename to mixins/configs/devices/skins/samsung_galaxy_s9/device_Port.png diff --git a/devices/skins/samsung_galaxy_s9/hardware.ini b/mixins/configs/devices/skins/samsung_galaxy_s9/hardware.ini similarity index 100% rename from devices/skins/samsung_galaxy_s9/hardware.ini rename to mixins/configs/devices/skins/samsung_galaxy_s9/hardware.ini diff --git a/devices/skins/samsung_galaxy_s9/key-num.png b/mixins/configs/devices/skins/samsung_galaxy_s9/key-num.png similarity index 100% rename from devices/skins/samsung_galaxy_s9/key-num.png rename to mixins/configs/devices/skins/samsung_galaxy_s9/key-num.png diff --git a/devices/skins/samsung_galaxy_s9/key.png b/mixins/configs/devices/skins/samsung_galaxy_s9/key.png similarity index 100% rename from devices/skins/samsung_galaxy_s9/key.png rename to mixins/configs/devices/skins/samsung_galaxy_s9/key.png diff --git a/devices/skins/samsung_galaxy_s9/key2.png b/mixins/configs/devices/skins/samsung_galaxy_s9/key2.png similarity index 100% rename from devices/skins/samsung_galaxy_s9/key2.png rename to mixins/configs/devices/skins/samsung_galaxy_s9/key2.png diff --git a/devices/skins/samsung_galaxy_s9/keyboard.png b/mixins/configs/devices/skins/samsung_galaxy_s9/keyboard.png similarity index 100% rename from devices/skins/samsung_galaxy_s9/keyboard.png rename to mixins/configs/devices/skins/samsung_galaxy_s9/keyboard.png diff --git a/devices/skins/samsung_galaxy_s9/land-button1.png b/mixins/configs/devices/skins/samsung_galaxy_s9/land-button1.png similarity index 100% rename from devices/skins/samsung_galaxy_s9/land-button1.png rename to mixins/configs/devices/skins/samsung_galaxy_s9/land-button1.png diff --git a/devices/skins/samsung_galaxy_s9/land-button2.png b/mixins/configs/devices/skins/samsung_galaxy_s9/land-button2.png similarity index 100% rename from devices/skins/samsung_galaxy_s9/land-button2.png rename to mixins/configs/devices/skins/samsung_galaxy_s9/land-button2.png diff --git a/devices/skins/samsung_galaxy_s9/land-button3.png b/mixins/configs/devices/skins/samsung_galaxy_s9/land-button3.png similarity index 100% rename from devices/skins/samsung_galaxy_s9/land-button3.png rename to mixins/configs/devices/skins/samsung_galaxy_s9/land-button3.png diff --git a/devices/skins/samsung_galaxy_s9/layout b/mixins/configs/devices/skins/samsung_galaxy_s9/layout similarity index 100% rename from devices/skins/samsung_galaxy_s9/layout rename to mixins/configs/devices/skins/samsung_galaxy_s9/layout diff --git a/devices/skins/samsung_galaxy_s9/manifest.ini b/mixins/configs/devices/skins/samsung_galaxy_s9/manifest.ini similarity index 100% rename from devices/skins/samsung_galaxy_s9/manifest.ini rename to mixins/configs/devices/skins/samsung_galaxy_s9/manifest.ini diff --git a/devices/skins/samsung_galaxy_s9/port-button1.png b/mixins/configs/devices/skins/samsung_galaxy_s9/port-button1.png similarity index 100% rename from devices/skins/samsung_galaxy_s9/port-button1.png rename to mixins/configs/devices/skins/samsung_galaxy_s9/port-button1.png diff --git a/devices/skins/samsung_galaxy_s9/port-button2.png b/mixins/configs/devices/skins/samsung_galaxy_s9/port-button2.png similarity index 100% rename from devices/skins/samsung_galaxy_s9/port-button2.png rename to mixins/configs/devices/skins/samsung_galaxy_s9/port-button2.png diff --git a/devices/skins/samsung_galaxy_s9/port-button3.png b/mixins/configs/devices/skins/samsung_galaxy_s9/port-button3.png similarity index 100% rename from devices/skins/samsung_galaxy_s9/port-button3.png rename to mixins/configs/devices/skins/samsung_galaxy_s9/port-button3.png diff --git a/devices/skins/samsung_galaxy_s9/power_l.png b/mixins/configs/devices/skins/samsung_galaxy_s9/power_l.png similarity index 100% rename from devices/skins/samsung_galaxy_s9/power_l.png rename to mixins/configs/devices/skins/samsung_galaxy_s9/power_l.png diff --git a/devices/skins/samsung_galaxy_s9/power_p.png b/mixins/configs/devices/skins/samsung_galaxy_s9/power_p.png similarity index 100% rename from devices/skins/samsung_galaxy_s9/power_p.png rename to mixins/configs/devices/skins/samsung_galaxy_s9/power_p.png diff --git a/devices/skins/samsung_galaxy_s9/select.png b/mixins/configs/devices/skins/samsung_galaxy_s9/select.png similarity index 100% rename from devices/skins/samsung_galaxy_s9/select.png rename to mixins/configs/devices/skins/samsung_galaxy_s9/select.png diff --git a/devices/skins/samsung_galaxy_s9/spacebar.png b/mixins/configs/devices/skins/samsung_galaxy_s9/spacebar.png similarity index 100% rename from devices/skins/samsung_galaxy_s9/spacebar.png rename to mixins/configs/devices/skins/samsung_galaxy_s9/spacebar.png diff --git a/devices/skins/samsung_galaxy_s9/volume_down_l.png b/mixins/configs/devices/skins/samsung_galaxy_s9/volume_down_l.png similarity index 100% rename from devices/skins/samsung_galaxy_s9/volume_down_l.png rename to mixins/configs/devices/skins/samsung_galaxy_s9/volume_down_l.png diff --git a/devices/skins/samsung_galaxy_s9/volume_down_p.png b/mixins/configs/devices/skins/samsung_galaxy_s9/volume_down_p.png similarity index 100% rename from devices/skins/samsung_galaxy_s9/volume_down_p.png rename to mixins/configs/devices/skins/samsung_galaxy_s9/volume_down_p.png diff --git a/devices/skins/samsung_galaxy_s9/volume_up_l.png b/mixins/configs/devices/skins/samsung_galaxy_s9/volume_up_l.png similarity index 100% rename from devices/skins/samsung_galaxy_s9/volume_up_l.png rename to mixins/configs/devices/skins/samsung_galaxy_s9/volume_up_l.png diff --git a/devices/skins/samsung_galaxy_s9/volume_up_p.png b/mixins/configs/devices/skins/samsung_galaxy_s9/volume_up_p.png similarity index 100% rename from devices/skins/samsung_galaxy_s9/volume_up_p.png rename to mixins/configs/devices/skins/samsung_galaxy_s9/volume_up_p.png diff --git a/mixins/configs/display/.fehbg b/mixins/configs/display/.fehbg new file mode 100755 index 0000000..dffa701 --- /dev/null +++ b/mixins/configs/display/.fehbg @@ -0,0 +1,3 @@ +#!/bin/sh + +"feh" "--bg-max" "${APP_PATH}/mixins/configs/display/background.png" diff --git a/images/logo_dockerandroid.png b/mixins/configs/display/background.png similarity index 100% rename from images/logo_dockerandroid.png rename to mixins/configs/display/background.png diff --git a/mixins/configs/process/supervisord-base.conf b/mixins/configs/process/supervisord-base.conf new file mode 100644 index 0000000..eba3b02 --- /dev/null +++ b/mixins/configs/process/supervisord-base.conf @@ -0,0 +1,33 @@ +[supervisord] +nodaemon=true +logfile=%(ENV_LOG_PATH)s/supervisord-base.log +childlogdir=%(ENV_LOG_PATH)s + +[program:device] +command=/usr/local/bin/docker-android start device +autostart=true +autorestart=false +startretries=0 +stdout_logfile=%(ENV_LOG_PATH)s/device.stdout.log +redirect_stderr=true +priority=1 +stopsignal=TERM +stopwaitsecs=10 + +[program:appium] +command=/usr/local/bin/docker-android start appium +autostart=true +autorestart=false +startretries=0 +stdout_logfile=%(ENV_LOG_PATH)s/appium.stdout.log +redirect_stderr=true +priority=1 + +[program:log_web_shared] +command=/usr/local/bin/docker-android share log +autostart=true +autorestart=true +stdout_logfile=%(ENV_LOG_PATH)s/log_shared.stdout.log +stderr_logfile=%(ENV_LOG_PATH)s/log_shared.stderr.log +redirect_stderr=false +priority=2 diff --git a/mixins/configs/process/supervisord-port.conf b/mixins/configs/process/supervisord-port.conf new file mode 100644 index 0000000..e54b1a9 --- /dev/null +++ b/mixins/configs/process/supervisord-port.conf @@ -0,0 +1,12 @@ +[supervisord] +nodaemon=true +logfile=%(ENV_LOG_PATH)s/supervisord-port.log +childlogdir=%(ENV_LOG_PATH)s + +[program:android_port_forward] +command=/usr/local/bin/docker-android start port_forwarder +autostart=true +autorestart=true +stdout_logfile=%(ENV_LOG_PATH)s/android_port_forward.stdout.log +redirect_stderr=true +priority=2 diff --git a/mixins/configs/process/supervisord-screen.conf b/mixins/configs/process/supervisord-screen.conf new file mode 100644 index 0000000..3bf3d84 --- /dev/null +++ b/mixins/configs/process/supervisord-screen.conf @@ -0,0 +1,40 @@ +[supervisord] +nodaemon=true +logfile=%(ENV_LOG_PATH)s/supervisord-extend.log +childlogdir=%(ENV_LOG_PATH)s + +[program:d_screen] +command=/usr/local/bin/docker-android start display_screen +autostart=true +autorestart=true +stdout_logfile=%(ENV_LOG_PATH)s/display_screen.stdout.log +stderr_logfile=%(ENV_LOG_PATH)s/display_screen.stderr.log +redirect_stderr=false +priority=1 + +[program:d_wm] +command=/usr/local/bin/docker-android start display_wm +autostart=true +autorestart=true +stdout_logfile=%(ENV_LOG_PATH)s/display_wm.stdout.log +stderr_logfile=%(ENV_LOG_PATH)s/display_wm.stderr.log +redirect_stderr=false +priority=2 + +[program:vnc_server] +command=/usr/local/bin/docker-android start vnc_server +autostart=true +autorestart=true +stdout_logfile=%(ENV_LOG_PATH)s/vnc_server.stdout.log +stderr_logfile=%(ENV_LOG_PATH)s/vnc_server.stderr.log +redirect_stderr=false +priority=3 + +[program:vnc_web] +command=/usr/local/bin/docker-android start vnc_web +autostart=true +autorestart=true +stdout_logfile=%(ENV_LOG_PATH)s/vnc_web.stdout.log +stderr_logfile=%(ENV_LOG_PATH)s/vnc_web.stderr.log +redirect_stderr=false +priority=3 diff --git a/genymotion/enable_adb.sh b/mixins/scripts/genymotion/aws/enable_adb.sh similarity index 100% rename from genymotion/enable_adb.sh rename to mixins/scripts/genymotion/aws/enable_adb.sh diff --git a/mixins/scripts/run.sh b/mixins/scripts/run.sh new file mode 100755 index 0000000..a8e9e45 --- /dev/null +++ b/mixins/scripts/run.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +function shuwdown(){ + echo "SIGTERM is received! Clean-up will be executed if needed!" + process_id=$(pgrep -f "start device") + kill ${process_id} + sleep 10 + if [[ ${DEVICE_TYPE} == "geny_aws" ]]; then + # Give time to execute tear_down method + sleep 180 + fi +} + +trap shuwdown SIGTERM + +SUPERVISORD_CONFIG_PATH="${APP_PATH}/mixins/configs/process" +if [[ ${DEVICE_TYPE} == "geny_"* ]]; then + /usr/bin/supervisord --configuration ${SUPERVISORD_CONFIG_PATH}/supervisord-base.conf & \ + wait +elif [[ ${EMULATOR_HEADLESS} == true ]]; then + /usr/bin/supervisord --configuration ${SUPERVISORD_CONFIG_PATH}/supervisord-port.conf & \ + /usr/bin/supervisord --configuration ${SUPERVISORD_CONFIG_PATH}/supervisord-base.conf & \ + wait +else + /usr/bin/supervisord --configuration ${SUPERVISORD_CONFIG_PATH}/supervisord-screen.conf & \ + /usr/bin/supervisord --configuration ${SUPERVISORD_CONFIG_PATH}/supervisord-port.conf & \ + /usr/bin/supervisord --configuration ${SUPERVISORD_CONFIG_PATH}/supervisord-base.conf & \ + wait +fi diff --git a/mixins/templates/genymotion/aws/.aws/credentials b/mixins/templates/genymotion/aws/.aws/credentials new file mode 100644 index 0000000..6a582ff --- /dev/null +++ b/mixins/templates/genymotion/aws/.aws/credentials @@ -0,0 +1,3 @@ +[default] +aws_access_key_id = +aws_secret_access_key = diff --git a/nginx/README.md b/nginx/README.md deleted file mode 100644 index d11cabf..0000000 --- a/nginx/README.md +++ /dev/null @@ -1,16 +0,0 @@ -Nginx ------ - -You can have one page which contains the list of running containers. - -##### Quick Start - -1. Run 2 docker-android containers which have port 6081 and 6082 - -2. Run docker-nginx - - ``` - docker run -d --name nginx --network host -v $PWD/conf.d:/etc/nginx/conf.d nginx:1.18.0 - ``` - -3. Open [http://127.0.0.1](http://127.0.0.1) from Web-Browser to see the list of running containers OR open ```http://127.0.0.1/container-1/?nginx=&path=/container-1/websockify&view_only=true&password=secr3t``` to see specific container. diff --git a/nginx/conf.d/data/data.json b/nginx/conf.d/data/data.json deleted file mode 100644 index 4bc1339..0000000 --- a/nginx/conf.d/data/data.json +++ /dev/null @@ -1,11 +0,0 @@ -containers = '[\ - {\ - "No": "1", \ - "Name": "Emulator 01", \ - "VNC": "http://127.0.0.1/container-1/?nginx=&path=/container-1/websockify&view_only=true"\ - }, \ - {\ - "No": "2", \ - "Name": "Emulator 02", \ - "VNC": "http://127.0.0.1/container-2/?nginx=&path=/container-2/websockify&view_only=true"\ -}]'; diff --git a/nginx/conf.d/default.conf b/nginx/conf.d/default.conf deleted file mode 100755 index a1b527e..0000000 --- a/nginx/conf.d/default.conf +++ /dev/null @@ -1,43 +0,0 @@ -server { - listen 80; - server_name _; - - location / { - root /etc/nginx/conf.d; - index index.html; - } - - location /container-1/ { - proxy_pass http://127.0.0.1:6081/; - } - - location /container-1/websockify { - proxy_pass http://127.0.0.1:6081/; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; - - # VNC connection timeout - proxy_read_timeout 61s; - - # Disable cache - proxy_buffering off; - } - - location /container-2/ { - proxy_pass http://127.0.0.1:6082/; - } - - location /container-2/websockify { - proxy_pass http://127.0.0.1:6082/; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; - - # VNC connection timeout - proxy_read_timeout 61s; - - # Disable cache - proxy_buffering off; - } -} diff --git a/nginx/conf.d/index.html b/nginx/conf.d/index.html deleted file mode 100644 index fc69a72..0000000 --- a/nginx/conf.d/index.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - List of docker-android containers - - - -
- - - - diff --git a/nginx/conf.d/scripts/main.js b/nginx/conf.d/scripts/main.js deleted file mode 100644 index 613bc9b..0000000 --- a/nginx/conf.d/scripts/main.js +++ /dev/null @@ -1,55 +0,0 @@ -var devices = JSON.parse(containers); - -var headers = []; -for (var pos = 0; pos < devices.length; pos++) { - for (var deviceKey in devices[pos]) { - // Check if key is already added to headers - if (headers.indexOf(deviceKey) === -1) { - headers.push(deviceKey); - } - } -} - -// Create a table -var table = document.createElement("table"); - -// Insert table header -var tr = table.insertRow(-1); -for (var pos = 0; pos < headers.length; pos++) { - var th = document.createElement("th"); // TABLE HEADER. - var header = headers[pos]; - th.innerHTML = header; - tr.appendChild(th); -} - -// Insert table content -for (var pos = 0; pos < devices.length; pos++) { - tr = table.insertRow(-1); - for (var index = 0; index < headers.length; index++) { - var td = document.createElement("td"); - var content = devices[pos][headers[index]]; - - if (index === 1) { - var link = document.createElement("a"); - link.href = devices[pos][headers[index+1]]; - link.innerHTML = content; - td.appendChild(link); - } else if (index === 2) { - var object = document.createElement("object"); - object.type = "text/html"; - object.data = content; - object.width = "950px"; - object.height = "950px"; - td.appendChild(object); - } else { - td.innerHTML = content; - } - - tr.appendChild(td); - } -} - -// Put the table inside div -var divContainer = document.getElementById("showData"); -divContainer.innerHTML = ""; -divContainer.appendChild(table); diff --git a/nginx/conf.d/styles/main.css b/nginx/conf.d/styles/main.css deleted file mode 100644 index ca78089..0000000 --- a/nginx/conf.d/styles/main.css +++ /dev/null @@ -1,13 +0,0 @@ -th, td { - font:14px Verdana; -} -table, th, td -{ - border: solid 1px #DDD; - border-collapse: collapse; - padding: 2px 3px; - text-align: center; -} -th { - font-weight:bold; -} diff --git a/pipelines/release-emulators.yml b/pipelines/release-emulators.yml deleted file mode 100644 index f1eb66a..0000000 --- a/pipelines/release-emulators.yml +++ /dev/null @@ -1,51 +0,0 @@ -trigger: - tags: - include: - - v* - -jobs: -- job: build_and_release_emulators - pool: - vmImage: ubuntu-20.04 - strategy: - maxParallel: 10 - matrix: - 6.0: - android.version: '6.0' - 7.0: - android.version: '7.0' - 7.1.1: - android.version: '7.1.1' - 8.0: - android.version: '8.0' - 8.1: - android.version: '8.1' - 9.0: - android.version: '9.0' - 10.0: - android.version: '10.0' - 11.0: - android.version: '11.0' - 12.0: - android.version: '12.0' - steps: - - task: UsePythonVersion@0 - inputs: - versionSpec: '3.8.12' - displayName: 'Use Python 3.8.12' - - - script: | - latest_tag=$(git describe --tags --abbrev=0) - echo "##vso[task.setvariable variable=release_version]$latest_tag" - - displayName: 'Get the latest release tag' - - - script: | - docker login -u $(DOCKER_USERNAME) -p=$(DOCKER_PASSWORD) - ./release.sh all $(android.version) $(release_version) - docker logout - - displayName: 'Build docker image, run unit tests and push the docker image' - - - script: bash <(curl -s https://codecov.io/bash) - displayName: 'Publish test result' diff --git a/pipelines/release-genymotion-and-device.yml b/pipelines/release-genymotion-and-device.yml deleted file mode 100644 index a97be12..0000000 --- a/pipelines/release-genymotion-and-device.yml +++ /dev/null @@ -1,37 +0,0 @@ -trigger: - tags: - include: - - v* - -jobs: -- job: build_and_release_genymotion_and_device - pool: - vmImage: ubuntu-20.04 - strategy: - maxParallel: 2 - matrix: - genymotion: - script.name: './release_real.sh' - real_device: - script.name: './release_geny.sh' - steps: - - task: UsePythonVersion@0 - inputs: - versionSpec: '3.8.12' - displayName: 'Use Python 3.8.12' - - - script: | - latest_tag=$(git describe --tags --abbrev=0) - echo "##vso[task.setvariable variable=release_version]$latest_tag" - - displayName: 'Get the latest release tag' - - - script: | - docker login -u $(DOCKER_USERNAME) -p=$(DOCKER_PASSWORD) - $(script.name) all $(release_version) - docker logout - - displayName: 'Build docker image, run unit tests and push the docker image' - - - script: bash <(curl -s https://codecov.io/bash) - displayName: 'Publish test result' diff --git a/pipelines/test-pipeline.yml b/pipelines/test-pipeline.yml deleted file mode 100644 index bb4466a..0000000 --- a/pipelines/test-pipeline.yml +++ /dev/null @@ -1,29 +0,0 @@ -trigger: - branches: - include: - - master - -pr: - branches: - include: - - '*' - -variables: - - name: app_version - value: test - -jobs: -- job: build_and_test - pool: - vmImage: ubuntu-20.04 - steps: - - task: UsePythonVersion@0 - inputs: - versionSpec: '3.8.12' - displayName: 'Use Python 3.8.12' - - script: pip install -r requirements.txt - displayName: 'Install pip packages' - - script: ./release.sh test 7.1.1 $(app_version) - displayName: 'Build Docker image with Android 7.1.1 and run unit tests' - - script: bash <(curl -s https://codecov.io/bash) - displayName: 'Publish test result' diff --git a/release.sh b/release.sh deleted file mode 100755 index 67804f8..0000000 --- a/release.sh +++ /dev/null @@ -1,209 +0,0 @@ -#!/bin/bash -# Bash version should >= 4 to be able to run this script. - -IMAGE="${DOCKER_ORG:-budtmo}/docker-android" - -if [ -z "$1" ]; then - read -p "Task (test|build|push|all) : " TASK -else - TASK=$1 -fi - -if [ -z "$2" ]; then - read -p "Android version (6.0|7.0|7.1.1|8.0|8.1|9.0|10.0|11.0|12.0|all): " ANDROID_VERSION -else - ANDROID_VERSION=$2 -fi - -if [ -z "$3" ]; then - read -p "Release version: " RELEASE -else - RELEASE=$3 -fi - -declare -A list_of_levels=( - [6.0]=23 - [7.0]=24 - [7.1.1]=25 - [8.0]=26 - [8.1]=27 - [9.0]=28 - [10.0]=29 - [11.0]=30 - [12.0]=31 -) - -# The version of the Chrome browser installed on the Android emulator needs to be known beforehand -# in order to chose the proper version of chromedriver (see http://chromedriver.chromium.org/downloads) -declare -A chromedriver_versions=( - [6.0]="2.18" - [7.0]="2.23" - [7.1.1]="2.28" - [8.0]="2.31" - [8.1]="2.33" - [9.0]="2.40" - [10.0]="74.0.3729.6" - [11.0]="83.0.4103.39" - [12.0]="91.0.4472.101" -) - -function get_android_versions() { - versions=() - - if [ "$ANDROID_VERSION" == "all" ]; then - for key in "${!list_of_levels[@]}"; do - versions+=($key) - done - else - for key in "${!list_of_levels[@]}"; do - if [[ $key == *"$ANDROID_VERSION"* ]]; then - versions+=($key) - fi - done - fi - - # If version cannot be found in the list - if [ -z "$versions" ]; then - echo "Android version \"$ANDROID_VERSION\" is not found in the list or not supported! Support only version 6.0, 7.0, 7.1.1, 8.0, 8.1, 9.0, 10.0, 11.0, 12.0" - exit 1 - fi - - echo "Android versions: ${versions[@]}" -} - -get_android_versions -processor=x86 - -function test() { - # Prepare needed parameter to run tests - test_android_version=7.1.1 - test_api_level=25 - test_processor=x86 - test_sys_img=$test_processor - test_img_type=google_apis - test_browser=chrome - test_image=test_img - test_container=test_con - - # Run e2e tests - # E2E tests must be run only for linux OS / x86 image to reduce duration of test execution - if [ "$(uname -s)" == 'Linux' ] && [ "$E2E" = true ]; then - echo "----BUILD TEST IMAGE----" - docker build -t $test_image --build-arg ANDROID_VERSION=$test_android_version \ - --build-arg API_LEVEL=$test_api_level --build-arg PROCESSOR=$test_processor --build-arg SYS_IMG=$test_sys_img \ - --build-arg IMG_TYPE=$test_img_type --build-arg BROWSER=$test_browser -f docker/Emulator_x86 . - - echo "----REMOVE OLD TEST CONTAINER----" - docker kill $test_container && docker rm $test_container - - echo "----PREPARE CONTAINER----" - docker run --privileged -d -p 4723:4723 -p 6080:6080 -e APPIUM=True -e DEVICE="Samsung Galaxy S6" --name $test_container $test_image - docker cp example/sample_apk $test_container:/root/tmp - attempt=0 - while [ ${attempt} -le 10 ]; do - attempt=$(($attempt + 1)) - output=$(docker ps | grep healthy | grep test_con | wc -l) - if [[ "$output" == 1 ]]; then - echo "Emulator is ready." - break - else - echo "Waiting 10 seconds for emulator to be ready (attempt: $attempt)" - sleep 10 - fi - - if [[ $attempt == 10 ]]; then - echo "Failed!" - exit 1 - fi - done - - echo "----RUN E2E TESTS----" - nosetests src/tests/e2e -v - - echo "----REMOVE TEST CONTAINER----" - docker kill $test_container && docker rm $test_container - fi - - # Run unit tests (After e2e test to get coverage result) - echo "----UNIT TESTS----" - (export ANDROID_HOME=/root && export ANDROID_VERSION=$test_android_version && export API_LEVEL=$test_api_level \ - && export PROCESSOR=$test_processor && export SYS_IMG=$test_sys_img && export IMG_TYPE=$test_img_type \ - && nosetests src/tests/unit -v) -} - -function build() { - # Remove pyc files - find . -name "*.pyc" -exec rm -f {} \; - - # Build docker image - FILE_NAME=docker/Emulator_x86 - - for v in "${versions[@]}"; do - level=${list_of_levels[$v]} - - # Find image type and default web browser - if [ "$v" == "6.0" ]; then - # It is because there is no ARM EABI v7a System Image for 6.0 - IMG_TYPE=google_apis - BROWSER=browser - elif [ "$v" == "" ]; then - IMG_TYPE=google_apis - BROWSER=chrome - else - #adb root cannot be run in IMG_TYPE=google_apis_playstore - IMG_TYPE=google_apis - BROWSER=chrome - # Android 9 & Android 11 had build issues that requires 64-bit - # Android 12+ Google dropped 32-bit support - if [ "$v" == "9.0" ] || [ $level -ge 30 ]; then - processor=x86_64 - fi - fi - echo "[BUILD] IMAGE TYPE: $IMG_TYPE" - echo "[BUILD] API Level: $level" - sys_img=$processor - echo "[BUILD] System Image: $sys_img" - chrome_driver="${chromedriver_versions[$v]}" - echo "[BUILD] chromedriver version: $chrome_driver" - image_version="$IMAGE-x86-$v:$RELEASE" - image_latest="$IMAGE-x86-$v:latest" - echo "[BUILD] Image name: $image_version and $image_latest" - echo "[BUILD] Dockerfile: $FILE_NAME" - docker build -t $image_version --build-arg TOKEN=$TOKEN --build-arg ANDROID_VERSION=$v --build-arg API_LEVEL=$level \ - --build-arg PROCESSOR=$processor --build-arg SYS_IMG=$sys_img --build-arg IMG_TYPE=$IMG_TYPE \ - --build-arg BROWSER=$BROWSER --build-arg CHROME_DRIVER=$chrome_driver \ - --build-arg APP_RELEASE_VERSION=$RELEASE -f $FILE_NAME . - docker tag $image_version $image_latest - done -} - -function push() { - # Push docker image(s) - for v in "${versions[@]}"; do - image_version="$IMAGE-x86-$v:$RELEASE" - image_latest="$IMAGE-x86-$v:latest" - echo "[PUSH] Image name: $image_version and $image_latest" - docker push $image_version - docker push $image_latest - done -} - -case $TASK in - test) - test - ;; - build) - build - ;; - push) - push - ;; - all) - test - build - push - ;; - *) - echo "Invalid environment! Valid options: test, build, push, all" - ;; -esac diff --git a/release_geny.sh b/release_geny.sh deleted file mode 100755 index 53a71db..0000000 --- a/release_geny.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash - -if [ -z "$1" ]; then - read -p "Task (build|push|all) : " TASK -else - TASK=$1 -fi - -if [ -z "$2" ]; then - read -p "Release version: " RELEASE -else - RELEASE=$2 -fi - -IMAGE="budtmo/docker-android" -FILE_NAME=docker/Genymotion - -image_version="$IMAGE-genymotion:$RELEASE" -image_latest="$IMAGE-genymotion:latest" - -function build() { - echo "[BUILD] Image name: $image_version and $image_latest" - echo "[BUILD] Dockerfile: $FILE_NAME" - docker build -t $image_version --build-arg TOKEN=$TOKEN --build-arg APP_RELEASE_VERSION=$RELEASE -f $FILE_NAME . - docker tag $image_version $image_latest -} - -function push() { - echo "[PUSH] Image name: $image_version and $image_latest" - docker push $image_version - docker push $image_latest -} - -case $TASK in - build) - build - ;; - push) - push - ;; - all) - build - push - ;; - *) - echo "Invalid environment! Valid options: test, build, push, all" - ;; -esac diff --git a/release_real.sh b/release_real.sh deleted file mode 100755 index cc73947..0000000 --- a/release_real.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash - -if [ -z "$1" ]; then - read -p "Task (build|push|all) : " TASK -else - TASK=$1 -fi - -if [ -z "$2" ]; then - read -p "Release version: " RELEASE -else - RELEASE=$2 -fi - -IMAGE="budtmo/docker-android" -FILE_NAME=docker/Real_device - -image_version="$IMAGE-real-device:$RELEASE" -image_latest="$IMAGE-real-device:latest" - -function build() { - echo "[BUILD] Image name: $image_version and $image_latest" - echo "[BUILD] Dockerfile: $FILE_NAME" - docker build -t $image_version --build-arg TOKEN=$TOKEN --build-arg APP_RELEASE_VERSION=$RELEASE -f $FILE_NAME . - docker tag $image_version $image_latest -} - -function push() { - echo "[PUSH] Image name: $image_version and $image_latest" - docker push $image_version - docker push $image_latest -} - -case $TASK in - build) - build - ;; - push) - push - ;; - all) - build - push - ;; - *) - echo "Invalid environment! Valid options: test, build, push, all" - ;; -esac diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index e207edd..0000000 --- a/requirements.txt +++ /dev/null @@ -1,5 +0,0 @@ -selenium==3.3.1 -Appium-Python-Client==0.24 -coverage==4.2 -mock==2.0.0 -nose==1.3.7 diff --git a/src/.fehbg b/src/.fehbg deleted file mode 100755 index 459fefe..0000000 --- a/src/.fehbg +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -feh --bg-max '/root/logo.png' diff --git a/src/__init__.py b/src/__init__.py deleted file mode 100644 index e2104db..0000000 --- a/src/__init__.py +++ /dev/null @@ -1,7 +0,0 @@ -import os - -ROOT = '/root' -WORKDIR = os.path.dirname(__file__) -CHROME_DRIVER = os.path.join(ROOT, 'chromedriver') -CONFIG_FILE = os.path.join(WORKDIR, 'nodeconfig.json') -LOGGING_FILE = os.path.join(WORKDIR, 'logging.conf') diff --git a/src/app.py b/src/app.py deleted file mode 100644 index 2177882..0000000 --- a/src/app.py +++ /dev/null @@ -1,244 +0,0 @@ -#!/usr/bin/env python3 - -import json -import logging -import os -import re -import subprocess -import uuid - -from src import CHROME_DRIVER, CONFIG_FILE, ROOT -from src import log - -log.init() -logger = logging.getLogger('app') - - -def symlink_force(target, link_name): - try: - os.symlink(target, link_name) - except OSError as e: - import errno - if e.errno == errno.EEXIST: - os.remove(link_name) - os.symlink(target, link_name) - - -def get_or_raise(env: str) -> str: - """ - Check if needed environment variables are given. - - :param env: key - :return: value - """ - env_value = os.getenv(env) - if not env_value: - raise RuntimeError('The environment variable {0:s} is missing.' - 'Please check docker image or Dockerfile!'.format(env)) - return env_value - - -def convert_str_to_bool(str: str) -> bool: - """ - Convert string to boolean. - - :param str: given string - :return: converted string - """ - try: - return str.lower() in ('yes', 'true', 't', '1') - except AttributeError as err: - logger.error(err) - - -def is_initialized(device_name) -> bool: - config_path = os.path.join(ROOT, 'android_emulator', 'config.ini') - - if os.path.exists(config_path): - logger.info('Found existing config file at {}.'.format(config_path)) - with open(config_path, 'r') as f: - if any(re.match(r'hw\.device\.name ?= ?{}'.format(device_name), line) for line in f): - logger.info('Existing config file references {}. Assuming device was previously initialized.'.format(device_name)) - return True - else: - logger.info('Existing config file does not reference {}. Assuming new device.'.format(device_name)) - return False - - logger.info('No config file file was found at {}. Assuming new device.'.format(config_path)) - return False - - -ANDROID_HOME = get_or_raise('ANDROID_HOME') -ANDROID_VERSION = get_or_raise('ANDROID_VERSION') -API_LEVEL = get_or_raise('API_LEVEL') -PROCESSOR = get_or_raise('PROCESSOR') -SYS_IMG = get_or_raise('SYS_IMG') -IMG_TYPE = get_or_raise('IMG_TYPE') - -logger.info('Android version: {version} \n' - 'API level: {level} \n' - 'Processor: {processor} \n' - 'System image: {img} \n' - 'Image type: {img_type}'.format(version=ANDROID_VERSION, level=API_LEVEL, processor=PROCESSOR, - img=SYS_IMG, img_type=IMG_TYPE)) - - -def prepare_avd(device: str, avd_name: str, dp_size: str): - """ - Create and run android virtual device. - - :param device: Device name - :param avd_name: Name of android virtual device / emulator - """ - - device_name_bash = device.replace(' ', '\ ') - skin_name = device.replace(' ', '_').lower() - - # For custom hardware profile - profile_dst_path = os.path.join(ROOT, '.android', 'devices.xml') - if 'samsung' in device.lower(): - # profile file name = skin name - profile_src_path = os.path.join(ANDROID_HOME, 'devices', 'profiles', '{profile}.xml'.format(profile=skin_name)) - logger.info('Hardware profile resource path: {rsc}'.format(rsc=profile_src_path)) - logger.info('Hardware profile destination path: {dst}'.format(dst=profile_dst_path)) - symlink_force(profile_src_path, profile_dst_path) - - avd_path = '/'.join([ROOT, 'android_emulator']) - creation_cmd = 'avdmanager create avd -f -n {name} -b {img_type}/{sys_img} -k "system-images;android-{api_lvl};' \ - '{img_type};{sys_img}" -d {device} -p {path}'.format(name=avd_name, img_type=IMG_TYPE, - sys_img=SYS_IMG, - api_lvl=API_LEVEL, device=device_name_bash, - path=avd_path) - logger.info('Command to create avd: {command}'.format(command=creation_cmd)) - subprocess.check_call(creation_cmd, shell=True) - - skin_path = '/'.join([ANDROID_HOME, 'devices', 'skins', skin_name]) - config_path = '/'.join([avd_path, 'config.ini']) - with open(config_path, 'a') as file: - file.write('skin.path={sp}'.format(sp=skin_path)) - file.write('\ndisk.dataPartition.size={dp}'.format(dp=dp_size)) - - logger.info('Skin was added in config.ini') - - -def appium_run(avd_name: str): - """ - Run appium server. - - :param avd_name: Name of android virtual device / emulator - """ - DEFAULT_LOG_PATH = '/var/log/supervisor/appium.log' - cmd = 'appium --log {log}'.format(log=os.getenv('APPIUM_LOG', DEFAULT_LOG_PATH)) - - relaxed_security = convert_str_to_bool(str(os.getenv('RELAXED_SECURITY', False))) - logger.info('Relaxed security? {rs}'.format(rs=relaxed_security)) - if relaxed_security: - cmd += ' --relaxed-security' - - default_web_browser = os.getenv('BROWSER') - cmd += ' --chromedriver-executable {driver}'.format(driver=CHROME_DRIVER) - - 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: - # Ubuntu 16.04 -> local_ip = os.popen('ifconfig eth0 | grep \'inet addr:\' | cut -d: -f2 | awk \'{ print $1}\'').read().strip() - local_ip = os.popen('ifconfig eth0 | grep \'inet\' | cut -d: -f2 | awk \'{ print $2}\'').read().strip() - try: - mobile_web_test = convert_str_to_bool(str(os.getenv('MOBILE_WEB_TEST', False))) - appium_host = os.getenv('APPIUM_HOST', local_ip) - appium_port = int(os.getenv('APPIUM_PORT', 4723)) - selenium_host = os.getenv('SELENIUM_HOST', '172.17.0.1') - selenium_port = int(os.getenv('SELENIUM_PORT', 4444)) - selenium_timeout = int(os.getenv('SELENIUM_TIMEOUT', 30)) - selenium_proxy_class = os.getenv('SELENIUM_PROXY_CLASS', 'org.openqa.grid.selenium.proxy.DefaultRemoteProxy') - browser_name = default_web_browser if mobile_web_test else 'android' - create_node_config(avd_name, browser_name, appium_host, appium_port, selenium_host, selenium_port, - selenium_timeout, selenium_proxy_class) - cmd += ' --nodeconfig {file}'.format(file=CONFIG_FILE) - except ValueError as v_err: - logger.error(v_err) - title = 'Appium Server' - subprocess.check_call('xterm -T "{title}" -n "{title}" -e \"{cmd}\"'.format(title=title, cmd=cmd), shell=True) - - -def create_node_config(avd_name: str, browser_name: str, appium_host: str, appium_port: int, selenium_host: str, - selenium_port: int, selenium_timeout: int, selenium_proxy_class: str): - """ - Create custom node config file in json format to be able to connect with selenium server. - - :param avd_name: Name of android virtual device / emulator - :param appium_host: Host where appium server is running - :param appium_port: Port number where where appium server is running - :param selenium_host: Host where selenium server is running - :param selenium_port: Port number where selenium server is running - :param selenium_timeout: Selenium session timeout in seconds - :param selenium_proxy_class: Selenium Proxy class created in Selenium hub - """ - config = { - 'capabilities': [ - { - 'platform': 'Android', - 'platformName': 'Android', - 'version': ANDROID_VERSION, - 'browserName': browser_name, - 'deviceName': avd_name, - 'maxInstances': 1, - } - ], - 'configuration': { - 'cleanUpCycle': 2000, - 'timeout': selenium_timeout, - 'proxy': selenium_proxy_class, - 'url': 'http://{host}:{port}/wd/hub'.format(host=appium_host, port=appium_port), - 'host': appium_host, - 'port': appium_port, - 'maxSession': 1, - 'register': True, - 'registerCycle': 5000, - 'hubHost': selenium_host, - 'hubPort': selenium_port, - 'unregisterIfStillDownAfter': 120000 - } - } - logger.info('Appium node config: {config}'.format(config=config)) - with open(CONFIG_FILE, 'w') as cf: - cf.write(json.dumps(config)) - - -def run(): - """Run app.""" - device = os.getenv('DEVICE', 'Nexus 5') - logger.info('Device: {device}'.format(device=device)) - custom_args=os.getenv('EMULATOR_ARGS', '') - logger.info('Custom Args: {custom_args}'.format(custom_args=custom_args)) - - avd_name = os.getenv('AVD_NAME', '{device}_{version}'.format(device=device.replace(' ', '_').lower(), version=ANDROID_VERSION)) - logger.info('AVD name: {avd}'.format(avd=avd_name)) - is_first_run = not is_initialized(device) - - dp_size = os.getenv('DATAPARTITION', '550m') - - if is_first_run: - logger.info('Preparing emulator...') - prepare_avd(device, avd_name, dp_size) - - logger.info('Run emulator...') - - if is_first_run: - logger.info('Emulator was not previously initialized. Preparing a new one...') - cmd = 'emulator @{name} -gpu swiftshader_indirect -accel on -wipe-data -writable-system -verbose {custom_args}'.format(name=avd_name, custom_args=custom_args) - else: - logger.info('Using previously initialized AVD...') - cmd = 'emulator @{name} -gpu swiftshader_indirect -accel on -verbose -writable-system {custom_args}'.format(name=avd_name, custom_args=custom_args) - - appium = convert_str_to_bool(str(os.getenv('APPIUM', False))) - if appium: - subprocess.Popen(cmd.split()) - logger.info('Run appium server...') - appium_run(avd_name) - else: - result = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE).communicate() - - -if __name__ == '__main__': - run() diff --git a/src/appium.sh b/src/appium.sh deleted file mode 100644 index ba94afc..0000000 --- a/src/appium.sh +++ /dev/null @@ -1,376 +0,0 @@ -#!/bin/bash - -types=($TYPES) -echo "Available types: ${types[@]}" -echo "Selected type of deployment: $TYPE, Template file: $TEMPLATE" - -function prepare_geny_cloud() { - contents=$(cat $TEMPLATE) - - # LogIn - echo "Log In" - gmsaas auth login "${USER}" "${PASS}" - - # Start device(s) - created_instances=() - echo "Creating device(s) based on given json file..." - for row in $(echo "${contents}" | jq -r '.[] | @base64'); do - get_value() { - echo ${row} | base64 --decode | jq -r ${1} - } - - template=$(get_value '.template') - device=$(get_value '.device') - port=$(get_value '.port') - - if [[ $device != null ]]; then - echo "Starting \"$device\" with template name \"$template\"..." - instance_uuid=$(gmsaas instances start "${template}" "${device}") - else - echo "Starting Device with Random name..." - random_device_name=$(python3 -c 'import uuid; print(str(uuid.uuid4()).upper())') - instance_uuid=$(gmsaas instances start "${template}" "${random_device_name}") - fi - - echo "Instance-ID: \"$instance_uuid\"" - created_instances+=("${instance_uuid}") - - if [[ $port != null ]]; then - echo "Connect device on port \"$port\"..." - gmsaas instances adbconnect "${instance_uuid}" --adb-serial-port "${port}" - else - echo "Connect device on port..." - gmsaas instances adbconnect "${instance_uuid}" - fi - done - - # Store created instances in a file - echo "All created instances: ${created_instances[@]}" - echo "${created_instances[@]}" > "${INSTANCES_PATH}" -} - -function prepare_geny_aws() { - contents=$(cat $TEMPLATE) - - # Creating aws tf file(s) - echo "Creating tf file(s)" - index=1 - port=5555 - for row in $(echo "${contents}" | jq -r '.[] | @base64'); do - get_value() { - echo ${row} | base64 --decode | jq -r ${1} - } - - region=$(get_value '.region') - android_version=$(get_value '.android_version') - instance=$(get_value '.instance') - ami=$(get_value '.AMI') - sg=$(get_value '.SG') - subnet_id=$(get_value '.subnet_id') - if [[ $subnet_id == null ]]; then - subnet_id="" - fi - - echo $region - echo $android_version - echo $instance - echo $ami - echo $sg - echo $subnet_id - - #TODO: remove this dirty hack - if [[ $android_version == null ]]; then - echo "[HACK] Version cannot be empty! version will be added!" - android_version="6.0" - fi - - #Custom Security Group - if [[ $sg != null ]]; then - echo "Custom security group is found!" - security_group="" - - is_array=$(echo "${sg}" | jq 'if type=="array" then true else false end') - if [ $is_array == "true" ]; then - echo "New security group with given rules will be created" - for i in $(echo "${sg}" | jq -r '.[] | @base64'); do - get_value() { - echo ${i} | base64 --decode | jq -r ${1} - } - - type=$(get_value '.type') - configs=$(get_value '.configurations') - - - for c in $(echo "${configs}" | jq -r '.[] | @base64'); do - get_value() { - echo ${c} | base64 --decode | jq -r ${1} - } - - from_port=$(get_value '.from_port') - to_port=$(get_value '.to_port') - protocol=$(get_value '.protocol') - cidr_blocks=$(get_value '.cidr_blocks') - security_group+=$(cat <<_EOF - - $type { - from_port = $from_port - to_port = $to_port - protocol = "$protocol" - cidr_blocks = ["$cidr_blocks"] - } -_EOF - ) - done - done - else - #TODO: remove this dirty hack - echo "Given security group will be used!" - is_array="false" - security_group=$(cat <<_EOF - ingress { - from_port = 22 - to_port = 22 - protocol = "tcp" - cidr_blocks = ["0.0.0.0/0"] - } -_EOF -) - fi - else - echo "Custom security is not found! It will use default security group!" - security_group=$(cat <<_EOF - ingress { - from_port = 22 - to_port = 22 - protocol = "tcp" - cidr_blocks = ["0.0.0.0/0"] - } - ingress { - from_port = 80 - to_port = 80 - protocol = "tcp" - cidr_blocks = ["0.0.0.0/0"] - } - ingress { - from_port = 443 - to_port = 443 - protocol = "tcp" - cidr_blocks = ["0.0.0.0/0"] - } - ingress { - from_port = 51000 - to_port = 51100 - protocol = "tcp" - cidr_blocks = ["0.0.0.0/0"] - } - ingress { - from_port = 51000 - to_port = 51100 - protocol = "udp" - cidr_blocks = ["0.0.0.0/0"] - } - egress { - from_port = 0 - to_port = 65535 - protocol = "udp" - cidr_blocks = ["0.0.0.0/0"] - } -_EOF -) - fi - - aws_tf_content=$(cat <<_EOF -variable "aws_region_$index" { - type = "string" - default = "$region" -} - -variable "android_version_$index" { - type = "string" - default = "$android_version" -} - -variable "instance_type_$index" { - type = "string" - default = "$instance" -} - -variable "subnet_id_$index" { - type = "string" - default = "$subnet_id" -} - -provider "aws" { - alias = "provider_$index" - region = "\${var.aws_region_$index}" -} - -resource "aws_security_group" "geny_sg_$index" { - provider = "aws.provider_$index" - $security_group -} - -data "aws_ami" "geny_aws_$index" { - provider = "aws.provider_$index" - most_recent = true - - filter { - name = "name" - values = ["genymotion-ami-\${var.android_version_$index}-*"] - } - - owners = ["679593333241"] #Genymotion -} - -resource "aws_key_pair" "geny_key_$index" { - provider = "aws.provider_$index" - public_key = "\${file("~/.ssh/id_rsa.pub")}" -} - -resource "aws_instance" "geny_aws_$index" { - provider = "aws.provider_$index" - ami="\${data.aws_ami.geny_aws_$index.id}" - instance_type = "\${var.instance_type_$index}" - subnet_id = "\${var.subnet_id_$index}" - vpc_security_group_ids=["\${aws_security_group.geny_sg_$index.name}"] - key_name = "\${aws_key_pair.geny_key_$index.key_name}" - tags { - Name = "DockerAndroid-\${data.aws_ami.geny_aws_$index.id}" - } - count = 1 - - provisioner "remote-exec" { - connection { - type = "ssh" - user = "shell" - private_key = "\${file("~/.ssh/id_rsa")}" - } - - script = "/root/enable_adb.sh" - } -} - -output "public_dns_$index" { - value = "\${aws_instance.geny_aws_$index.public_dns}" -} -_EOF -) - echo "$aws_tf_content" > /root/aws_tf_$index.tf - - if [[ $ami != null ]]; then - echo "Using given AMI!" - sed -i "s/.*ami=.*/ ami=\"$ami\"/g" /root/aws_tf_$index.tf - else - echo "Custom AMI is not found. It will use the latest AMI!" - fi - - if [[ $sg != null ]] && [[ $is_array == "false" ]]; then - echo "Using given security group: $sg" - sed -i "s/.*vpc_security_group_ids=.*/ vpc_security_group_ids=[\"$sg\"]/g" /root/aws_tf_$index.tf - fi - - echo "---------------------------------------------------------" - - ((index++)) - ((port++)) - done - - # Deploy EC2 instance(s) - echo "Deploy EC2 instance(s) on AWS with Genymotion image based on given json file..." - ./terraform init - ./terraform plan - ./terraform apply -auto-approve - - # Workaround to connect adb remotely because there is a issue by using local-exec - time_sleep=5 - interval_sleep=1 - echo "Connect to adb remotely" - for ((i=index;i>=1;i--)); do - dns=$(./terraform output public_dns_$i) - ((sleep ${interval_sleep} && adb connect localhost:${port}) > /dev/null & ssh -i ~/.ssh/id_rsa -o ServerAliveInterval=60 -o StrictHostKeyChecking=no -q -NL ${port}:localhost:5555 shell@${dns}) & - ((port--)) - time_sleep=$((time_sleep+interval_sleep)) - done - echo "It will wait for ${time_sleep} until all device(s) to be connected" - sleep ${time_sleep} - adb devices - echo "Process is completed" -} - -function run_appium() { - echo "Preparing appium-server..." - CMD="appium --log $APPIUM_LOG" - if [ "$CONNECT_TO_GRID" = true ]; then - NODE_CONFIG_JSON="/root/src/nodeconfig.json" - /root/generate_config.sh $NODE_CONFIG_JSON - CMD+=" --nodeconfig $NODE_CONFIG_JSON" - fi - - if [ "$RELAXED_SECURITY" = true ]; then - CMD+=" --relaxed-security" - fi - - echo "Preparation is done" - TERM="xterm -T AppiumServer -n AppiumServer -e $CMD" - $TERM -} - -function ga(){ - if [ "$GA" = true ]; then - echo "Collecting data for improving the project" - description="PROCESSOR: ${SYS_IMG}; VERSION: ${ANDROID_VERSION}; DEVICE: ${DEVICE}; APPIUM: ${APPIUM}; SELENIUM: ${CONNECT_TO_GRID}; MOBILE_TEST: ${MOBILE_WEB_TEST}" - random_user=$(cat /proc/version 2>&1 | sed -e 's/ /_/g' | sed -e 's/[()]//g' | sed -e 's/@.*_gcc_version/_gcc/g' | sed -e 's/__/_/g' | sed -e 's/Linux_version_//g' | sed -e 's/generic_build/genb/g') - random_user="${APP_RELEASE_VERSION}_${random_user}" - payload=( - --data v=${GA_API_VERSION} - --data aip=1 - --data tid="${GA_TRACKING_ID}" - --data cid="${random_user}" - --data t="event" - --data ec="${APP_TYPE}" - --data ea="${random_user}" - --data el="${description}" - --data an="docker-android" - --data av="${APP_RELEASE_VERSION}" - ) - curl ${GA_ENDPOINT} "${payload[@]}" --silent - else - echo "Nothing to do" - fi -} - -function saltstack(){ - if [ ! -z "${SALT_MASTER}" ]; then - echo "ENV SALT_MASTER it not empty, salt-minion will be prepared" - echo "master: ${SALT_MASTER}" >> /etc/salt/minion - salt-minion & - echo "salt-minion is running..." - else - echo "SaltStack is disabled" - fi -} - -ga -saltstack -if [ "$REAL_DEVICE" = true ]; then - echo "Using real device" - run_appium -elif [ "$GENYMOTION" = true ]; then - echo "Using Genymotion" - echo "${types[@]}" - case $TYPE in - "${types[0]}" ) - echo "Using Genymotion-Cloud (SaaS)" - prepare_geny_cloud - run_appium - ;; - "${types[1]}" ) - echo "Using Genymotion-AWS" - prepare_geny_aws - run_appium - ;; - esac -else - echo "Using Emulator" - python3 -m src.app -fi diff --git a/src/port_forward.sh b/src/port_forward.sh deleted file mode 100644 index 0534c22..0000000 --- a/src/port_forward.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -#Ubuntu 16.04 -> ip=$(ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}') -ip=$(ifconfig eth0 | grep 'inet' | cut -d: -f2 | awk '{ print $2}') -socat tcp-listen:5554,bind=$ip,fork tcp:127.0.0.1:5554 & -socat tcp-listen:5555,bind=$ip,fork tcp:127.0.0.1:5555 diff --git a/src/rc.xml b/src/rc.xml deleted file mode 100644 index a25c2da..0000000 --- a/src/rc.xml +++ /dev/null @@ -1,753 +0,0 @@ - - - - - - - - 10 - 20 - - - - yes - - no - - yes - - no - - 200 - - no - - - - - Smart - -
yes
- - Primary - - 1 - -
- - - Clearlooks - NLIMC - - yes - yes - - sans - 8 - - bold - - normal - - - - sans - 8 - - bold - - normal - - - - sans - 9 - - normal - - normal - - - - sans - 9 - - normal - - normal - - - - sans - 9 - - bold - - normal - - - - sans - 9 - - bold - - normal - - - - - - - 1 - 1 - - - - 875 - - - - - yes - Nonpixel - - Center - - - - - 10 - - 10 - - - - - - - 0 - 0 - 0 - 0 - - - - TopLeft - - 0 - 0 - no - Above - - Vertical - - no - 300 - - 300 - - Middle - - - - - C-g - - - - leftno - - - rightno - - - upno - - - downno - - - leftno - - - rightno - - - upno - - - downno - - - 1 - - - 2 - - - 3 - - - 4 - - - - - - - - - - - - - - - - client-menu - - - - scrot -s - - - - - - - - - - - - - - - - - - - - - - - - yesyes - - - - - - - - - - - - right - - - - - left - - - - - up - - - - - down - - - - - - - - true - Konqueror - - kfmclient openProfile filemanagement - - - - - scrot - - - - - 1 - - 500 - - 400 - - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - previous - - - next - - - previous - - - next - - - previous - - - next - - - - - - - - - - - - - - no - - - - - - - - - - - yes - - - - - - - - - - - - - - - - - - - - - - - - - client-menu - - - - - - top - - - - - - left - - - - - - right - - - - - - bottom - - - - - - client-menu - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - client-menu - - - - - client-menu - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - vertical - - - horizontal - - - - - - - - - - - - - - - - - previous - - - next - - - - previous - - - next - - - previous - - - next - - - - - - - - - - - - - - - - client-list-combined-menu - - - root-menu - - - - - - previous - - - next - - - previous - - - next - - - - - - - - - - /var/lib/openbox/debian-menu.xml - menu.xml - 200 - - no - - 100 - - 400 - - yes - - yes - - - - - - - -
\ No newline at end of file diff --git a/src/record.sh b/src/record.sh deleted file mode 100644 index 1f2f485..0000000 --- a/src/record.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash - -function start() { - mkdir -p $VIDEO_PATH - name="$(date '+%d_%m_%Y_%H_%M_%S').mp4" - echo "Start video recording" - ffmpeg -video_size 1599x899 -framerate 15 -f x11grab -i $DISPLAY $VIDEO_PATH/$name -y -} - -function stop() { - echo "Stop video recording" - kill $(ps -ef | grep [f]fmpeg | awk '{print $2}') -} - -function auto_record() { - echo "Auto record: $AUTO_RECORD" - sleep 6 - - while [ "$AUTO_RECORD" = true ]; do - # Check if there is test running - no_test=true - while $no_test; do - task=$(curl -s localhost:4723/wd/hub/sessions | jq -r '.value') - if [ "$task" = "" ] || [ "$task" = "[]" ]; then - sleep .5 - else - start & - no_test=false - fi - done - - # Check if test is finished - while [ $no_test = false ]; do - task=$(curl -s localhost:4723/wd/hub/sessions | jq -r '.value') - if [ "$task" = "" ] || [ "$task" = "[]" ]; then - stop - no_test=true - else - sleep .5 - fi - done - done - - echo "Auto recording is disabled!" -} - -$@ diff --git a/src/scrcpy.sh b/src/scrcpy.sh deleted file mode 100644 index 0aaa861..0000000 --- a/src/scrcpy.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -if [ -z "$REAL_DEVICE"]; then - echo "Container is using android emulator" -else - echo "Starting android screen copy..." - /usr/local/bin/scrcpy -fi diff --git a/src/tests/e2e/test_android_apk.py b/src/tests/e2e/test_android_apk.py deleted file mode 100644 index 89cf2fe..0000000 --- a/src/tests/e2e/test_android_apk.py +++ /dev/null @@ -1,29 +0,0 @@ -"""e2e test to test sample android application inside docker-android""" -from unittest import TestCase - -from appium import webdriver - - -class TestE2EAndroidApk(TestCase): - - def setUp(self): - desired_caps = { - 'platformName': 'Android', - 'deviceName': 'Android Emulator', - 'automationName': 'UIAutomator2', - 'app': '/root/tmp/sample_apk_debug.apk' - } - self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps) - - 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) - - def tearDown(self): - self.driver.quit() diff --git a/src/tests/e2e/test_chrome.py b/src/tests/e2e/test_chrome.py deleted file mode 100644 index bf85e1e..0000000 --- a/src/tests/e2e/test_chrome.py +++ /dev/null @@ -1,34 +0,0 @@ -"""e2e test to test chrome application inside docker-android""" -from unittest import TestCase - -from appium import webdriver - - -class TestE2EChrome(TestCase): - - def setUp(self): - 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://localhost:4723/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() - - def tearDown(self): - self.driver.quit() diff --git a/src/tests/unit/__init__.py b/src/tests/unit/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/tests/unit/test_app.py b/src/tests/unit/test_app.py deleted file mode 100644 index e626793..0000000 --- a/src/tests/unit/test_app.py +++ /dev/null @@ -1,121 +0,0 @@ -"""Unit test to test app.""" -import os -from unittest import TestCase - -import mock - -from src import app - - -# https://bugs.python.org/issue21258 -def mock_open(*args, **kargs): - f_open = mock.mock_open(*args, **kargs) - f_open.return_value.__iter__ = lambda self : iter(self.readline, '') - return f_open - - -class TestApp(TestCase): - """Unit test class to test other methods in the app.""" - - @classmethod - def test_symlink(self): - res = os.path.join('testFile1.txt') - dest = os.path.join('link_testFile1.txt') - open(res, 'a').close() - app.symlink_force(res, dest) - os.remove(res) - os.remove(dest) - - @classmethod - def test_symlink_already_exist(self): - res = os.path.join('testFile1.txt') - dest = os.path.join('link_testFile1.txt') - open(res, 'a').close() - open(dest, 'a').close() - app.symlink_force(res, dest) - os.remove(res) - os.remove(dest) - - def test_valid_env(self): - key = 'ENV_1' - os.environ[key] = 'test' - app.get_or_raise(key) - del os.environ[key] - - def test_invalid_env(self): - with self.assertRaises(RuntimeError): - app.get_or_raise('ENV_2') - - def test_valid_bool(self): - self.assertEqual(app.convert_str_to_bool('True'), True) - self.assertEqual(app.convert_str_to_bool('t'), True) - self.assertEqual(app.convert_str_to_bool('1'), True) - self.assertEqual(app.convert_str_to_bool('YES'), True) - - def test_invalid_bool(self): - self.assertEqual(app.convert_str_to_bool(''), False) - self.assertEqual(app.convert_str_to_bool('test'), False) - - def test_invalid_format(self): - self.assertEqual(app.convert_str_to_bool(True), None) - - @mock.patch('src.app.prepare_avd') - @mock.patch('builtins.open') - @mock.patch('subprocess.Popen') - def test_run_with_appium(self, mocked_avd, mocked_open, 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) - self.assertTrue(mocked_appium.called) - - @mock.patch('src.app.prepare_avd') - @mock.patch('builtins.open') - @mock.patch('subprocess.Popen') - def test_run_with_appium_and_relaxed_security(self, mocked_avd, mocked_open, mocked_subprocess): - with mock.patch('src.app.appium_run') as mocked_appium: - os.environ['APPIUM'] = str(True) - os.environ['RELAXED_SECURITY'] = str(True) - app.run() - self.assertTrue(mocked_avd.called) - self.assertTrue(mocked_subprocess.called) - self.assertTrue(mocked_appium.called) - - @mock.patch('src.app.prepare_avd') - @mock.patch('builtins.open') - @mock.patch('subprocess.Popen') - def test_run_without_appium(self, mocked_avd, mocked_open, mocked_subprocess): - with mock.patch('src.app.appium_run') as mocked_appium: - os.environ['APPIUM'] = str(False) - app.run() - self.assertTrue(mocked_avd.called) - self.assertTrue(mocked_subprocess.called) - self.assertFalse(mocked_appium.called) - - @mock.patch('builtins.open') - @mock.patch('subprocess.Popen') - @mock.patch('os.path.exists', mock.MagicMock(return_value=False)) - def test_it_prepares_avd_on_first_run(self, mocked_open, mocked_subprocess): - with mock.patch('src.app.prepare_avd') as mocked_prepare_avd: - app.run() - self.assertFalse(app.is_initialized('Nexus 5')) - self.assertTrue(mocked_prepare_avd.called) - - @mock.patch('subprocess.Popen') - @mock.patch('os.path.exists', mock.MagicMock(return_value=True)) - @mock.patch('builtins.open', mock_open(read_data="\nhw.device.name=Nexus 5\n")) - def test_it_doesnt_prepare_avd_if_config_exists(self, mocked_subprocess): - with mock.patch('src.app.prepare_avd') as mocked_prepare_avd: - app.run() - self.assertTrue(app.is_initialized('Nexus 5')) - self.assertFalse(mocked_prepare_avd.called) - - @mock.patch('subprocess.Popen') - @mock.patch('os.path.exists', mock.MagicMock(return_value=True)) - @mock.patch('builtins.open', mock_open(read_data="\nhw.device.name=Samsung S7\n")) - def test_it_prepares_avd_if_config_is_for_another_device(self, mocked_subprocess): - with mock.patch('src.app.prepare_avd') as mocked_prepare_avd: - app.run() - self.assertFalse(app.is_initialized('Nexus 5')) - self.assertTrue(mocked_prepare_avd.called) diff --git a/src/tests/unit/test_appium.py b/src/tests/unit/test_appium.py deleted file mode 100644 index cd2b101..0000000 --- a/src/tests/unit/test_appium.py +++ /dev/null @@ -1,71 +0,0 @@ -"""Unit test to test appium service.""" -import os -from unittest import TestCase - -import mock - -from src import app - - -class TestAppium(TestCase): - """Unit test class to test appium methods.""" - - def setUp(self): - os.environ['CONNECT_TO_GRID'] = str(True) - self.avd_name = 'test_avd' - - @mock.patch('subprocess.check_call') - def test_chrome_driver(self, mocked_subprocess): - os.environ['CONNECT_TO_GRID'] = str(False) - os.environ['BROWSER'] = 'chrome' - self.assertFalse(mocked_subprocess.called) - app.appium_run(self.avd_name) - self.assertTrue(mocked_subprocess.called) - - @mock.patch('subprocess.check_call') - def test_without_selenium_grid(self, mocked_subprocess): - os.environ['CONNECT_TO_GRID'] = str(False) - self.assertFalse(mocked_subprocess.called) - app.appium_run(self.avd_name) - self.assertTrue(mocked_subprocess.called) - - @mock.patch('os.popen') - @mock.patch('subprocess.check_call') - def test_with_selenium_grid(self, mocked_os, mocked_subprocess): - with mock.patch('src.app.create_node_config') as mocked_config: - self.assertFalse(mocked_config.called) - self.assertFalse(mocked_os.called) - self.assertFalse(mocked_subprocess.called) - app.appium_run(self.avd_name) - self.assertTrue(mocked_config.called) - self.assertTrue(mocked_os.called) - self.assertTrue(mocked_subprocess.called) - - @mock.patch('os.popen') - @mock.patch('subprocess.check_call') - def test_invalid_integer(self, mocked_os, mocked_subprocess): - os.environ['APPIUM_PORT'] = 'test' - with mock.patch('src.app.create_node_config') as mocked_config: - self.assertFalse(mocked_config.called) - self.assertFalse(mocked_os.called) - self.assertFalse(mocked_subprocess.called) - app.appium_run(self.avd_name) - self.assertFalse(mocked_config.called) - self.assertTrue(mocked_os.called) - self.assertTrue(mocked_subprocess.called) - self.assertRaises(ValueError) - - def test_config_creation(self): - from src import CONFIG_FILE - self.assertFalse(os.path.exists(CONFIG_FILE)) - app.create_node_config('test', 'android', '127.0.0.1', 4723, '127.0.0.1', 4444, 30, - 'org.openqa.grid.selenium.proxy.DefaultRemoteProxy') - self.assertTrue(os.path.exists(CONFIG_FILE)) - os.remove(CONFIG_FILE) - - def tearDown(self): - del os.environ['CONNECT_TO_GRID'] - if os.getenv('APPIUM_PORT'): - del os.environ['APPIUM_PORT'] - if os.getenv('BROWSER'): - del os.environ['BROWSER'] diff --git a/src/tests/unit/test_avd.py b/src/tests/unit/test_avd.py deleted file mode 100644 index 2512da9..0000000 --- a/src/tests/unit/test_avd.py +++ /dev/null @@ -1,38 +0,0 @@ -"""Unit test for android virtual device creation.py.""" -import os -from unittest import TestCase - -import mock - -from src import app - - -@mock.patch('subprocess.check_call') -class TestAvd(TestCase): - """Unit test class to test method create_avd.""" - - def setUp(self): - self.avd_name = 'test_avd' - - @mock.patch("builtins.open", create=True) - def test_nexus_avd_as_default(self, mocked_suprocess, mocked_open): - self.assertFalse(mocked_suprocess.called) - self.assertFalse(mocked_open.called) - app.prepare_avd('Nexus 5', self.avd_name, '550m') - self.assertTrue(mocked_suprocess.called) - self.assertTrue(mocked_open.called) - - @mock.patch('os.symlink') - @mock.patch("builtins.open", create=True) - def test_samsung_avd(self, mocked_suprocess, mocked_sys_link, mocked_open): - self.assertFalse(mocked_sys_link.called) - self.assertFalse(mocked_suprocess.called) - self.assertFalse(mocked_open.called) - app.prepare_avd('Samsung Galaxy S6', self.avd_name, '550m') - self.assertTrue(mocked_sys_link.called) - self.assertTrue(mocked_suprocess.called) - self.assertTrue(mocked_open.called) - - def tearDown(self): - if os.getenv('DEVICE'): - del os.environ['DEVICE'] diff --git a/src/utils.sh b/src/utils.sh deleted file mode 100755 index e29b5b3..0000000 --- a/src/utils.sh +++ /dev/null @@ -1,145 +0,0 @@ -#!/bin/bash - -function wait_emulator_to_be_ready () { - boot_completed=false - while [ "$boot_completed" == false ]; do - status=$(adb wait-for-device shell getprop sys.boot_completed | tr -d '\r') - echo "Boot Status: $status" - - if [ "$status" == "1" ]; then - boot_completed=true - else - sleep 1 - fi - done -} - -function change_language_if_needed() { - if [ ! -z "${LANGUAGE// }" ] && [ ! -z "${COUNTRY// }" ]; then - wait_emulator_to_be_ready - echo "Language will be changed to ${LANGUAGE}-${COUNTRY}" - adb root && adb shell "setprop persist.sys.language $LANGUAGE; setprop persist.sys.country $COUNTRY; stop; start" && adb unroot - echo "Language is changed!" - fi -} - -function install_google_play () { - wait_emulator_to_be_ready - echo "Google Play Service will be installed" - adb install -r "/root/google_play_services.apk" - echo "Google Play Store will be installed" - adb install -r "/root/google_play_store.apk" -} - -function enable_proxy_if_needed () { - if [ "$ENABLE_PROXY_ON_EMULATOR" = true ]; then - if [ ! -z "${HTTP_PROXY// }" ]; then - if [[ $HTTP_PROXY == *"http"* ]]; then - protocol="$(echo $HTTP_PROXY | grep :// | sed -e's,^\(.*://\).*,\1,g')" - proxy="$(echo ${HTTP_PROXY/$protocol/})" - echo "[EMULATOR] - Proxy: $proxy" - - IFS=':' read -r -a p <<< "$proxy" - - echo "[EMULATOR] - Proxy-IP: ${p[0]}" - echo "[EMULATOR] - Proxy-Port: ${p[1]}" - - wait_emulator_to_be_ready - echo "Enable proxy on Android emulator. Please make sure that docker-container has internet access!" - adb root - - echo "Set up the Proxy" - adb shell "content update --uri content://telephony/carriers --bind proxy:s:"0.0.0.0" --bind port:s:"0000" --where "mcc=310" --where "mnc=260"" - sleep 5 - adb shell "content update --uri content://telephony/carriers --bind proxy:s:"${p[0]}" --bind port:s:"${p[1]}" --where "mcc=310" --where "mnc=260"" - - if [ ! -z "${HTTP_PROXY_USER}" ]; then - sleep 2 - adb shell "content update --uri content://telephony/carriers --bind user:s:"${HTTP_PROXY_USER}" --where "mcc=310" --where "mnc=260"" - fi - if [ ! -z "${HTTP_PROXY_PASSWORD}" ]; then - sleep 2 - adb shell "content update --uri content://telephony/carriers --bind password:s:"${HTTP_PROXY_PASSWORD}" --where "mcc=310" --where "mnc=260"" - fi - - adb unroot - - # Mobile data need to be restarted for Android 10 or higher - adb shell svc data disable - adb shell svc data enable - else - echo "Please use http:// in the beginning!" - fi - else - echo "$HTTP_PROXY is not given! Please pass it through environment variable!" - exit 1 - fi - fi -} - -function check_emulator_popups() { - echo "Waiting for device..." - wait_emulator_to_be_ready - $ANDROID_HOME/platform-tools/adb wait-for-device shell true - - EMU_BOOTED=0 - n=0 - first_launcher=1 - echo 1 > /tmp/failed - while [[ $EMU_BOOTED = 0 ]];do - echo "Test for current focus" - CURRENT_FOCUS=`$ANDROID_HOME/platform-tools/adb shell dumpsys window 2>/dev/null | grep -i mCurrentFocus` - echo "Current focus: ${CURRENT_FOCUS}" - case $CURRENT_FOCUS in - *"Launcher"*) - if [[ $first_launcher == 1 ]]; then - echo "Launcher seems to be ready, wait 10 sec for another popup..." - sleep 10 - first_launcher=0 - else - echo "Launcher is ready, Android boot completed" - EMU_BOOTED=1 - rm /tmp/failed - fi - ;; - *"Not Responding: com.android.systemui"*) - echo "Dismiss System UI isn't responding alert" - adb shell su root 'kill $(pidof com.android.systemui)' - first_launcher=1 - ;; - *"Not Responding: com.google.android.gms"*) - echo "Dismiss GMS isn't responding alert" - adb shell input keyevent KEYCODE_ENTER - first_launcher=1 - ;; - *"Not Responding: system"*) - echo "Dismiss Process system isn't responding alert" - adb shell input keyevent KEYCODE_ENTER - first_launcher=1 - ;; - *"ConversationListActivity"*) - echo "Close Messaging app" - adb shell input keyevent KEYCODE_ENTER - first_launcher=1 - ;; - *) - n=$((n + 1)) - echo "Waiting Android to boot 10 sec ($n)..." - sleep 10 - if [ $n -gt 60 ]; then - echo "Android Emulator does not start in 10 minutes" - exit 2 - fi - ;; - esac - done - echo "Android Emulator started." -} - -change_language_if_needed -sleep 1 -enable_proxy_if_needed -sleep 1 -install_google_play -sleep 1 -check_emulator_popups diff --git a/src/vnc.sh b/src/vnc.sh deleted file mode 100755 index d8132fd..0000000 --- a/src/vnc.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -vnc="/usr/bin/x11vnc -display ${DISPLAY} -forever -shared " - -pass_path="/root/vncpass" -if [ ! -z "${VNC_PASSWORD}" ]; then - /usr/bin/x11vnc -storepasswd ${VNC_PASSWORD} ${pass_path} - param="-rfbauth ${pass_path}" -else - param="-nopw" -fi - -${vnc}${param} diff --git a/supervisord.conf b/supervisord.conf deleted file mode 100644 index 9e874c5..0000000 --- a/supervisord.conf +++ /dev/null @@ -1,64 +0,0 @@ -[supervisord] -nodaemon=true -logfile=%(ENV_LOG_PATH)s/supervisord.log -childlogdir=%(ENV_LOG_PATH)s -priority=1 - -[program:xvfb] -command=/usr/bin/Xvfb %(ENV_DISPLAY)s -screen %(ENV_SCREEN)s %(ENV_SCREEN_WIDTH)sx%(ENV_SCREEN_HEIGHT)sx%(ENV_SCREEN_DEPTH)s -stdout_logfile=%(ENV_LOG_PATH)s/xvfb.stdout.log -stderr_logfile=%(ENV_LOG_PATH)s/xvfb.stderr.log -priority=1 - -[program:openbox] -command=/usr/bin/openbox-session -stdout_logfile=%(ENV_LOG_PATH)s/openbox.stdout.log -stderr_logfile=%(ENV_LOG_PATH)s/openbox.stderr.log -priority=2 - -[program:x11vnc] -command=./src/vnc.sh -stdout_logfile=%(ENV_LOG_PATH)s/x11vnc.stdout.log -stderr_logfile=%(ENV_LOG_PATH)s/x11vnc.stderr.log -priority=2 -autorestart=true - -[program:novnc] -command=./noVNC/utils/launch.sh --vnc localhost:%(ENV_LOCAL_PORT)s --listen %(ENV_TARGET_PORT)s -stdout_logfile=%(ENV_LOG_PATH)s/novnc.stdout.log -stderr_logfile=%(ENV_LOG_PATH)s/novnc.stderr.log -priority=2 - -[program:port-forward] -command=./src/port_forward.sh -autorestart=false -priority=1 - -;startsecs to fix "not expected" error. see: https://github.com/Supervisor/supervisor/issues/212#issuecomment-47933372 -[program:screen-copy] -command=./src/scrcpy.sh -autorestart=false -stdout_logfile=%(ENV_LOG_PATH)s/screen-copy.stdout.log -stderr_logfile=%(ENV_LOG_PATH)s/screen-copy.stderr.log -priority=3 - -[program:docker-appium] -command=./src/appium.sh -autorestart=false -stdout_logfile=%(ENV_LOG_PATH)s/docker-android.stdout.log -stderr_logfile=%(ENV_LOG_PATH)s/docker-android.stderr.log -priority=4 - -[program:auto-recording] -command=./src/record.sh auto_record -autorestart=false -stdout_logfile=%(ENV_LOG_PATH)s/video-recording.stdout.log -stderr_logfile=%(ENV_LOG_PATH)s/video-recording.stderr.log -priority=4 - -[program:adb-utils] -command=bash ./src/utils.sh -autorestart=false -stdout_logfile=%(ENV_LOG_PATH)s/adb-utils.stdout.log -stderr_logfile=%(ENV_LOG_PATH)s/adb-utils.stderr.log -priority=5