Test Magic
Test Magic

Reputation: 1

Hangs test execution due to flutter locater not present on screen or app/screen crashed

Hangs whole execution of test at the same test step when do not find flutter widget with byValuekey or byText. please find logs:

[6bd5f8b2][FlutterDriver@fb8a] >>> {"command":"waitForAbsent","finderType":"ByValueKey","keyValueString”:”my_key","keyValueType":"String"}

[d44564a3][FlutterDriver@fb8a] Connection to ws://127.0.0.1:41293/Zw4g5AV3WERD=/ws closed

[6bd5f8b2][AndroidUiautomator2Driver@4ba2] Shutting down because we waited 60 seconds for a command

[6bd5f8b2][AndroidUiautomator2Driver@4ba2] Deleting UiAutomator2 session

[6bd5f8b2][AndroidUiautomator2Driver@4ba2] Deleting UiAutomator2 server session

[6bd5f8b2][AndroidUiautomator2Driver@4ba2] Matched '/' to command name 'deleteSession'

[6bd5f8b2][AndroidUiautomator2Driver@4ba2] Proxying [DELETE /] to [DELETE http://127.0.0.1:8200/session/74345tfca-18bd-4b50-8a3d-23edsf5e345e] with no body

[6bd5f8b2][AndroidUiautomator2Driver@4ba2] socket hang up

[6bd5f8b2][AndroidUiautomator2Driver@4ba2] 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

[d44564a3][AndroidUiautomator2Driver@4ba2] [Instrumentation] io.appium.uiautomator2.server.test.AppiumUiAutomator2Server:

[d44564a3][AndroidUiautomator2Driver@4ba2] [Instrumentation] The process has exited with code null, signal SIGTERM

[6bd5f8b2][ADB] Running '/usr/local/share/android-sdk/platform-tools/adb -P 5037 -s emulator-5554 shell dumpsys activity services io.appium.settings/.recorder.RecorderService'

[6bd5f8b2][ADB] Running '/usr/local/share/android-sdk/platform-tools/adb -P 5037 -s emulator-5554 shell am force-stop group.my.app'

[6bd5f8b2][ADB] Removing forwarded port socket connection: 8200 

[6bd5f8b2][ADB] Running '/usr/local/share/android-sdk/platform-tools/adb -P 5037 -s emulator-5554 forward --remove tcp:8200'

[6bd5f8b2][AndroidUiautomator2Driver@4ba2] Restoring hidden api policy to the device default configuration

[6bd5f8b2][ADB] Running '/usr/local/share/android-sdk/platform-tools/adb -P 5037 -s emulator-5554 shell 'settings delete global hidden_api_policy_pre_p_apps;settings delete global hidden_api_policy_p_apps;settings delete global hidden_api_policy''

[6bd5f8b2][Logcat] Stopping logcat capture

I have tried below things as teardown() to stop appium_process:

if self.appium_process is not None and self.appium_process.poll() is None:
            self.appium_process.terminate()
            self.appium_process.wait(timeout=10)  # Set a timeout to avoid hanging
            self.appium_process.kill()
            logger.info("Appium server stopped")
        else:
            logger.info("Appium server is not running")

However, I am using automationName as Flutter and context set to FLUTTER then if it does not find flutter element because of not being present on screen/disappeared/app crash any or this happens and try to termminate all appium process I do not receive proper shut down of appium server and it blocks all my tests in the queue hanging. For context with NATIVE_APP it works well. these are my capabilities:

"platformName": "Android", "platformVersion": "13.0", "deviceName": "emulator-5554", "automationName": "Flutter", "retryBackoffTime": 500, "newCommandTimeout": 300

Upvotes: 0

Views: 20

Answers (0)

Related Questions