Skip to content

Latest commit

 

History

History
110 lines (83 loc) · 3.68 KB

chrome-android.md

File metadata and controls

110 lines (83 loc) · 3.68 KB

Chrome on Android

To run the tests with Chrome on Android, follow these steps:

  1. Download Android Studio (release version "Arctic Fox" at the time of this writing) and on the welcome dialog, select "More Actions" => "SDK Manager", then switch to the "SDK Tools" tab and install the following components (if not already installed):

    • Android SDK Command-line Tools
    • Android Emulator
    • Android SDK Platform-Tools
    • Intel x86 Emulator Accelerator (HAXM installer)

    Please Note:
    To be able to use a custom /etc/hosts file requires mounting the root file system as writable, which requires a supported system image for the Android Virtual Device (AVD), e.g.:

    Android 9 "Pie" (Google APIs)

    System images for Android 10 "Q" or system images including the Google Play store do not support mounting the root file system as writable.
    See also John Wu's Twitter post on Android 10's file system format.

  2. Add the following lines to your ~/.profile to make the JDK included in Android Studio and the installed Android SDK available to other applications:

    export JAVA_HOME='/Applications/Android Studio.app/Contents/jre/Contents/Home'
    export PATH="$JAVA_HOME/bin:$PATH"
    export ANDROID_HOME=~/Library/Android/sdk
  3. Start the Android Virtual Device with a custom /etc/hosts file:

    bin/android-emulator.sh -hosts etc/android.hosts
  4. Change the virtual device settings to enable a hardware keyboard and increase the internal storage:

    • In Android Studio on the welcome dialog, select "More Actions" => "AVD Manager", then with a right mouse click on your listed Virtual Device, bring up the menu and select "Edit".
    • Click on the "Show Advanced Settings" button to be able to see all settings.
    • Scroll to the "Memory and Storage" section and change the value of "Internal Storage" to 2048 (MB).
    • Scroll to the bottom of the configuration pane and mark the checkbox for "Enable keyboard input".
    • Click the "Finish" button and restart the virtual device.
  5. Install the latest Google Chrome for Android version:

    • Download the latest Google Chrome APK (Android Application Package) for the architecture of your emulated device (x86).
    • Drag&drop the APK file into the emulator window to install it or install it via command-line:
      adb install com.android.chrome_*.apk
  6. Install Node.JS via Homebrew:

    brew install node
  7. Make sure the necessary Appium dependencies for Android testing are installed:

    npx appium-doctor --android
  8. Install Appium as global NPM package:

    npm install -g appium
  9. Start appium with the provided helper script:

    bin/appium.sh

    This script is configured for Automatic discovery of compatible Chromedriver and will download a chromedriver version compatible with the version of Chrome running on the Android device.

  10. Run the tests with Chrome on Android:

    docker-compose run --rm wdio conf/chrome-android.js

    To run the tests in landscape orientation, provide the ORIENTATION environment variable:

    ORIENTATION=LANDSCAPE docker-compose run --rm wdio conf/chrome-android.js