{"id":22017301,"url":"https://github.com/ecureuill/dockerized-robot-appium-environment","last_synced_at":"2025-05-07T03:08:16.155Z","repository":{"id":265532569,"uuid":"763086928","full_name":"ecureuill/dockerized-robot-appium-environment","owner":"ecureuill","description":"Dockerized environment for robot and appium","archived":false,"fork":false,"pushed_at":"2024-11-29T19:01:37.000Z","size":660,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-07T03:08:10.967Z","etag":null,"topics":["android-testing","automated-testing","docker","dockerized","mobile-testing","robotframework","robotframework-appiumlibrary"],"latest_commit_sha":null,"homepage":"","language":"RobotFramework","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ecureuill.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-25T14:25:42.000Z","updated_at":"2024-11-29T19:01:40.000Z","dependencies_parsed_at":"2024-11-29T23:01:02.215Z","dependency_job_id":null,"html_url":"https://github.com/ecureuill/dockerized-robot-appium-environment","commit_stats":null,"previous_names":["ecureuill/dockerized-robot-appium-environment"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecureuill%2Fdockerized-robot-appium-environment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecureuill%2Fdockerized-robot-appium-environment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecureuill%2Fdockerized-robot-appium-environment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecureuill%2Fdockerized-robot-appium-environment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ecureuill","download_url":"https://codeload.github.com/ecureuill/dockerized-robot-appium-environment/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252804217,"owners_count":21806770,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android-testing","automated-testing","docker","dockerized","mobile-testing","robotframework","robotframework-appiumlibrary"],"created_at":"2024-11-30T05:05:50.572Z","updated_at":"2025-05-07T03:08:16.109Z","avatar_url":"https://github.com/ecureuill.png","language":"RobotFramework","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Automated Mobile Testing with Robot Framework and Appium in Docker\n\nThis guide demonstrates how to set up a Dockerized environment for automating mobile app tests using Robot Framework and Appium. This approach streamlines test execution, ensures environment consistency, and eliminates the need for local tool installations.\n\n![alt text](.github/imgs/screenshot.png)\n\n## Automation Environment\n\n- Appium Server container\n- Robot Framework container\n- Physical Mobile device\n- Appium Inspector\n- (optional) Scrcpy\n- (optional) Visual Code with Dev Containers Extension\n\n### Setting up the Environment\n\n#### Prerequisites\n- Ensure Docker is installed and configured\n- Ensure ADB is installed\n- Device with developer mode active and USB Debugging enabled\n\n**Optional**\n- Enable device's Wireless Debugging\n- Install Scrcpy\n\n#### Steps\n1. Open the terminal and navigate to your project directory\n    ```bash\n    cd path/to/project\n    ```\n1. Connect the device via USB to your computer\n    \n    Approve the connection on your device\n1. (optional) Mirror the mobile device screen\n    ```bash\n    # Check if device is connected (attached)\n    adb devices\n    # Restart the adb server in tcpip mode on port 5555\n    adb tcpip 5555\n    # Mirror the device via wifi (enter the ip of your device)\n    scrcpy --tcpip=192.168.15.59:5555\n    ```\n1. Run appium server container and Robot container\n    ```bash\n    # (First time) Build services\n    docker compose build\n    docker compose up -d\n    # outputs\n        # [+] Running 2/2\n        # ✔ Container appium  Started \n        # ✔ Container robot   Started   \n    ```\n1. Check if the device is connected to the Appium Server\n    ```shell\n    # Executes \"adb devices\" commando inside appium docker\n    docker exec appium adb devices\n    ```\n    Or if you follow step 6: \n    ```shell\n    # Kill adb server on your machine to disconnect the device\n    adb kill-server\n    # Check if the device is connected to the appium server\n    docker exec appium adb devices\n    # Mirror the device screen\n    scrcpy --tcpip=192.168.15.59:5555\n    ```\n1. (Optional) Attach VS Code to the Robot container\n    With the Dev Container extension, you can open any folder or repository inside a Docker container and take advantage of Visual Studio Code's full feature set.\n    ![User is selecting the option to attach vs code to a running container](.github/imgs/vscode-devcontainers.png)\n    \n1. Eventually you will ned to stop containers\n    ```shell\n    docker compose down\n    ```\n\n\n\n\n## Tips for programming tests\n\n### Containers Host\n\nWithin the docker network, you can use the name of the container as an alias for the IP address. \n\n```python\nOpen Application    \n...    remote_url=http://appium:4723\n...    platformName=Android\n...    automationName=UiAutomator2\n```\n\nOutside the docker network, you must provide the IP address. This is how you can identifying the IP address assigned to a container\n\n```bash\ndocker inspect appium | grep IPAddress \n# Result\n#    \"SecondaryIPAddresses\": null,\n#    \"IPAddress\": \"\",\n#        \"IPAddress\": \"172.23.0.3\",\n\n```\n### How to configure Appium Inspector\n\n1. Install Appium Inspector, or, access the web version\n    ![Appium Configuration UI](.github/imgs/appium-configUi.png)\n\n1. Fill in the following data:\n    - **Remote Host**: The IP address of the Appium container\n    - **Remote Port**: 4723\n    - Capacility Builder\n        - **platformName: Android**\n        - **automationName: UiAutomator2**\n1. Click the *Start Session* button\n1. The inspection interface should be loaded\n    ![Appium Inspector UI](.github/imgs/appium-inspectUi.png)\n\n### You don't need a thirdy party app to retrieve the target app package name\nEventually, you will need the package name of the tested app, you can achieve this using following commands:\n\n```shell\n# Enter the Appium container.\ndocker exec -it appium bash\n# Connect to the Android device shell.\nadb shell\n# Get the package name of the app in focus.\ndumpsys window | grep mCurrentFocus\n```\n\n## Observations\n\nThis is a basic example. Customize it for your specific testing requirements.\n\n## Resources \n\nCheck these links for more information\n* **ADB** [official documentation](https://developer.android.com/tools/adb)\n* **Appium** [official documentation](https://appium.io/)\n* **Appium Docker Image** [github repository](https://github.com/appium/appium-docker-android)\n* **Appium Inspector** [github repository](https://github.com/appium/appium-inspector)\n* **Docker** installation [official documentation](https://docs.docker.com/engine/install/)\n* **Robot Framework** [official documentation](https://robotframework.org/)\n* **Robot Docker Image** [github repository](https://github.com/MarketSquare/robotframework-browser/tree/main/docker)\n* **Scrcpy** [github repository](https://github.com/Genymobile/scrcpy)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fecureuill%2Fdockerized-robot-appium-environment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fecureuill%2Fdockerized-robot-appium-environment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fecureuill%2Fdockerized-robot-appium-environment/lists"}