GitHub Actions Android-эмулятор не загружается на macOS Runner для теста пользовательского интерфейсаAndroid

Форум для тех, кто программирует под Android
Ответить
Anonymous
 GitHub Actions Android-эмулятор не загружается на macOS Runner для теста пользовательского интерфейса

Сообщение Anonymous »

Я запускаю тест пользовательского интерфейса в GitHub Actions с помощью средства запуска macOS, используя действие ReactiveCircus/android-emulator-runner@v2.
Эмулятор запускается, но, похоже, не удается подключиться к адб. Я установил порт эмулятора: 5556 и увеличил
emulator-boot-timeout до 1200, но тест не может обнаружить устройство. Есть идеи, как обеспечить правильную загрузку эмулятора?
Вот настройка:
name: Android UI Tests

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
ui_tests:
# Use macOS runner to support hardware acceleration with HAXM
runs-on: macos-latest

steps:
# 1. Clone the repository
- name: Check out repository
uses: actions/checkout@v2

# 2. Set up JDK 17 (required for newer SDK Manager)
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '17'

# 3. Set up Android SDK
- name: Set up Android SDK
uses: android-actions/setup-android@v2
with:
api-level: 30
build-tools: 30.0.3
cache: gradle

# 4. Start Android emulator for UI tests
- name: Start Android emulator
uses: ReactiveCircus/android-emulator-runner@v2
with:
api-level: 30
target: default
arch: x86_64
profile: Nexus 6
emulator-options: "-no-window -no-audio"
disable-animations: true
emulator-port: 5556 # Use a specific port
emulator-boot-timeout: 1200 # 20 minutes
force-avd-creation: true
script: echo "Starting Emulator"

# 5. Verify ADB Connection
- name: Check Emulator Status
run: adb devices

# 6. Wait for the Android Emulator to boot (with timeout)
- name: Wait for Android Emulator to boot
run: |
boot_timeout=300 # Set timeout to 5 minutes
boot_time=0
until adb shell getprop sys.boot_completed | grep -m 1 '1'; do
if [ $boot_time -ge $boot_timeout ]; then
echo "Emulator boot timed out after $boot_timeout seconds."
adb -s emulator-5556 emu kill # Terminate emulator
exit 1
fi
echo "Waiting for emulator to boot..."
sleep 10
boot_time=$((boot_time + 10))
done
echo "Emulator booted successfully."

# 7. Check Emulator Log (optional, for troubleshooting)
- name: Print Emulator Log
run: adb logcat -d

# 8. Run UI tests
- name: Run UI tests
run: ./gradlew connectedAndroidTest

# 9. Upload UI test results (optional)
- name: Upload UI test results
if: failure()
uses: actions/upload-artifact@v3
with:
name: ui-test-results
path: app/build/reports/androidTests/connected


здесь:
adb: no devices/emulators found
Waiting for emulator to boot...
adb: no devices/emulators found
Waiting for emulator to boot...
adb: no devices/emulators found
Emulator boot timed out after 300 seconds.
error: could not connect to TCP port 5554: Connection refused
Error: Process completed with exit code 1.


Подробнее здесь: https://stackoverflow.com/questions/791 ... or-ui-test
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Android»