[OSX - Ruby ]Тестирование Web Applications (not native) на реальных девайсах

Доброго времени суток,
Интересует именно использование аппиума для тестирования сайтов на реальных девайсах. Может кто занимается и может поделиться опытом и скинуть парочку полезных ресурсов. Thanks in advance!

Укажите капабилити browserName нужный вам

пример для мобильного хрома на андроиде:

        DesiredCapabilities caps = new DesiredCapabilities();
        caps.SetCapability("browserName", "Chrome");
        caps.SetCapability("platformName", "Android");
        caps.SetCapability("platformVersion", "4.4");
        caps.SetCapability("deviceName", "S4");

Для IOS сделайте в соответствии с документацией

http://appium.io/slate/en/master/?ruby#appium-server-capabilities
Если конечно у вас не гибридное приложение, а именно вам надо в mobile safari.

P.S. Пробовал в прошлом году запустить на мобильной сафари тесты, но у аппиума был баг для IOS 8.х . Надеюсь уже поправили и все должно быть хорошо в последних версиях

Скажите. а если возможность открыть не chrome на Android. а firefox, т.е передать
capabilites.SetCapability(“browserName”, “firefox”);
Спасибо)

Вот что в документации по этому поводу:

Mobile web support: Yes (but not when using Selendroid backend). Automation is effected using a bundled Chromedriver server as a proxy. With 4.2 and 4.3, automation works on official Chrome browser or Chromium only. With 4.4+, automation also works on the built-in “Browser” app. Chrome/Chromium/Browser must already be installed on the device under test. See the mobile web doc for instructions.

Спасибо, за ответ.
Получается, что можно использовать только уже встроенный в сhromedriver.
Тогда такой вопрос: можно ли запустить браузер firefox или opera на реальном устройстве?

С помощью appium точно нет( если только у вас не стоит задача тестить браузер как native app)
Если вам нужно автоматизировать именно мобильный сайт, то на данный момент только mobile chrome, ибо про других не слышал чтобы они делали драйвер для своих мобильных браузеров.

Да, все верно, как раз-таки стоит задача тестировать браузер как native app)

Ну а в чем проблема?)
Прописываете в капабилити имя прилаги и имя стартового активити и погнали автоматизировать)

Я в этом новичок, можно чуть подробнее, с примером кода, если не затруднит)

Ну как то так:

       DesiredCapabilities caps = new DesiredCapabilities();
        caps.SetCapability("platformName", "ANDROID");
        caps.SetCapability("appPackage", "{PackageName вашего приложения}");
        caps.SetCapability("appActivity", "{Класс активити вашего приложения}");

Спасибо)), тут вопрос, мое приложения уже на устройстве и код такой:

  capabilites.SetCapability("appPackage", "com.opera.browser");
  capabilites.SetCapability("appActivity", "com.opera.Opera")

К сожалению, ранее установленное приложение Opera (c play market) удаляется и все;

Как это удаляется?
Может быть ваше тестовое приложение просто перезатирает уже установленное с маркета?

Да. удаляется.
Заранее прошу прощения за эту простыню, но я уже не знаю что делать

info: --> POST /wd/hub/session {“desiredCapabilities”:{“device”:“Android”,“deviceName”:“HTC One mini 2”,“platformName”:“Android”,“platformVersion”:“4.2.2”,“appPackage”:“com.opera.browser”,“appActivity”:“com.opera.Opera”}}
info: Client User-Agent string: undefined
info: [debug] The following desired capabilities were provided, but not recognized by appium. They will be passed on to any other services running on this server. : device
info: [debug] Didn’t get app but did get Android package, will attempt to launch it on the device
info: [debug] Creating new appium session 404f4b35-e093-46a5-bf4d-18b46653cab8
info: Starting android appium
info: [debug] Getting Java version
info: Java version is: 1.8.0_45
info: [debug] Checking whether adb is present
info: [debug] Using adb from C:\Users\Userrr\AppData\Local\Android\android-sdk\platform-tools\adb.exe
warn: No app capability, can’t parse package/activity
info: [debug] Set chromedriver binary as: C:\Appium\node_modules\appium\build\chromedriver\windows\chromedriver.exe
info: [debug] Using fast reset? false
info: [debug] Preparing device for session
info: [debug] Not checking whether app is present since we are assuming it’s already on the device
info: Retrieving device
info: [debug] Trying to find a connected android device
info: [debug] Getting connected devices…
info: [debug] executing cmd: C:\Users\Userrr\AppData\Local\Android\android-sdk\platform-tools\adb.exe devices
info: [debug] 1 device(s) connected
info: Found device SH47WWR01299
info: [debug] Setting device id to SH47WWR01299
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: C:\Users\Userrr\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s SH47WWR01299 wait-for-device
info: [debug] executing cmd: C:\Users\Userrr\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s SH47WWR01299 shell “echo ‘ready’”
info: [debug] Starting logcat capture
info: [debug] Getting device API level
info: [debug] executing cmd: C:\Users\Userrr\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s SH47WWR01299 shell “getprop ro.build.version.sdk”
info: [debug] Device is at API Level 19
info: Device API level is: 19
info: [debug] Extracting strings for language: default
info: [debug] Apk doesn’t exist locally
info: [debug] Could not get strings, but it looks like we had an old strings file anyway, so ignoring
info: [debug] executing cmd: C:\Users\Userrr\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s SH47WWR01299 shell “rm -rf /data/local/tmp/strings.json”
info: [debug] Uninstalling com.opera.browser
info: [debug] executing cmd: C:\Users\Userrr\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s SH47WWR01299 shell “am force-stop com.opera.browser”
info: [debug] executing cmd: C:\Users\Userrr\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s SH47WWR01299 uninstall com.opera.browser
info: [debug] App was not uninstalled, maybe it wasn’t on device?
info: [debug] Skipping install since we launched with a package instead of an app path
info: [debug] Forwarding system:4724 to device:4724
info: [debug] executing cmd: C:\Users\Userrr\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s SH47WWR01299 forward tcp:4724 tcp:4724
info: [debug] Pushing appium bootstrap to device…
info: [debug] executing cmd: C:\Users\Userrr\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s SH47WWR01299 push “C:\Appium\node_modules\appium\build\android_bootstrap\AppiumBootstrap.jar” /data/local/tmp/
info: [debug] Pushing settings apk to device…
info: [debug] executing cmd: C:\Users\Userrr\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s SH47WWR01299 install “C:\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk”
info: [debug] Pushing unlock helper app to device…
info: [debug] executing cmd: C:\Users\Userrr\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s SH47WWR01299 install “C:\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk”
info: Starting App
info: [debug] Attempting to kill all ‘uiautomator’ processes
info: [debug] Getting all processes with ‘uiautomator’
info: [debug] executing cmd: C:\Users\Userrr\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s SH47WWR01299 shell “ps ‘uiautomator’”
info: [debug] No matching processes found
info: [debug] Running bootstrap
info: [debug] spawning: C:\Users\Userrr\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s SH47WWR01299 shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap -e pkg com.opera.browser -e disableAndroidWatchers false
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
info: [debug] [UIAUTOMATOR STDOUT] io.appium.android.bootstrap.Bootstrap:
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 1
info: [debug] [BOOTSTRAP] [debug] Socket opened on port 4724
info: [debug] [BOOTSTRAP] [debug] Appium Socket Server Ready
info: [debug] [BOOTSTRAP] [debug] Loading json…
info: [debug] [BOOTSTRAP] [debug] Registered crash watchers.
info: [debug] Waking up device if it’s not alive
info: [debug] Pushing command to appium work queue: [“wake”,{}]
info: [debug] [BOOTSTRAP] [debug] Client connected
info: [debug] executing cmd: C:\Users\Userrr\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s SH47WWR01299 shell “dumpsys window”
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“wake”,“params”:{}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: wake
info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:true,“status”:0}
info: [debug] Screen already unlocked, continuing.
info: [debug] Pushing command to appium work queue: [“getDataDir”,{}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“getDataDir”,“params”:{}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: getDataDir
info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:"/data/local/tmp",“status”:0}
info: [debug] dataDir set to: /data/local/tmp
info: [debug] Pushing command to appium work queue: [“compressedLayoutHierarchy”,{“compressLayout”:false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“compressedLayoutHierarchy”,“params”:{“compressLayout”:false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: compressedLayoutHierarchy
info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:false,“status”:0}
info: [debug] Getting device API level
info: [debug] executing cmd: C:\Users\Userrr\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s SH47WWR01299 shell “getprop ro.build.version.sdk”
info: [debug] Device is at API Level 19
info: [debug] executing cmd: C:\Users\Userrr\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s SH47WWR01299 shell “am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n com.opera.browser/com.opera.Opera”
info: [debug] We tried to start an activity that doesn’t exist, retrying with . prepended to activity
info: [debug] Getting device API level
info: [debug] executing cmd: C:\Users\Userrr\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s SH47WWR01299 shell “getprop ro.build.version.sdk”
info: [debug] Device is at API Level 19
info: [debug] executing cmd: C:\Users\Userrr\AppData\Local\Android\android-sdk\platform-tools\adb.exe -s SH47WWR01299 shell “am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n com.opera.browser/.com.opera.Opera”
error: Activity used to start app doesn’t exist or cannot be launched! Make sure it exists and is a launchable activity
info: [debug] Stopping logcat capture
info: [debug] Logcat terminated with code null, signal SIGTERM
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“shutdown”}
info: [debug] [BOOTSTRAP] [debug] Got command of type SHUTDOWN
info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:“OK, shutting down”,“status”:0}
info: [debug] [BOOTSTRAP] [debug] Closed client connection
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=.
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 0
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
info: [debug] [UIAUTOMATOR STDOUT] Test results for WatcherResultPrinter=.
info: [debug] [UIAUTOMATOR STDOUT] Time: 3.4
info: [debug] [UIAUTOMATOR STDOUT] OK (1 test)
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: -1
info: [debug] Sent shutdown command, waiting for UiAutomator to stop…
info: [debug] UiAutomator shut down normally
error: Failed to start an Appium session, err was: Error: Activity used to start app doesn’t exist or cannot be launched! Make sure it exists and is a launchable activity
info: [debug] Cleaning up android objects
info: [debug] Cleaning up appium session
info: [debug] Error: Activity used to start app doesn’t exist or cannot be launched! Make sure it exists and is a launchable activity
at [object Object]. (C:\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:1146:21)
at [object Object]. (C:\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:180:9)
at ChildProcess.exithandler (child_process.js:635:7)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Process.ChildProcess._handle.onexit (child_process.js:810:5)
info: [debug] Responding to client with error: {“status”:33,“value”:{“message”:“A new session could not be created. (Original error: Activity used to start app doesn’t exist or cannot be launched! Make sure it exists and is a launchable activity)”,“origValue”:“Activity used to start app doesn’t exist or cannot be launched! Make sure it exists and is a launchable activity”},“sessionId”:null}

А какая версия Appium?
На чем пишите тесты?

Версия Appium 1.4.0.0
Тесты пишу на С#
Спасибо за ваше время.

А попробуйте предыдущую версию 1.3.7.2
Если вы дополнительных параметров при запуске аппиума не указываете или в тестах не вызываете какой-нибудь скрипт для adb с удалением, то очень похоже на дефект новой версии аппиума

Попробую) Спасибо вам !

Нужно запускать Appium с опцией --no-reset – тогда не будет удалять приложение.

P.S. В GUI тоже аналогичная настройка есть.

Спасибо, именно такое решение уже найдено.