Я запускаю тест пользовательского интерфейса в 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
GitHub Actions Android-эмулятор не загружается на macOS Runner для теста пользовательского интерфейса ⇐ Android
Форум для тех, кто программирует под Android
1730428083
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.
Подробнее здесь: [url]https://stackoverflow.com/questions/79146781/github-actions-android-emulator-fails-to-boot-on-macos-runner-for-ui-test[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия