Coder Social home page Coder Social logo

appium's Introduction

Zebrunner CE (Community Edition) is a Test Automation Management Tool for continuous testing and continuous deployment. It allows you to run various kinds of tests and gain successive levels of confidence in the code quality. It is built in accordance with Infrastructure as Code processes.

Zebrunner is integrated by default with carina-core open source TestNG framework and uses Jenkins as a CI Tool.

It is built on top of popular docker solutions, it includes Postgres database, Zebrunner Reporting, Jenkins Master/Slaves Nodes, Selenium Hub, Mobile Device Farm (MCloud), SonarQube etc.

All components are deployed under NGINX WebServer which can be configured in a fully secured environment

Zebrunner subcomponents all together can be used as an effective Test Automation infrastructure for test automation development, execution, management, etc.

Support Zebrunner CE

Enjoy using Zebrunner Reporting in your testing process! Feel free to support the development with a donation for the next improvements.

Zebrunner

Hardware requirements

Requirements
Operating System Ubuntu 16.04 - 21.10
Linux CentOS 7+
Amazon Linux 2
CPU 8+ Cores
Memory 32 Gb RAM
Free space SSD 128Gb+ of free space

Software requirements

  • Installed Docker v19+

  • Installed Docker compose plugin v2.20.3+

  • Install git 2.20.0+

Initial setup

Visit Zebrunner Guide for detailed installation and configuration instructions.

  1. Clone Zebrunner CE recursively and launch setup procedure:

    git clone --recurse-submodule https://github.com/zebrunner/community-edition.git && cd community-edition && ./zebrunner.sh setup
    

    Provide required details and start services.

  2. After the startup, the following components might be available:

    Use your host address instead of hostname!

Components URL
Zebrunner Reporting http://hostname
Jenkins http://hostname/jenkins
SonarQube http://hostname/sonarqube
Web Selenium Hub http://hostname/selenoid/wd/hub
Mobile Selenium Hub http://hostname/mcloud/wd/hub
Mobile SmartTest Farm http://hostname/stf

admin/changeit crendetials should be used for Reporting and Jenkins, admin/admin for SonarQube.

Documentation and free support

License

Code - Apache Software License v2.0

Documentation and Site - Creative Commons Attribution 4.0 International License

appium's People

Contributors

akamarouski avatar avabishchevich avatar azarouski avatar dhreben avatar dmtgrinevich avatar platonoff-dev avatar sergeizagriychuk avatar szagriychuk-ua avatar vavadikb avatar vdelendik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

appium's Issues

provide information about device/sessionId in negative cases

we are able to record pre-condition artifacts (video and logs). To be able to track later these artifacts for negative cases we have to provide sessionId, udid and maybe device name to the client in response.
Feature is useful to review and analyze infrastructure issue

Amazon error : An unknown server-side error occurred while processing the command.

remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: Cannot get file content-length from https://qaprosoft.s3-us-west-2.amazonaws.com/carinademoexample.apk: timeout of 5000ms exceeded
18:05:09      at getResponseForW3CError (/usr/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/errors.js:804:9)
18:05:09      at asyncHandler (/usr/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:380:37)
18:05:09  org.openqa.selenium.WebDriverException: org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Cannot get file content-length from https://qaprosoft.s3-us-west-2.amazonaws.com/carinademoexample.apk: timeout of 5000ms exceeded
18:05:09  Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
18:05:09  System info: host: '0601d3bd5ba7', ip: '172.24.0.15', os.name: 'Linux', os.arch: 'amd64', os.version: '4.14.177-139.254.amzn2.x86_64', java.version: '11.0.12'
18:05:09  Driver info: driver.version: AndroidDriver
18:05:09  remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: Cannot get file content-length from https://qaprosoft.s3-us-west-2.amazonaws.com/carinademoexample.apk: timeout of 5000ms exceeded
18:05:09      at getResponseForW3CError (/usr/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/errors.js:804:9)
18:05:09      at asyncHandler (/usr/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:380:37)
18:05:09  	at com.qaprosoft.carina.core.foundation.webdriver.listener.EventFiringAppiumCommandExecutor.execute(EventFiringAppiumCommandExecutor.java:182)
18:05:09  	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
18:05:09  	at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:41)
18:05:09  	at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
18:05:09  	at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
18:05:09  	at org.openqa.selenium.remote.RemoteWebDriver.startSession$original$E3eaHKlb(RemoteWebDriver.java:213)
18:05:09  	at org.openqa.selenium.remote.RemoteWebDriver.startSession$original$E3eaHKlb$accessor$Y5opecSd(RemoteWebDriver.java)
18:05:09  	at org.openqa.selenium.remote.RemoteWebDriver$auxiliary$AuatWXBs.run(Unknown Source)
18:05:09  	at com.zebrunner.agent.core.webdriver.StartSessionInterceptor.onSessionStart(StartSessionInterceptor.java:35)
18:05:09  	at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java)
18:05:09  	at io.appium.java_client.AppiumDriver.startSession(AppiumDriver.java:338)
18:05:09  	at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
18:05:09  	at io.appium.java_client.DefaultGenericMobileDriver.<init>(DefaultGenericMobileDriver.java:37)
18:05:09  	at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:89)
18:05:09  	at io.appium.java_client.android.AndroidDriver.<init>(AndroidDriver.java:86)
18:05:09  	at com.qaprosoft.carina.core.foundation.webdriver.core.factory.impl.MobileFactory.create(MobileFactory.java:89)
18:05:09  	at com.qaprosoft.carina.core.foundation.webdriver.core.factory.DriverFactory.create(DriverFactory.java:78)
18:05:09  	at com.qaprosoft.carina.core.foundation.webdriver.IDriverPool.createDriver(IDriverPool.java:387)
18:05:09  	at com.qaprosoft.carina.core.foundation.webdriver.IDriverPool.getDriver(IDriverPool.java:129)
18:05:09  	at com.qaprosoft.carina.core.foundation.webdriver.IDriverPool.getDriver(IDriverPool.java:85)
18:05:09  	at com.qaprosoft.carina.core.foundation.webdriver.IDriverPool.getDriver(IDriverPool.java:72)
18:05:09  	at com.qaprosoft.carina.demo.MobileSampleTest.testLoginUser(MobileSampleTest.java:45)
18:05:09  	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
18:05:09  	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
18:05:09  	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
18:05:09  	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
18:05:09  	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:133)
18:05:09  	at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:598)
18:05:09  	at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:173)
18:05:09  	at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
18:05:09  	at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:824)
18:05:09  	at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:146)
18:05:09  	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
18:05:09  	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
18:05:09  	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
18:05:09  	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
18:05:09  	at java.base/java.lang.Thread.run(Thread.java:829)
18:05:09  Caused by: org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Cannot get file content-length from https://qaprosoft.s3-us-west-2.amazonaws.com/carinademoexample.apk: timeout of 5000ms exceeded
18:05:09  Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
18:05:09  System info: host: '0601d3bd5ba7', ip: '172.24.0.15', os.name: 'Linux', os.arch: 'amd64', os.version: '4.14.177-139.254.amzn2.x86_64', java.version: '11.0.12'
18:05:09  Driver info: driver.version: AndroidDriver
18:05:09  remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: Cannot get file content-length from https://qaprosoft.s3-us-west-2.amazonaws.com/carinademoexample.apk: timeout of 5000ms exceeded
18:05:09      at getResponseForW3CError (/usr/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/errors.js:804:9)
18:05:09      at asyncHandler (/usr/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:380:37)
18:05:09  	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
18:05:09  	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
18:05:09  	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
18:05:09  	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
18:05:09  	at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$errorHandler$0(W3CHandshakeResponse.java:62)
18:05:09  	at org.openqa.selenium.remote.HandshakeResponse.lambda$getResponseFunction$0(HandshakeResponse.java:30)
18:05:09  	at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:126)
18:05:09  	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
18:05:09  	at java.base/java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
18:05:09  	at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:127)
18:05:09  	at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:502)
18:05:09  	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:488)
18:05:09  	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
18:05:09  	at java.base/java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150)
18:05:09  	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
18:05:09  	at java.base/java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:543)
18:05:09  	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:128)
18:05:09  	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:74)
18:05:09  	at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:136)
18:05:09  	at com.qaprosoft.carina.core.foundation.webdriver.listener.EventFiringAppiumCommandExecutor.execute(EventFiringAppiumCommandExecutor.java:156)
18:05:09  	... 36 more


2022-01-03 15:05:18:212 - [debug] [UiAutomator2] Deleting UiAutomator2 session
2022-01-03 15:05:18:214 - [debug] [BaseDriver] Event 'newSessionStarted' logged at 1641222318214 (07:05:18 GMT-0800 (Pacific Standard Time))
2022-01-03 15:05:18:230 - [debug] [W3C] Encountered internal error running command: Error: Cannot get file content-length from https://qaprosoft.s3-us-west-2.amazonaws.com/carinademoexample.apk: timeout of 5000ms exceeded
2022-01-03 15:05:18:230 - [debug] [W3C] at getFileContentLength (/usr/lib/node_modules/appium/node_modules/appium-base-driver/build/lib/basedriver/....../lib/basedriver/mcloud-utils.js:59:15)
2022-01-03 15:05:18:230 - [debug] [W3C] at processTicksAndRejections (internal/process/task_queues.js:97:5)
[debug] [AppiumEntryPoint] isStarted:
[debug] [AppiumEntryPoint] isFailed:


iOS devices haven't valid platformVersion value in selenium grid

empty values are registered instead of validplatformVersion for iOS devices on mcloud-grid:

cat nodeconfig.json
{
  "capabilities":
      [
        {
          "maxInstances": 1,
          "deviceName": "iPhone_X",
          "deviceType": "Phone",
          "platformName":"IOS",
          "platformVersion":"",
          "udid": "36..bb",
          "adb_port": 7482,
          "proxy_port": 7483,
          "automationName": "XCUITest"
        }
      ],
  "configuration":
  {
    "proxy": "com.zebrunner.mcloud.grid.MobileRemoteProxy",
    "url":"http://demo.zebrunner.farm:7481/wd/hub",
    "host": "demo.zebrunner.farm",
    "port": 7481,
    "hubHost": "mcloud-grid",
    "hubPort": 4444,
    "maxSession": 1,
    "register": true,
    "registerCycle": 5000,
    "cleanUpCycle": 5000,
    "timeout": 180,
    "browserTimeout": 0,
    "nodeStatusCheckTimeout": 5000,
    "nodePolling": 5000,
    "role": "node",
    "unregisterIfStillDownAfter": 60000,
    "downPollingLimit": 2,
    "debug": false,
    "servlets" : [],
    "withoutServlets": [],
    "custom": {}
  }
}

generate defaultcapabilities.json for android devices as well

it has sense to review below artifacts and register them as defaultcapabilities:

        {
          "maxInstances": 1,
          "deviceName": "${DEVICE_NAME}",
          "deviceType": "${DEVICETYPE}",
          "platformName":"${PLATFORM_NAME^^}",
          "platformVersion":"${PLATFORM_VERSION}",
          "udid": "${DEVICE_UDID}",
          "adb_port": ${ADB_PORT},
          "proxy_port": ${PROXY_PORT},
          "automationName": "${AUTOMATION_NAME}"
        }

parse platformVesrion only if device is paired

do startup verification to have valid platformVersion

[03/01/2022 05:11:42] populating device info
{"err":"Device '3a33c3122eb111c4fe3411c3a3f1bdeff0049b59' not found. Is it attached to the machine?","level":"fatal","msg":"error getting devicelist","time":"2022-01-03T05:11:42-08:00"}
[03/01/2022 05:11:42] Pair device 3a33c3122eb111c4fe3411c3a3f1bdeff0049b59
{"err":"Device '3a33c3122eb111c4fe3411c3a3f1bdeff0049b59' not found. Is it attached to the machine?","level":"fatal","msg":"error getting devicelist","time":"2022-01-03T05:11:42-08:00"}
ERROR! Unable to pair iOS device!
[03/01/2022 05:11:44] populating device info
{"err":"Device '3a33c3122eb111c4fe3411c3a3f1bdeff0049b59' not found. Is it attached to the machine?","level":"fatal","msg":"error getting devicelist","time":"2022-01-03T05:11:44-08:00"}
[03/01/2022 05:11:44] Pair device 3a33c3122eb111c4fe3411c3a3f1bdeff0049b59
{"err":"Device '3a33c3122eb111c4fe3411c3a3f1bdeff0049b59' not found. Is it attached to the machine?","level":"fatal","msg":"error getting devicelist","time":"2022-01-03T05:11:44-08:00"}
ERROR! Unable to pair iOS device!
[03/01/2022 05:11:46] populating device info
{"err":"Device '3a33c3122eb111c4fe3411c3a3f1bdeff0049b59' not found. Is it attached to the machine?","level":"fatal","msg":"error getting devicelist","time":"2022-01-03T05:11:46-08:00"}
[03/01/2022 05:11:46] Pair device 3a33c3122eb111c4fe3411c3a3f1bdeff0049b59
{"err":"Device '3a33c3122eb111c4fe3411c3a3f1bdeff0049b59' not found. Is it attached to the machine?","level":"fatal","msg":"error getting devicelist","time":"2022-01-03T05:11:46-08:00"}
ERROR! Unable to pair iOS device!
[03/01/2022 05:11:48] populating device info
{"err":"could not retrieve PairRecord with error: ReadPair failed with errorcode '2', is the device paired?","level":"fatal","msg":"failed getting info","time":"2022-01-03T05:11:48-08:00"}
[03/01/2022 05:11:48] Pair device 3a33c3122eb111c4fe3411c3a3f1bdeff0049b59
{"level":"info","msg":"Successfully paired 3a33c3122eb111c4fe3411c3a3f1bdeff0049b59","time":"2022-01-03T05:11:48-08:00"}
[03/01/2022 05:11:48] Mount /opt/zebrunner/DeveloperDiskImages//DeveloperDiskImage.dmg
{"level":"fatal","msg":"there is already a developer image mounted, reboot the device if you want to remove it. aborting.","time":"2022-01-03T05:11:49-08:00"}
[03/01/2022 05:11:49] Installing WDA application on device
{"appPath":"/opt/WebDriverAgent.ipa","device":"3a33c3122eb111c4fe3411c3a3f1bdeff0049b59","level":"info","msg":"installing","time":"2022-01-03T05:11:49-08:00"}
{"level":"info","msg":"installing","percentComplete":5,"status":"CreatingStagingDirectory","time":"2022-01-03T05:11:50-08:00"}
{"level":"info","msg":"installing","percentComplete":15,"status":"ExtractingPackage","time":"2022-01-03T05:11:50-08:00"}
{"level":"info","msg":"installing","percentComplete":20,"status":"InspectingPackage","time":"2022-01-03T05:11:50-08:00"}
{"level":"info","msg":"installing","percentComplete":20,"status":"TakingInstallLock","time":"2022-01-03T05:11:50-08:00"}
{"level":"info","msg":"installing","percentComplete":30,"status":"PreflightingApplication","time":"2022-01-03T05:11:50-08:00"}
{"level":"info","msg":"installing","percentComplete":30,"status":"InstallingEmbeddedProfile","time":"2022-01-03T05:11:50-08:00"}
{"level":"info","msg":"installing","percentComplete":40,"status":"VerifyingApplication","time":"2022-01-03T05:11:50-08:00"}
{"level":"info","msg":"installing","percentComplete":50,"status":"CreatingContainer","time":"2022-01-03T05:11:50-08:00"}
{"level":"info","msg":"installing","percentComplete":60,"status":"InstallingApplication","time":"2022-01-03T05:11:50-08:00"}
{"level":"info","msg":"installing","percentComplete":70,"status":"PostflightingApplication","time":"2022-01-03T05:11:50-08:00"}
{"level":"info","msg":"installing","percentComplete":80,"status":"SandboxingApplication","time":"2022-01-03T05:11:50-08:00"}
{"level":"info","msg":"installing","percentComplete":90,"status":"GeneratingApplicationMap","time":"2022-01-03T05:11:50-08:00"}
{"level":"info","msg":"installation successful","time":"2022-01-03T05:11:50-08:00"}
[03/01/2022 05:11:50] Starting WebDriverAgent application on port 8100
detecting WDA_HOST ip address...

simplify logic for `retain_task=false` use-case

In case of retaining we have to collect all appium and screenredord artifacts as is without any intermidiate copying/modification/analysis.
i.e. :

  1. produce recording with video_x/mp4 naming.
  2. don't analyze appium log and session closure - wait till container is stopped

So the idea to minimize all custom interventions for such use-case as much as possible

run video concatenation only if needed!

for most pf the ui tests 180s is adequate duration so potentially 80-90% can be covered by single video file.
so let's handle this use-case and don't start ffmpeg concatenation at all.
Simple file renaming should happen)

investigate possibilities to screenrecord longer then for 180 sec

android screenrecord utility support screenrecording only upto 180 sec and exit after that

--time-limit TIME
    Set the maximum recording time, in seconds.  Default / maximum is 180.

interesting approach using hexeditor and without recompiling android can be found here:
https://stackoverflow.com/questions/21938948/how-to-increase-time-limit-of-adb-screen-record-of-android-kitkat/22941394

with full sources recompilation:
https://www.py4u.net/discuss/633945

or even already prepared bash script:

set -e

# Usage:
# bash ./capture-screen.sh
# bash ./capture-screen.sh -s 192.168.1.10

ADB_FLAGS="$@"

CAPTURE_BITRATE=2000000
CAPTURE_HEIGHT=720
CAPTURE_WIDTH="$((($CAPTURE_HEIGHT / 9 * 16)))" # automatically calculate width

# this call will fail if no single device could be selected
adb ${ADB_FLAGS} shell uptime

screenStream() {
  while true; do
    adb ${ADB_FLAGS} exec-out screenrecord --output-format=h264 --bit-rate ${CAPTURE_BITRATE} --size "${CAPTURE_WIDTH}x${CAPTURE_HEIGHT}" -
  done
}

screenStream | ffplay -hide_banner -framerate 60 -framedrop -f h264 -i -

cut initial frames in video where appium app starting

for now we have 4-10 sec difference between driver session duration and video recording.
first 4-10 seconds of video recording shows how appium restart it's own application. so it would be great to find a way and don't spend cpu resources for capturing these useless frames. Moreover it should fix mismatch in reporting between both durations

add chromedriver support for redroid emulator

investigate possibility to install latest and/or valid chromedriver inside redroid container

io.appium.java_client.NoSuchContextException: An unknown server-side error occurred while processing the command. Original error: No Chromedriver found that can automate Chrome '83.0.4103'. You could also try to enable automated chromedrivers download server feature. See https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/web/chromedriver.md for more details
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'DELENDIK-XPS', ip: '192.168.2.99', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.11'
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities {app: https://qaprosoft.s3-us-wes..., appPackage: com.solvd.carinademoapplica..., carinaTestRunId: 6cc1c1e6-f021-4cc7-8a25-221..., databaseEnabled: false, desired: {app: https://qaprosoft.s3-us-wes..., carinaTestRunId: 6cc1c1e6-f021-4cc7-8a25-221..., deviceName: ANY, enableVideo: true, enableVnc: true, language: en, locale: US, platformName: android, provider: zebrunner}, deviceApiLevel: 30, deviceManufacturer: unknown, deviceModel: ReDroid, deviceName: android:5555, deviceScreenDensity: 320, deviceScreenSize: 720x1280, deviceUDID: android:5555, enableVideo: true, enableVnc: true, javascriptEnabled: true, language: en, locale: US, locationContextEnabled: false, networkConnectionEnabled: true, pixelRatio: 2, platform: LINUX, platformName: ANDROID, platformVersion: 11, provider: zebrunner, statBarHeight: 48, takesScreenshot: true, viewportRect: {height: 1136, left: 0, top: 48, width: 720}, warnings: {}, webStorageEnabled: false}
Session ID: a2abf0f1-3e70-42c9-98ce-94820cdcd23e
 at io.appium.java_client.AppiumDriver.context(AppiumDriver.java:232)
 at com.qaprosoft.carina.demo.utils.MobileContextUtils.switchMobileContext(MobileContextUtils.java:48)
 at com.qaprosoft.carina.demo.MobileSampleTest.testWebView(MobileSampleTest.java:65)
 at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.base/java.lang.reflect.Method.invoke(Method.java:566)
 at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:132)
 at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:599)
 at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:174)
 at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
 at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:822)
 at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:147)
 at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
 at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
 at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
 at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
 at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: No Chromedriver found that can automate Chrome '83.0.4103'. You could also try to enable automated chromedrivers download server feature. See https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/web/chromedriver.md for more details
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'DELENDIK-XPS', ip: '192.168.2.99', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.11'
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities {app: https://qaprosoft.s3-us-wes..., appPackage: com.solvd.carinademoapplica..., carinaTestRunId: 6cc1c1e6-f021-4cc7-8a25-221..., databaseEnabled: false, desired: {app: https://qaprosoft.s3-us-wes..., carinaTestRunId: 6cc1c1e6-f021-4cc7-8a25-221..., deviceName: ANY, enableVideo: true, enableVnc: true, language: en, locale: US, platformName: android, provider: zebrunner}, deviceApiLevel: 30, deviceManufacturer: unknown, deviceModel: ReDroid, deviceName: android:5555, deviceScreenDensity: 320, deviceScreenSize: 720x1280, deviceUDID: android:5555, enableVideo: true, enableVnc: true, javascriptEnabled: true, language: en, locale: US, locationContextEnabled: false, networkConnectionEnabled: true, pixelRatio: 2, platform: LINUX, platformName: ANDROID, platformVersion: 11, provider: zebrunner, statBarHeight: 48, takesScreenshot: true, viewportRect: {height: 1136, left: 0, top: 48, width: 720}, warnings: {}, webStorageEnabled: false}
Session ID: a2abf0f1-3e70-42c9-98ce-94820cdcd23e
 at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
 at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
 at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
 at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
 at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
 at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
 at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
 at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
 at com.qaprosoft.carina.core.foundation.webdriver.listener.EventFiringAppiumCommandExecutor.execute(EventFiringAppiumCommandExecutor.java:156)
 at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
 at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:41)
 at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
 at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
 at io.appium.java_client.AppiumDriver.context(AppiumDriver.java:229)
 ... 17 more

optimize ffmpeg default video recording caps

let's port default settings we used in mcloud-grid to start video recording for iOS:

            options.put("videoType", "libx264");
            options.put("videoQuality", "medium");
            options.put("videoFps", "10");
            options.put("videoScale", "-2:720");
            options.put("videoType", "libx264");

unable to execute mobile web tests on android/chrome

need re-test mobile web tests on android/chrome to identify if it is common or specific device problem...

logs from one of the rtun is:

2022-01-13 14:07:06:598 - [debug] [Chromedriver] Cleaning this device's adb forwarded port socket connections: RF8...FD
2022-01-13 14:07:06:598 - [debug] [ADB] List forwarding ports
2022-01-13 14:07:06:598 - [debug] [ADB] Running '/root/platform-tools/adb -P 5037 -s RF8...FD forward --list'
2022-01-13 14:07:06:608 - [Chromedriver] Spawning chromedriver with: /usr/lib/node_modules/appium/node_modules/appium-chromedriver/chromedriver/linux/chromedriver_linux64_v96.0.4664.45 --url-base=wd/hub --port=8000 --adb-port=5037 --verbose
2022-01-13 14:07:06:617 - [debug] [Instrumentation] INSTRUMENTATION_RESULT: shortMsg=Process crashed.
2022-01-13 14:07:06:617 - [debug] [Instrumentation] INSTRUMENTATION_CODE: 0
2022-01-13 14:07:06:619 - [debug] [Chromedriver] Chromedriver version: '96.0.4664.45'
2022-01-13 14:07:06:620 - [debug] [WD Proxy] Matched '/status' to command name 'getStatus'
2022-01-13 14:07:06:620 - [debug] [WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8000/wd/hub/status] with no body
2022-01-13 14:07:06:621 - [debug] [WD Proxy] Got response with status 200: {"value":{"build":{"version":"96.0.4664.45 (76e4c1bb2ab4671b8beba3444e61c0f17584b2fc-refs/branch-heads/4664@{#947})"},"message":"ChromeDriver ready for new sessions.","os":{"arch":"x86_64","name":"Linux","version":"5.13.0-23-generic"},"ready":true}}
2022-01-13 14:07:06:621 - [Chromedriver] Starting W3C Chromedriver session with capabilities: {
2022-01-13 14:07:06:621 - [Chromedriver]   "capabilities": {
2022-01-13 14:07:06:621 - [Chromedriver]     "alwaysMatch": {
2022-01-13 14:07:06:621 - [Chromedriver]       "goog:chromeOptions": {
2022-01-13 14:07:06:622 - [Chromedriver]         "androidPackage": "com.android.chrome",
2022-01-13 14:07:06:622 - [Chromedriver]         "androidDeviceSerial": "RF8...FD",
2022-01-13 14:07:06:622 - [Chromedriver]         "extensions": [],
2022-01-13 14:07:06:622 - [Chromedriver]         "args": [
2022-01-13 14:07:06:622 - [Chromedriver]           "--disable-blink-features=BlockCredentialedSubresources",
2022-01-13 14:07:06:622 - [Chromedriver]           "--start-maximized"
2022-01-13 14:07:06:622 - [Chromedriver]         ]
2022-01-13 14:07:06:622 - [Chromedriver]       },
2022-01-13 14:07:06:622 - [Chromedriver]       "pageLoadStrategy": "normal",
2022-01-13 14:07:06:622 - [Chromedriver]       "goog:loggingPrefs": {
2022-01-13 14:07:06:622 - [Chromedriver]         "browser": "ALL"
2022-01-13 14:07:06:622 - [Chromedriver]       }
2022-01-13 14:07:06:622 - [Chromedriver]     }
2022-01-13 14:07:06:622 - [Chromedriver]   }
2022-01-13 14:07:06:622 - [Chromedriver] }
2022-01-13 14:07:06:622 - [debug] [WD Proxy] Matched '/session' to command name 'createSession'
2022-01-13 14:07:06:622 - [debug] [WD Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8000/wd/hub/session] with body: {"capabilities":{"alwaysMatch":{"goog:chromeOptions":{"androidPackage":"com.android.chrome","androidDeviceSerial":"RF8...FD","extensions":[],"args":["--disable-blink-features=BlockCredentialedSubresources","--start-maximized"]},"pageLoadStrategy":"normal","goog:loggingPrefs":{"browser":"ALL"}}}}
2022-01-13 14:07:07:085 - [debug] [Instrumentation] The process has exited with code 0
2022-01-13 14:07:07:135 - [debug] [Instrumentation] io.appium.uiautomator2.server.test.AppiumUiAutomator2Server:
2022-01-13 14:07:07:888 - [debug] [Chromedriver] Webview version: 'Chrome/96.0.4664.104'
2022-01-13 14:07:07:960 - [debug] [WD Proxy] Got response with status 200: {"value":{"capabilities":{"acceptInsecureCerts":false,"browserName":"chrome","browserVersion":"96.0.4664.104","chrome":{"chromedriverVersion":"96.0.4664.45 (76e4c1bb2ab4671b8beba3444e61c0f17584b2fc-refs/branch-heads/4664@{#947})"},"goog:chromeOptions":{"debuggerAddress":"localhost:40533"},"pageLoadStrategy":"normal","platformName":"android","proxy":{},"setWindowRect":false,"strictFileInteractability":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"unhandledPromptBehavior":"dismiss and notify","webauthn:extension:credBlob":false,"webauthn:extension:largeBlob":false,"webauthn:virtualAuthenticators":false},"sessionId":"06d72f77b3e1f872479fdc65a9d20828"}}
2022-01-13 14:07:07:961 - [WD Proxy] Determined the downstream protocol as 'W3C'
2022-01-13 14:07:07:961 - [debug] [Chromedriver] Changed state to 'online'
2022-01-13 14:07:07:983 - [debug] [WD Proxy] Proxying [GET /appium/device/pixel_ratio] to [GET http://127.0.0.1:8200/wd/hub/session/08697a35-9f46-4cf9-873f-00120d07840b/appium/device/pixel_ratio] with no body
2022-01-13 14:07:07:990 - [WD Proxy] socket hang up
2022-01-13 14:07:07:990 - [debug] [UiAutomator2] Deleting UiAutomator2 session
2022-01-13 14:07:07:991 - [debug] [AndroidDriver] Stopping chromedriver for context CHROMIUM
2022-01-13 14:07:07:991 - [debug] [Chromedriver] Changed state to 'stopping'
2022-01-13 14:07:07:993 - [debug] [WD Proxy] Proxying [DELETE /] to [DELETE http://127.0.0.1:8000/wd/hub/session/06d72f77b3e1f872479fdc65a9d20828] with no body
2022-01-13 14:07:08:095 - [debug] [WD Proxy] Got response with status 200: {"value":null}
2022-01-13 14:07:08:100 - [debug] [Chromedriver] Changed state to 'stopped'
2022-01-13 14:07:08:100 - [debug] [UiAutomator2] Deleting UiAutomator2 server session
2022-01-13 14:07:08:101 - [debug] [WD Proxy] Matched '/' to command name 'deleteSession'
2022-01-13 14:07:08:101 - [debug] [WD Proxy] Proxying [DELETE /] to [DELETE http://127.0.0.1:8200/wd/hub/session/08697a35-9f46-4cf9-873f-00120d07840b] with no body
2022-01-13 14:07:08:107 - [WD Proxy] socket hang up
2022-01-13 14:07:08:107 - [UiAutomator2] Did not get confirmation UiAutomator2 deleteSession worked; Error was: UnknownError: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: socket hang up
2022-01-13 14:07:08:108 - [debug] [Logcat] Stopping logcat capture
2022-01-13 14:07:08:110 - [debug] [ADB] Removing forwarded port socket connection: 8200
2022-01-13 14:07:08:110 - [debug] [ADB] Running '/root/platform-tools/adb -P 5037 -s RF8...FD forward --remove tcp:8200'
2022-01-13 14:07:08:140 - [UiAutomator2] Restoring hidden api policy to the device default configuration

investigate possibility to reuse esg-appium for physical mcloud devices

it seems like we could reuse this appium container for real android devices as well (what about iOS?).
for a single appium<->device connection we can reuse REMOTE_ADB wireless connection providing valid tcp host:port:
-e REMOTE_ADB=true -e ANDROID_DEVICES=android:5555 -e REMOTE_ADB_POLLING_SEC=5

also make sense to investigate possibility to reuse different devices for different sessions (under the question due to the security risks).

Pay attention to captu-reartifacts functionality. it seems like for physical devices adb root access is not granted and we have to find optimal way to run adb commands both on emulators and devices (including AndroidTV)

Error: [Appium] Received SIGTERM - shutting down.

Sometimes Appium shows an error [Appium] Received SIGTERM - shutting down, and then does not find an active session.
After that, the WDA application is installed and launched on the device.
The SIGTERM upload method is registered on the device and it starts working as before.
All this happens within 8-10 seconds.

The status in containers also changes.
docker ps -a

Screenshot 2022-02-09 at 13 32 30

Appium v1.22.2


2022-02-09 09:36:27:085 - [Appium] Received SIGTERM - shutting down
2022-02-09 09:36:27:085 - [debug] [Appium] There are no active sessions for cleanup
Exit status: 0
---------------------------------------------------------
processes BEFORE EXIT:
UID          PID    PPID  C STIME TTY          TIME CMD
root           1       0  0 Feb08 pts/0    00:00:00 /bin/bash /root/entry_point.
root          79       1  0 Feb08 pts/0    00:00:00 ios runwda --bundleid=com.fa
root         181       1  0 Feb08 pts/0    00:00:00 [Xvfb]
root       21651       1  0 01:36 pts/0    00:00:00 ps -ef
---------------------------------------------------------
{"deviceList":["0000...01E","00........402E","00............402E","000......03A","000...........801E","0000......801E","000......02E","000.....001E","00........F9402E","000.......02E"]}
DEVICE_UDID: 000............402E
[09/02/2022 01:36:27] Pair device 00.............02E
{"level":"info","msg":"Successfully paired 00...........402E","time":"2022-02-09T01:36:27-08:00"}
[09/02/2022 01:36:27] populating device info
[09/02/2022 01:36:28] Mount /opt/zebrunner/DeveloperDiskImages/14.6/DeveloperDiskImage.dmg
{"level":"warning","msg":"there is already a developer image mounted, reboot the device if you want to remove it. aborting.","time":"2022-02-09T01:36:28-08:00"}
{"image":"/opt/zebrunner/DeveloperDiskImages/14.6/DeveloperDiskImage.dmg","level":"info","msg":"success mounting image","time":"2022-02-09T01:36:28-08:00","udid":"00....................02E"}
[09/02/2022 01:36:28] Installing WDA application on device
{"appPath":"/opt/WebDriverAgent.ipa","device":"0000.................02E","level":"info","msg":"installing","time":"2022-02-09T01:36:28-08:00"}
{"level":"info","msg":"installing","percentComplete":5,"status":"CreatingStagingDirectory","time":"2022-02-09T01:36:29-08:00"}
{"level":"info","msg":"installing","percentComplete":15,"status":"ExtractingPackage","time":"2022-02-09T01:36:29-08:00"}
{"level":"info","msg":"installing","percentComplete":20,"status":"InspectingPackage","time":"2022-02-09T01:36:29-08:00"}
{"level":"info","msg":"installing","percentComplete":20,"status":"TakingInstallLock","time":"2022-02-09T01:36:29-08:00"}
{"level":"info","msg":"installing","percentComplete":30,"status":"PreflightingApplication","time":"2022-02-09T01:36:29-08:00"}
{"level":"info","msg":"installing","percentComplete":30,"status":"InstallingEmbeddedProfile","time":"2022-02-09T01:36:29-08:00"}
{"level":"info","msg":"installing","percentComplete":40,"status":"VerifyingApplication","time":"2022-02-09T01:36:29-08:00"}
{"level":"info","msg":"installing","percentComplete":50,"status":"CreatingContainer","time":"2022-02-09T01:36:29-08:00"}
{"level":"info","msg":"installing","percentComplete":60,"status":"InstallingApplication","time":"2022-02-09T01:36:29-08:00"}
{"level":"info","msg":"installing","percentComplete":70,"status":"PostflightingApplication","time":"2022-02-09T01:36:29-08:00"}
{"level":"info","msg":"installing","percentComplete":80,"status":"SandboxingApplication","time":"2022-02-09T01:36:29-08:00"}
{"level":"info","msg":"installing","percentComplete":90,"status":"GeneratingApplicationMap","time":"2022-02-09T01:36:29-08:00"}
{"level":"info","msg":"installation successful","time":"2022-02-09T01:36:30-08:00"}
[09/02/2022 01:36:30] Starting WebDriverAgent application on port 8100
detecting WDA_HOST ip address...
attempt 1
attempt 2
attempt 3
attempt 4
attempt 5
Detected WDA_HOST ip: 192.168.88.238
WDA_PORT=8100
[09/02/2022 01:36:35] Starting WebDriverAgent 1st session
bundleId: com.apple.springboard
sessionId: 6DD....................A44
[09/02/2022 01:36:35] Stopping 1st default WebDriverAgent session
sessionId: 6DD495F6-8..............DD4A44

add support for mobile web testing on redroid

unable to start web mobile tests on emulator so far

[UiAutomator2] Server packages are not going to be (re)installed
[debug] [UiAutomator2] Waiting up to 30000ms for services to be available
[debug] [ADB] Running '/root/platform-tools/adb -P 5037 -s android:5555 shell pm list instrumentation'
[debug] [UiAutomator2] Instrumentation target 'io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner' is available
[ADB] Adding packages ["io.appium.settings","io.appium.uiautomator2.server","io.appium.uiautomator2.server.test"] to Doze whitelist
[debug] [ADB] Got the following command chunks to execute: [["dumpsys","deviceidle","whitelist","+io.appium.settings",";","dumpsys","deviceidle","whitelist","+io.appium.uiautomator2.server",";","dumpsys","deviceidle","whitelist","+io.appium.uiautomator2.server.test",";"]]
[debug] [ADB] Running '/root/platform-tools/adb -P 5037 -s android:5555 shell dumpsys deviceidle whitelist +io.appium.settings ; dumpsys deviceidle whitelist +io.appium.uiautomator2.server ; dumpsys deviceidle whitelist +io.appium.uiautomator2.server.test ;'
[debug] [UiAutomator2] No app capability. Assuming it is already on the device
[debug] [ADB] Getting install status for com.android.chrome
[debug] [ADB] Running '/root/platform-tools/adb -P 5037 -s android:5555 shell dumpsys package com.android.chrome'
[debug] [ADB] 'com.android.chrome' is not installed
[debug] [UiAutomator2] Deleting UiAutomator2 session
[debug] [UiAutomator2] Deleting UiAutomator2 server session
[debug] [WD Proxy] Matched '/' to command name 'deleteSession'
[UiAutomator2] Did not get confirmation UiAutomator2 deleteSession worked; Error was: UnknownError: An unknown server-side error occurred while processing the command. Original error: Trying to proxy a session command without session id
[debug] [Logcat] Stopping logcat capture
[debug] [ADB] Removing forwarded port socket connection: 8200
[debug] [ADB] Running '/root/platform-tools/adb -P 5037 -s android:5555 forward --remove tcp:8200'
[UiAutomator2] Restoring hidden api policy to the device default configuration
[debug] [ADB] Running '/root/platform-tools/adb -P 5037 -s android\:5555 shell 'settings delete global hidden_api_policy_pre_p_apps;settings delete global hidden_api_policy_p_apps;settings delete global hidden_api_policy''
[debug] [BaseDriver] Event 'newSessionStarted' logged at 1635010987452 (10:43:07 GMT-0700 (Pacific Daylight Time))
[debug] [W3C] Encountered internal error running command: Error: 'app' option is required for reinstall
[debug] [W3C]     at Object.resetApp (/usr/lib/node_modules/appium/node_modules/appium-android-driver/lib/android-helpers.js:392:11)
[debug] [W3C]     at AndroidUiautomator2Driver.initAUT (/usr/lib/node_modules/appium/node_modules/appium-uiautomator2-driver/lib/driver.js:546:9)
[debug] [W3C]     at AndroidUiautomator2Driver.startUiAutomator2Session (/usr/lib/node_modules/appium/node_modules/appium-uiautomator2-driver/lib/driver.js:408:5)
[debug] [W3C]     at AndroidUiautomator2Driver.createSession (/usr/lib/node_modules/appium/node_modules/appium-uiautomator2-driver/lib/driver.js:229:7)
[debug] [W3C]     at AppiumDriver.createSession (/usr/lib/node_modules/appium/lib/appium.js:387:35)
[HTTP] <-- POST /wd/hub/session 500 421 ms - 561

parametrize appium cli args

let's parametrize appium cli args to manage it by mcloud-agent.
as of now add --session-override true cli arg by default for iOS

capture `fallbackSessionId` from carina for negative scenarios

We added fallbackSessionId for every driver session request. it might be used to correlate invalid session artifacts aka video/logs and failure in the test.

High level scenario is:

  1. start video recording anyway using video_#.mp4 template
  2. As only new session request arrived - kill existing recording and start new one using detected sessionId
  3. If all good, forget about video*.mp4 files and concat/upload sessionId*.mp4
  4. If session not started or docker interrupted: collect videomp4, sessionIdmp4 and publish using fallbackSessionId/video.mp4. Log is simpler because current appium log might be used

Note: fallbackSessionId appeared only in 7.2.14-SNAPSHOT carina

Encountered internal error running command: NoSuchDriverError: A session is either terminated or not started

The appium fails with the error "Encountered internal error running command: NoSuchDriverError: A session is either terminated or not started"

2022-02-22 09:44:08:900 - [debug] [DevCon Factory] Cached connections count: 0
2022-02-22 09:44:08:900 - [debug] [BaseDriver] [MCLOUD] stopping capturing artifacts for session f44........cb42de
2022-02-22 09:44:08:913 - [debug] [W3C (f30a181e)] Encountered internal error running command: The process has received SIGTERM signal[[[--udid 00008...........0113802E --name iPhone_XR --sessionId f30a18......6d9cb42de]]]
2022-02-22 09:44:08:913 - [debug] [W3C (f30a181e)] Error: The process has received SIGTERM signal
2022-02-22 09:44:08:913 - [debug] [W3C (f30a181e)] at map (/usr/lib/node_modules/appium/lib/appium.js:530:84)
2022-02-22 09:44:08:913 - [debug] [W3C (f30a181e)] at Array.map ()
2022-02-22 09:44:08:913 - [debug] [W3C (f30a181e)] at AppiumDriver.deleteAllSessions (/usr/lib/node_modules/appium/lib/appium.js:530:33)
2022-02-22 09:44:08:914 - [debug] [W3C (f30a181e)] at process.onSignal (/usr/lib/node_modules/appium/lib/main.js:168:30)
2022-02-22 09:44:08:914 - [debug] [W3C (f30a181e)] at Object.onceWrapper (events.js:421:26)
2022-02-22 09:44:08:914 - [debug] [W3C (f30a181e)] at process.emit (events.js:326:22)
2022-02-22 09:44:08:914 - [debug] [W3C (f30a181e)] at process.emit (/usr/lib/node_modules/appium/node_modules/source-map-support/source-map-support.js:495:21)
2022-02-22 09:44:08:914 - [HTTP] <-- POST /wd/hub/session/f30a181e-6.................09e6d9cb42de/element 500 121 ms - 919
2022-02-22 09:44:08:914 - [HTTP]
2022-02-22 09:44:08:929 - [BaseDriver] [MCLOUD] [MCLOUD] start capturing artifacts error: Command failed: /opt/start-capture-artifacts.sh f30a181e-6714-4366-8a35-09e6d9cb42de >> /tmp/video.log 2>&1
2022-02-22 09:44:08:929 - [BaseDriver]
2022-02-22 09:44:08:929 - [BaseDriver] [MCLOUD] [MCLOUD] stop capturing artifacts error: Command failed: /opt/stop-capture-artifacts.sh f30a181e-6714-4366-8a35-09e6d9cb42de
2022-02-22 09:44:08:930 - [BaseDriver]
2022-02-22 09:44:09:164 - [HTTP] --> POST /wd/hub/session/f30a181e-.........5-09e6d9cb42de/element
2022-02-22 09:44:09:164 - [HTTP] {"using":"-ios class chain","value":"**/XCUIElementTypeButton[name == 'OK' or label == 'OK']"}
2022-02-22 09:44:09:166 - [debug] [W3C (f30a181e)] Encountered internal error running command: NoSuchDriverError: A session is either terminated or not started[[[--udid 0000..................A0113802E --name iPhone_XR --sessionId f30a181e-...............8a35-09e6d9cb42de]]]
2022-02-22 09:44:09:166 - [debug] [W3C (f30a181e)] at asyncHandler (/usr/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:243:15)
2022-02-22 09:44:09:166 - [debug] [W3C (f30a181e)] at /usr/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:426:15
2022-02-22 09:44:09:166 - [debug] [W3C (f30a181e)] at Layer.handle [as handle_request] (/usr/lib/node_modules/appium/node_modules/express/lib/router/layer.js:95:5)
2022-02-22 09:44:09:166 - [debug] [W3C (f30a181e)] at next (/usr/lib/node_modules/appium/node_modules/express/lib/router/route.js:137:13)
2022-02-22 09:44:09:166 - [debug] [W3C (f30a181e)] at Route.dispatch (/usr/lib/node_modules/appium/node_modules/express/lib/router/route.js:112:3)
2022-02-22 09:44:09:166 - [debug] [W3C (f30a181e)] at Layer.handle [as handle_request] (/usr/lib/node_modules/appium/node_modules/express/lib/router/layer.js:95:5)
2022-02-22 09:44:09:166 - [debug] [W3C (f30a181e)] at /usr/lib/node_modules/appium/node_modules/express/lib/router/index.js:281:22
2022-02-22 09:44:09:166 - [debug] [W3C (f30a181e)] at param (/usr/lib/node_modules/appium/node_modules/express/lib/router/index.js:354:14)
2022-02-22 09:44:09:166 - [debug] [W3C (f30a181e)] at param (/usr/lib/node_modules/appium/node_modules/express/lib/router/index.js:365:14)
2022-02-22 09:44:09:166 - [debug] [W3C (f30a181e)] at Function.process_params (/usr/lib/node_modules/appium/node_modules/express/lib/router/index.js:410:3)
2022-02-22 09:44:09:166 - [debug] [W3C (f30a181e)] at next (/usr/lib/node_modules/appium/node_modules/express/lib/router/index.js:275:10)
2022-02-22 09:44:09:166 - [debug] [W3C (f30a181e)] at logger (/usr/lib/node_modules/appium/node_modules/morgan/index.js:144:5)
2022-02-22 09:44:09:166 - [debug] [W3C (f30a181e)] at Layer.handle [as handle_request] (/usr/lib/node_modules/appium/node_modules/express/lib/router/layer.js:95:5)
2022-02-22 09:44:09:166 - [debug] [W3C (f30a181e)] at trim_prefix (/usr/lib/node_modules/appium/node_modules/express/lib/router/index.js:317:13)
2022-02-22 09:44:09:166 - [debug] [W3C (f30a181e)] at /usr/lib/node_modules/appium/node_modules/express/lib/router/index.js:284:7
2022-02-22 09:44:09:166 - [debug] [W3C (f30a181e)] at Function.process_params (/usr/lib/node_modules/appium/node_modules/express/lib/router/index.js:335:12
2022-02-22 09:44:09:167 - [HTTP] <-- POST /wd/hub/session/f30a181e-..................-09e6d9cb42de/element 404 3 ms - 1998
2022-02-22 09:44:09:167 - [HTTP]
2022-02-22 09:44:09:212 - [debug] [BaseDriver] [MCLOUD] uploading captured artifacts
Exit status: 0

retain_task shouldn't kill appium in between session

As of now we still need selenium grid with all devices connected which is pretty old school.
When we do hard appium restart in between sessions it kill selenium node and reconnect asap but grid itself still continue to use old connection.
As result 2nd test crash with below exception.

let's investigate the approach when we cleanup appium log file instead of hard kill and start to keep appium and selenium grid connection.

org.openqa.selenium.WebDriverException: Session [2bb6140d-2f55-4bfd-b86b-7655c570972b] not available and is not among the last 1000 terminated sessions.
Active sessions are[]
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: '...', ip: '192.168.2.99', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.11'
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities {app: https://qaprosoft.s3-us-wes..., appPackage: com.solvd.carinademoapplica..., carinaTestRunId: 02c04faa-a508-412e-beca-27f..., databaseEnabled: false, desired: {app: https://qaprosoft.s3-us-wes..., carinaTestRunId: 02c04faa-a508-412e-beca-27f..., deviceName: Samsung_S5, enableVideo: true, enableVnc: true, language: en, locale: US, platformName: android, provider: zebrunner, server:CONFIG_UUID: 841d86f8-1a4f-4748-afd6-180..., slotCapabilities: {adb_port: 7500, automationName: Appium, deviceName: Samsung_S5, deviceType: Phone, maxInstances: 1, platform: ANDROID, platformName: ANDROID, platformVersion: 6.0.1, proxy_port: 7550, remoteURL: demo.zebrunner.farm:7412, seleniumProtocol: WebDriver, server:CONFIG_UUID: 841d86f8-1a4f-4748-afd6-180..., udid: 4d003e5f4aad21e7, version: 6.0.1, vncLink: ws://demo.zebrunner.farm:7420}}, deviceApiLevel: 23, deviceManufacturer: samsung, deviceModel: SM-G900H, deviceName: 4d003e5f4aad21e7, deviceScreenDensity: 480, deviceScreenSize: 1080x1920, deviceUDID: 4d003e5f4aad21e7, enableVideo: true, enableVnc: true, javascriptEnabled: true, language: en, locale: US, locationContextEnabled: false, networkConnectionEnabled: true, pixelRatio: 3, platform: LINUX, platformName: ANDROID, platformVersion: 6.0.1, provider: zebrunner, server:CONFIG_UUID: 841d86f8-1a4f-4748-afd6-180..., slotCapabilities: {adb_port: 7500, automationName: Appium, deviceName: Samsung_S5, deviceType: Phone, maxInstances: 1, platform: ANDROID, platformName: ANDROID, platformVersion: 6.0.1, proxy_port: 7550, remoteURL: demo.zebrunner.farm:7412, seleniumProtocol: WebDriver, server:CONFIG_UUID: 841d86f8-1a4f-4748-afd6-180..., udid: 4d003e5f4aad21e7, version: 6.0.1, vncLink: ws://demo.zebrunner.farm:7420}, statBarHeight: 72, takesScreenshot: true, viewportRect: {height: 1848, left: 0, top: 72, width: 1080}, warnings: {}, webStorageEnabled: false}
Session ID: 2bb6140d-2f55-4bfd-b86b-7655c570972b
*** Element info: {Using=id, value=next_button}

handle device offline status

before the startup we verify device state using:

#TODO: for unauthorized device wait 60 sec and exit
while [[ "$unauthorized" -eq 0 && "$available" -eq 0 ]]
do
    sleep 3
    unauthorized=`adb devices | grep -c unauthorized`
    echo "unauthorized: $unauthorized"
    available=`adb devices | grep -c -w device`
    echo "available: $available"
done

it would be great if we can detect offline status and kill/remove container at all as there is no sense to test something until device is reconnected physically

restore sharing device udid/name as part of exception for negative cases

To continue support device detection in carina for negative cases we have to patch error messaging:

# PATCH #2 <appium>/node_modules/appium/node_modules/appium-base-driver/build/lib/protocol/protocol.js to return to carina "DEBUG info" about problematic step
# after 303 line add one more to update err.message
#       let actualErr = err;
#      err.message = `[[[DEBUG info: ${err.message} --udid ${process.env.DEVICE_UDID} --name ${process.env.STF_PROVIDER_DEVICE_NAME}]]]`;

Details: https://github.com/zebrunner/mcloud-appium/blob/9998fb50dfb0f846451d0a13eb2e4ed561debd80/Dockerfile#L65
P.S. also investigate possibility to provide fallback driver sessionId in additions

parametrize screenrecord settings via capabilities from esg

we should provide an options to override any CLI argument for screenrecord using zebrunner options caps.

screenrecord --help
Usage: screenrecord [options] <filename>

Android screenrecord v1.3.  Records the device's display to a .mp4 file.

Options:
--size WIDTHxHEIGHT
    Set the video size, e.g. "1280x720".  Default is the device's main
    display resolution (if supported), 1280x720 if not.  For best results,
    use a size supported by the AVC encoder.
--bit-rate RATE
    Set the video bit rate, in bits per second.  Value may be specified as
    bits or megabits, e.g. '4000000' is equivalent to '4M'.  Default 20Mbps.
--bugreport
    Add additional information, such as a timestamp overlay, that is helpful
    in videos captured to illustrate bugs.
--time-limit TIME
    Set the maximum recording time, in seconds.  Default / maximum is 180.
--display-id ID
    specify the physical display ID to record. Default is the primary display.
    see "dumpsys SurfaceFlinger --display-id" for valid display IDs.
--verbose
    Display interesting information on stdout.
--help
    Show this message.

Recording continues until Ctrl-C is hit or the time limit is reached.

disable logs coloring option

colors in the console appium logs looks ugly in the plain text editors. As we provide this file outside via html let's forcibly disable this option and generate regular text.
Importnant: review and test carefully our log parser and video recordings

improve iossdkversion population

for now it is hardcoded using patched utils.js:

async function getAndCheckIosSdkVersion() {
  return '13.2';
...

it has sense to parametrize it via env var for our enhanced appium because this version and WebDriverAgent.ipa should be provided manually for appium. If you built WebDriverAgent.ipa with "13.2" for example you have to provide this version as env var and return inside getAndCheckIosSdkVersion fucntion

move WDA healthcheck status verification to appium container for iOS

we moved wda startup from stf/mcloud-device to appium but forgot to move healthcheck.
as result everything is ok until WDA crash. After that device can't be used as Appium/WDA is not restarted automatically

Unhandled rejection RequestError: Error: connect ECONNREFUSED 192.168.88.39:8100
    at new RequestError (/opt/node_modules/request-promise-core/lib/errors.js:14:15)
    at Request.plumbing.callback (/opt/node_modules/request-promise-core/lib/plumbing.js:87:29)
    at Request.RP$callback [as _callback] (/opt/node_modules/request-promise-core/lib/plumbing.js:46:31)
    at self.callback (/opt/node_modules/request/request.js:185:22)
    at emitOne (events.js:116:13)
    at Request.emit (events.js:211:7)
    at Request.onRequestError (/opt/node_modules/request/request.js:877:8)
    at emitOne (events.js:116:13)
    at ClientRequest.emit (events.js:211:7)
    at Socket.socketErrorListener (_http_client.js:387:9)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at emitErrorNT (internal/streams/destroy.js:66:8)
From previous event:
    at Object.handleRequest (/opt/lib/units/ios-device/plugins/wda/WdaClient.js:405:16)
    at Object.stopSession (/opt/lib/units/ios-device/plugins/wda/WdaClient.js:126:21)
    at WebSocket.<anonymous> (/opt/lib/units/ios-device/plugins/screen/stream.js:96:21)
    at emitTwo (events.js:131:20)
    at WebSocket.emit (events.js:214:7)
    at WebSocket.emitClose (/opt/node_modules/ws/lib/WebSocket.js:211:10)
    at _receiver.cleanup (/opt/node_modules/ws/lib/WebSocket.js:199:39)
    at Receiver.cleanup (/opt/node_modules/ws/lib/Receiver.js:520:15)
    at WebSocket.finalize (/opt/node_modules/ws/lib/WebSocket.js:199:20)
    at emitNone (events.js:111:20)
    at Socket.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1064:12)
    at _combinedTickCallback (internal/process/next_tick.js:139:11)
    at process._tickCallback (internal/process/next_tick.js:181:9)
2021-12-30T11:44:17.579Z INF/wdaClient 8 [d6afc6b3a65584ca0813eb8957c6479b9b6ebb11] stopping wda session...
2021-12-30T11:44:17.582Z IMP/device:plugins:screen:stream 8 [d6afc6b3a65584ca0813eb8957c6479b9b6ebb11] ws on close event
Unhandled rejection RequestError: Error: connect ECONNREFUSED 192.168.88.39:8100
    at new RequestError (/opt/node_modules/request-promise-core/lib/errors.js:14:15)
    at Request.plumbing.callback (/opt/node_modules/request-promise-core/lib/plumbing.js:87:29)
    at Request.RP$callback [as _callback] (/opt/node_modules/request-promise-core/lib/plumbing.js:46:31)
    at self.callback (/opt/node_modules/request/request.js:185:22)
    at emitOne (events.js:116:13)
    at Request.emit (events.js:211:7)
    at Request.onRequestError (/opt/node_modules/request/request.js:877:8)
    at emitOne (events.js:116:13)
    at ClientRequest.emit (events.js:211:7)
    at Socket.socketErrorListener (_http_client.js:387:9)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at emitErrorNT (internal/streams/destroy.js:66:8)
From previous event:
    at Object.handleRequest (/opt/lib/units/ios-device/plugins/wda/WdaClient.js:405:16)
    at Object.stopSession (/opt/lib/units/ios-device/plugins/wda/WdaClient.js:126:21)
    at WebSocket.<anonymous> (/opt/lib/units/ios-device/plugins/screen/stream.js:96:21)
    at emitTwo (events.js:131:20)
    at WebSocket.emit (events.js:214:7)
    at WebSocket.emitClose (/opt/node_modules/ws/lib/WebSocket.js:211:10)
    at _receiver.cleanup (/opt/node_modules/ws/lib/WebSocket.js:199:39)
    at Receiver.cleanup (/opt/node_modules/ws/lib/Receiver.js:520:15)
    at WebSocket.finalize (/opt/node_modules/ws/lib/WebSocket.js:199:20)
    at emitNone (events.js:111:20)
    at Socket.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1064:12)
    at _combinedTickCallback (internal/process/next_tick.js:139:11)
    at process._tickCallback (internal/process/next_tick.js:181:9)
``

remote connect hangs if REMOTE_ADB not available asap

we do have huge dealy on adb connect host:port if REMOTE_ADB not available asap.
let's investigate what might be improved here...
As a hotfix it might be adding preliminary telnet call to check that remote host:port are accessible and listening. Only after that start adb.
or launch adb connect with timeout and relaunch several times

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.