Original error: socket hang up in between the test (Appium)

167 views Asked by At

I am running automation on my iPhone 14 with ios version 16.5.1. I am using Appium 2.0 version 2.0.0-rc.5 . I am trying to automate disabling Airplane mode and enabling mobile data.

Whenever I am changing the Airplane mode or mobile data, appium driver is quitting. Logs for the same are here - [Xcode]

 Responding to client with driver.createSession() result: {"capabilities":{"webStorageEnabled":false,"locationContextEnabled":false,"browserName":"","platform":"MAC","javascriptEnabled":true,"databaseEnabled":false,"takesScreenshot":true,"networkConnectionEnabled":false,"platformName":"iOS","platformVersion":"16.5.1","deviceName":"iPhone 14","automationName":"XCUITest","bundleId":"com.apple.Preferences","udid":"00008110-00121CDE0E81401E","wdaConnectionTimeout":600000,"xcodeSigningId":"iPhone Developer","includeSafariInWebviews":true,"newCommandTimeout":3600,"connectHardwareKeyboard":true}}
[HTTP] <-- POST /wd/hub/session 200 15437 ms - 599
[HTTP] 
[HTTP] --> GET /wd/hub/session/5ace7d6a-3e7d-4804-bfba-ef96aaa2a59a/screenshot
[HTTP] {}

[debug] [XCUITestDriver@1030 (c443ce06)] Responding to client with driver.getTimeouts() result: {"command":3600000,"implicit":0}
[HTTP] <-- GET /wd/hub/session/c443ce06-fc70-4e0b-b919-a18792b62f77/timeouts 200 536 ms - 42
[HTTP] 
[HTTP] --> GET /wd/hub/session/c443ce06-fc70-4e0b-b919-a18792b62f77/timeouts
[HTTP] {}
[debug] [XCUITestDriver@1030 (c443ce06)] Calling AppiumDriver.getTimeouts() with args: ["c443ce06-fc70-4e0b-b919-a18792b62f77"]
[debug] [XCUITestDriver@1030 (c443ce06)] Executing command 'getTimeouts'
[debug] [XCUITestDriver@1030 (c443ce06)] Responding to client with driver.getTimeouts() result: {"command":3600000,"implicit":0}
[HTTP] <-- GET /wd/hub/session/c443ce06-fc70-4e0b-b919-a18792b62f77/timeouts 304 4 ms - -
[HTTP] 
[Xcode] 
[Xcode] *** If you believe this error represents a bug, please attach the result bundle at /Users/vishalsingh/Library/Developer/Xcode/DerivedData/WebDriverAgent-eptpflukprltwpaoihzeppkcqrgo/Logs/Test/Test-WebDriverAgentRunner-2023.07.11_15-08-15-+0530.xcresult
[Xcode] 
[Xcode] 
[Xcode] 2023-07-11 15:08:36.098 xcodebuild[89159:936312] [MT] IDETestOperationsObserverDebug: 14.936 elapsed -- Testing started completed.
[Xcode] 2023-07-11 15:08:36.099 xcodebuild[89159:936312] [MT] IDETestOperationsObserverDebug: 0.000 sec, +0.000 sec -- start
[Xcode] 2023-07-11 15:08:36.099 xcodebuild[89159:936312] [MT] IDETestOperationsObserverDebug: 14.936 sec, +14.936 sec -- end
[Xcode] 
[Xcode] 
[Xcode] Test session results, code coverage, and logs:
[Xcode]     /Users/vishalsingh/Library/Developer/Xcode/DerivedData/WebDriverAgent-eptpflukprltwpaoihzeppkcqrgo/Logs/Test/Test-WebDriverAgentRunner-2023.07.11_15-08-15-+0530.xcresult
[Xcode] 
[Xcode] 
[Xcode] Testing failed:
[Xcode]     Lost connection to DTServiceHub
[Xcode]     testRunner encountered an error (Encountered a problem with the test runner after launch. If you believe this error represents a bug, please attach the result bundle at /Users/vishalsingh/Library/Developer/Xcode/DerivedData/WebDriverAgent-eptpflukprltwpaoihzeppkcqrgo/Logs/Test/Test-WebDriverAgentRunner-2023.07.11_15-08-15-+0530.xcresult. (Underlying Error: Lost connection to DTServiceHub))
[Xcode] 
[Xcode] ** TEST EXECUTE FAILED **
[Xcode] 
[Xcode] 
[Xcode] Testing started
[Xcode] 
[Xcode] xcodebuild exited with code '65' and signal 'null'
[HTTP] --> GET /wd/hub/session/c443ce06-fc70-4e0b-b919-a18792b62f77/timeouts
[HTTP] {}
[text]

I tried to initialize the driver in Airplane mode on state, but changing the state of airplane mode somehow forced the driver to quit. A similar thing is happening with Mobile Networks too.

In general, there are two process runs when the test is running:-

  1. One specific to Appium &
  2. One webdriverAgent process.

So for my case it looks like this -

33798 ?? 0:02.45 /opt/homebrew/bin/node /opt/homebrew/lib/node_modules/appium/build/lib/main.js --address 127.0.0.1 -p 4724

33917 ?? 0:01.64 /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild build-for-testing test-without-building -project /Users/test_user/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination id=00008110-00121CDE0E81401E IPHONEOS_DEPLOYMENT_TARGET=16.5 GCC_TREAT_WARNINGS_AS_ERRORS=0 COMPILER_INDEX_STORE_ENABLE=NO

Now after changing Airplane mode or Mobile data status, the second process which is basically the webdriverAgent process is terminating here, which basically stops the test from running properly.

What should I do to stop this from happening?

0

There are 0 answers