Showing
2 changed files
with
22 additions
and
45 deletions
| 1 | # Originally based on https://medium.com/@nocnoc/flutter-unit-widget-and-integration-testing-with-ios-and-android-emulators-on-travis-ci-df17ed7c3be | 1 | # Originally based on https://medium.com/@nocnoc/flutter-unit-widget-and-integration-testing-with-ios-and-android-emulators-on-travis-ci-df17ed7c3be |
| 2 | -language: generic | 2 | +sudo: true |
| 3 | 3 | ||
| 4 | matrix: | 4 | matrix: |
| 5 | - exclude: | 5 | + include: |
| 6 | - stage: Integration Testing | 6 | - stage: Integration Testing |
| 7 | + | ||
| 7 | name: Android | 8 | name: Android |
| 8 | 9 | ||
| 9 | os: linux | 10 | os: linux |
| 10 | dist: trusty | 11 | dist: trusty |
| 11 | - sudo: true | ||
| 12 | - | ||
| 13 | - before_install: | ||
| 14 | - - sudo apt-get install -y --no-install-recommends lib32stdc++6 libstdc++6 > /dev/null | ||
| 15 | - # Install the Android SDK Dependency. | ||
| 16 | - - export ANDROID_HOME=/opt/android-sdk-linux | ||
| 17 | - - cd /opt | ||
| 18 | - - wget -q https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip -O android-sdk-tools.zip | ||
| 19 | - - unzip -q android-sdk-tools.zip -d ${ANDROID_HOME} | ||
| 20 | - - rm android-sdk-tools.zip | ||
| 21 | - - cd - | ||
| 22 | - - PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/platform-tools | ||
| 23 | - # Silence warning. | ||
| 24 | - - mkdir -p ~/.android | ||
| 25 | - - touch ~/.android/repositories.cfg | ||
| 26 | - # Accept licenses before installing components, no need to echo "y" for each component | ||
| 27 | - - yes | sdkmanager --licenses | ||
| 28 | - # Platform tools | ||
| 29 | - - sdkmanager "emulator" "tools" "platform-tools" > /dev/null | ||
| 30 | - - sdkmanager --list | head -15 | ||
| 31 | - # install older packages (for emulator) | ||
| 32 | - - sdkmanager "build-tools;25.0.2" "platforms;android-25" > /dev/null | 12 | + language: android |
| 33 | 13 | ||
| 34 | - # Create and start emulator. | ||
| 35 | - - EMULATOR_API_LEVEL=22 | ||
| 36 | - - ANDROID_ABI="default;armeabi-v7a" | ||
| 37 | - - sdkmanager "system-images;android-$EMULATOR_API_LEVEL;$ANDROID_ABI" > /dev/null | ||
| 38 | - - sdkmanager --list | head -15 | ||
| 39 | - - echo no | avdmanager create avd --force -n test -k "system-images;android-$EMULATOR_API_LEVEL;$ANDROID_ABI" | ||
| 40 | - - $ANDROID_HOME/emulator/emulator -avd test -no-audio -no-window -gpu swiftshader & | ||
| 41 | - | ||
| 42 | - # install pre-compiled flutter | ||
| 43 | - - wget --quiet --output-document=flutter.tar.xz https://storage.googleapis.com/flutter_infra/releases/dev/linux/flutter_linux_v1.7.11-dev.tar.xz && tar xf flutter.tar.xz > /dev/null && rm flutter.tar.xz | 14 | + install: |
| 15 | + - git clone -b master https://github.com/flutter/flutter.git | ||
| 16 | + - ./flutter/bin/flutter --version | ||
| 17 | + before_script: | ||
| 44 | - export PATH="$PATH":"$HOME/.pub-cache/bin" | 18 | - export PATH="$PATH":"$HOME/.pub-cache/bin" |
| 45 | - export PATH=$PWD/flutter/bin:$PWD/flutter/bin/cache/dart-sdk/bin:$PATH | 19 | - export PATH=$PWD/flutter/bin:$PWD/flutter/bin/cache/dart-sdk/bin:$PATH |
| 46 | - - flutter doctor -v | ||
| 47 | 20 | ||
| 48 | - # Wait for emulator to finish startup. | ||
| 49 | - - ./ci/wait.sh | ||
| 50 | - - adb shell input keyevent 82 | ||
| 51 | - - flutter devices | 21 | + - echo no | android create avd --force -n test -t android-28 --abi armeabi-v7a -c 100M |
| 22 | + - emulator -avd test -no-audio -no-window & | ||
| 23 | + - android-wait-for-emulator | ||
| 24 | + - adb shell input keyevent 82 & | ||
| 25 | + | ||
| 26 | + - flutter doctor -v | ||
| 52 | 27 | ||
| 53 | - cd example | 28 | - cd example |
| 54 | - script: flutter driver test_driver/app.dart | ||
| 55 | - include: | 29 | + script: |
| 30 | + - flutter driver test_driver/app.dart | ||
| 56 | - name: iOS | 31 | - name: iOS |
| 57 | 32 | ||
| 58 | os: osx | 33 | os: osx |
| 59 | osx_image: xcode10.2 | 34 | osx_image: xcode10.2 |
| 35 | + language: generic | ||
| 60 | 36 | ||
| 61 | before_install: | 37 | before_install: |
| 62 | - open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app | 38 | - open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app |
| 63 | - export HOMEBREW_NO_AUTO_UPDATE=1 | 39 | - export HOMEBREW_NO_AUTO_UPDATE=1 |
| 64 | - | 40 | + install: |
| 65 | - brew install libimobiledevice | 41 | - brew install libimobiledevice |
| 66 | - brew install ideviceinstaller | 42 | - brew install ideviceinstaller |
| 67 | - brew install ios-deploy | 43 | - brew install ios-deploy |
| @@ -70,11 +46,12 @@ matrix: | @@ -70,11 +46,12 @@ matrix: | ||
| 70 | 46 | ||
| 71 | - git clone -b master https://github.com/flutter/flutter.git | 47 | - git clone -b master https://github.com/flutter/flutter.git |
| 72 | - ./flutter/bin/flutter --version | 48 | - ./flutter/bin/flutter --version |
| 73 | - | 49 | + before_script: |
| 74 | - export PATH="$PATH":"$HOME/.pub-cache/bin" | 50 | - export PATH="$PATH":"$HOME/.pub-cache/bin" |
| 75 | - export PATH=$PWD/flutter/bin:$PWD/flutter/bin/cache/dart-sdk/bin:$PATH | 51 | - export PATH=$PWD/flutter/bin:$PWD/flutter/bin/cache/dart-sdk/bin:$PATH |
| 76 | 52 | ||
| 77 | - flutter doctor -v | 53 | - flutter doctor -v |
| 78 | 54 | ||
| 79 | - cd example | 55 | - cd example |
| 80 | - script: flutter driver test_driver/app.dart | ||
| 56 | + script: | ||
| 57 | + - flutter driver test_driver/app.dart |
| @@ -44,7 +44,7 @@ Wakelock.toggle(on: on); | @@ -44,7 +44,7 @@ Wakelock.toggle(on: on); | ||
| 44 | bool isEnabled = await Wakelock.isEnabled; | 44 | bool isEnabled = await Wakelock.isEnabled; |
| 45 | ``` | 45 | ``` |
| 46 | 46 | ||
| 47 | -If you want to wait for the wakelock toggle on Android or iOS to complete (which takes an insignificant amount of time), you can also await either of `Wakelock.enable`, `Wakelock.disable`, and `Wakelock.toggle`. | 47 | +If you want to wait for the wakelock toggle on Android or iOS to complete (which takes an insignificant amount of time), you can also await any of `Wakelock.enable`, `Wakelock.disable`, and `Wakelock.toggle`. |
| 48 | 48 | ||
| 49 | ## Notes | 49 | ## Notes |
| 50 | 50 |
-
Please register or login to post a comment