UI tests on travis CI - Unable to create a new remote session

Hi guys,
Trying run my Ui test for mobile application using selenium & appium but when maven start all suite I can see this error in log

Driver info: driver.version: AndroidDriver
remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: Error executing adbExec. Original error: 'Command '/home/travis/android-sdk-linux/platform-tools/adb -P 5037 -s emulator-5554 shell pm install -g /data/local/tmp/appium_cache/12bb63270ecd4315cfaaa8d8202b809bbfccca11.apk' timed out after 50000ms'. Try to increase the 50000ms adb execution timeout represented by 'androidInstallTimeout' capability
    at getResponseForW3CError (/home/travis/.nvm/versions/node/v8.12.0/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/errors.js:826:9)
    at asyncHandler (/home/travis/.nvm/versions/node/v8.12.0/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:447:37)
    at <anonymous>
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'travis-job-iot-insurance-mobile-app-ui-18700087', ip: '172.17.0.4', os.name: 'Linux', os.arch: 'amd64', os.version: '4.19.52', java.version: '1.8.0_191'
Driver info: driver.version: AndroidDriver
    at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:208)
    at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:217)
    at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
    at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)

and in appium logs

[UiAutomator2] Unable to force stop app: Error executing adbExec. Original error: 'Command '/home/travis/android-sdk-linux/platform-tools/adb -P 5037 -s emulator-5554 shell am force-stop com.x' timed out after 50000ms'. Try to increase the 50000ms adb execution timeout represented by 'adbExecTimeout' capability
[UiAutomator2] Unable to remove port forward 'Error executing adbExec. Original error: 'Command '/home/travis/android-sdk-linux/platform-tools/adb -P 5037 -s emulator-5554 forward --remove tcp\:8200' exited with code 1'; Stderr: 'adb: error: listener 'tcp:8200' not found'; Code: '1''

my .travis.yml looks like

services:
   - xvfb

before_script:
    - appium --log-level info > appium_log.txt &
    - echo no | avdmanager create avd --force -n test -k "system-images;android-25;google_apis;armeabi-v7a"
    - export ANDROID_SDK_ROOT=~/android-sdk-linux
    - export DISPLAY=:99.0
    - $ANDROID_HOME/emulator/emulator -avd test -gpu off -noaudio -wipe-data &
    - sleep 120 


script:
    - mvn -B test -X

Results :
`Failed tests:   createAppiumDriver(appium.tests.eula.TestVerifyEula): Unable to create a new remote session. Please check the server log for more details. Original error: An unknown server-side error occurred while processing the command. Original error: Error executing adbExec. Original error: 'Command '/home/travis/android-sdk-linux/platform-tools/adb -P 5037 -s emulator-5554 shell pm install -g /data/local/tmp/appium_cache/12bb63270ecd4315cfaaa8d8202b809bbfccca11.apk' timed out after 50000ms'. Try to increase the 50000ms adb execution timeout represented by 'androidInstallTimeout' capability(..`

All execution is fine on my local machine. I was playing around with androidInstallTimeout but no luck.

Any idea why I have this issue?

Regards

Hi guys, still can not get this working,

Is travis supports run android emulator with GUI. Without this parameter ```
-no-window

Please link to the build. Copy-pasting things gives incomplete information.

Hi I can not link to build it is private. What information do you need?

Full build log and the build scripts in your codebase – to see what exact logic you are running and what it produces and look for anything suspicious. Based on Run an android emulator on a headless server - Stack Overflow, the commands you run look okay so I cannot point out any flaws from the top of my head.

If the build is private, you can still give the build link but only Travis support staff will be able to open it. I cannot help you then, I’m afraid.

@native-api so sorry for delay

this is my build script :

language: java
sudo: required
dist: trusty
jdk: openjdk8

services:
    - xvfb

cache:
    directories:
        - $HOME/.m2

before_install:
    - echo $JAVA_HOME
    - export ANDROID_HOME=~/android-sdk-linux
    - wget -q "https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip" -O android-sdk-tools.zip
    - unzip -q android-sdk-tools.zip -d ${ANDROID_HOME}
    - rm android-sdk-tools.zip
    - PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/platform-tools
    - mkdir -p ~/.android
    - touch ~/.android/repositories.cfg
    - yes | sdkmanager --licenses
    - yes | sdkmanager "emulator" "tools" "platform-tools" > /dev/null
    - yes | sdkmanager "platforms;android-28" > /dev/null
    - yes | sdkmanager "build-tools;28.0.3" > /dev/null
    - yes | sdkmanager "system-images;android-22;google_apis;armeabi-v7a" > /dev/null
    - npm install -g appium > /dev/null
    - sudo apt-get install -y --no-install-recommends lib32stdc++6 libstdc++6 > /dev/null

before_script:
    - wget -O somaapp.apk https://somapp
    - cd -
    - appium --log-level debug > appium_log.txt &
    - echo no | avdmanager create avd --force -n test -k "system-images;android-22;google_apis;armeabi-v7a"
    - export ANDROID_SDK_ROOT=~/android-sdk-linux
    - export DISPLAY=:99.0
    - adb devices
    - $ANDROID_HOME/emulator/emulator -avd test -gpu off -no-accel &
    - sleep 60

script: 
    - mvn -B test -X
    
after_script:
    - kill -9 $(ps -A | grep -m1 appium | awk '{print $1}')
    - kill -9 $(ps -A | grep -m1 qemu | awk '{print $1}')
    - avdmanager delete avd -n test

How can I share logs for that? I can not paste here because is too long :frowning:

My point on this build is that I want to run Selenium UI tests, and I need to start emulator without parameter “-no-window”

Regards

According to https://docs.travis-ci.com/user/gui-and-headless-browsers/ , service: xvfb is only available since Xenial. In my test build with your config, I got an error starting it.

Maybe you can install and configure it manually, e.g. as per http://ithubinfo.blogspot.com/2013/11/how-to-install-and-configure-xvfb-in.html

You can paste them to e.g. pastebin.com.
Or just give a build link and let the support staff deal with it.

@native-api

I think that xvfb is working good. I’ve created docker image and use the same command to run xvfb and success output command from docker is exactly the same like here in Travis. Anyway I can try to install this manually instead of use service.

Also with the same commands I can execute and test in Docker on vm or local success.

Please have a look it is link to build
https://travis.ibm.com/IoT-Insurance/mobile-app-ui-automation/builds/19359149

@native-

How can I inform support team?

Either wait for any of them to arrive here – they are active on this forum – or drop an e-mail to support@travis-ci.com or enterprise support.

1 Like

Perhaps, to solve this problem, you should turn to experts who specialize in mobile software development https://tech-stack.com/services/mobile-app-development