Appium terminating session upon clicking UI elements of type 'switches'
michaelgaras opened this issue · 4 comments
This is a
- Bug report
- Question
- Freature Request
Summary
I am currently using Appium XCUItest to automate iOS devices, and here's the issue that I am facing:
While running the tests, all our page interactions with the phone are perfectly fine up until we hit a toggle switch. For example if we would like to turn on/off cellular data, we are able to interact with the phone’s UI elements to go to Settings, navigate to
Cellular perfectly fine. However, as soon as we hit the toggle switch (the Cellular Data toggle switch), then we lose interactions to the page and all the UI elements on the page. At the point we cannot move forward with the test.
I tried working around it by going to the control center then clicking the data switch from the control center, but even that kind of switches cause us to lose interactions to the page. The weird thing is that SOME switches work and some don’t. For instance, airplane mode, cellular data, call forwarding, call waiting switches don’t work but switches like Wi-Fi and Bluetooth work fine.
I then tried opening up Appium Desktop to rule out any issues that we could have in our backend and try reproducing it directly in Appium Desktop and I did! If you use Appium Desktop to navigate through pages it’s all working fine until you try clicking a UI element that is of type ‘switch’.
However, I know for a fact that we used to be able to run tests that involved toggling the Airplane Mode switch during the tests and they were successful so I did a few tests to locate the issue:
Here’s a list of things that I have tried:
Rolling back the Appium version
Reinstalling the WDA on the phone
Trying a different iPhone chipset ( Qualcomm vs Intel )
None of these changes fixed the problem so then I finally tried using iPhones running iOS 11 and the issue disappeared! But with the iPhones running iOS 12 Appium loses interactions to all the UI elements and pages upon clicking switches.
Running tests on Qualcomm AND Intel chipsets running iOS 11 WORKS
Running tests on Qualcomm AND Intel chipsets running iOS 12 BREAKS
Environment
- Appium version : 1.11.1
appium_lib
version: 9.15.0- Mobile platform/version/device under test: iOS 12.1.4
- XCode version: 10.1
- iOS SDK Version: 12.1
- iOS SDK Version: 12.1
- XCuitest
- WebDriverAgent
Actual behaviour and steps to reproduce
Try turning on/off cellular data from the UI.
You will be able to interact with the phone’s UI elements to go to Settings, navigate to
Cellular. However, as soon as you click the toggle switch (the Cellular Data toggle switch), then you will lose interactions to the page and all the UI elements on the page.
The logs attached show me clicking the button 3 on the Dialer page successfully, then clicking the wifi-button from the control center manually, then clicking the button 4 on the Dialer page successfully, then successfully clicking the button 5. Then I click the cellular-data button from the control center manually, then at this point I try clicking the button 6 but appium just stalls because it lost connection to the WDA ( session is terminated ). I can't find any UI_elements at this point because the appium session is terminated as soon as I click the cellular data switch. This also happens upon clicking different switches like airplane mode, call forwarding, call waiting, etc. I also included XCode logs with the Appium logs for further analysis.
Note that I am running the test on a non-default WDA port (wdaLocalPort 8150).
Expected behaviour
Clicking toggle switches should be no different than clicking any other UI element and it should not terminate the appium/WDA session.
Link to Appium/Ruby logs
Create a GIST which is a paste of your full Appium logs, and link them here.
https://gist.github.com/sinestic/f4569261c7e7cabcaaddcc42d6b68718
https://gist.github.com/sinestic/88f178460917266340cd497a1794519e
Any additional comments
Leads ( Not sure if they are useful but I think they're applicable to locating the issue )
The logs that are generated as soon as I click the switch is as follows:
[Xcode] 2019-03-15 10:29:39.221 xcodebuild[3130:3520947] [MT] IDETestOperationsObserverDebug: (73209515-44D6-421A-A8F1-13D0C6358E2C) Beginning test session WebDriverAgentRunner-73209515-44D6-421A-A8F1-13D0C6358E2C at 2019-03-15 10:29:39.221 with Xcode 10B61 on target 📱<DVTiOSDevice (0x7fc0a2474da0), Old’s iPhonetest, unknown class, unknown build, 8214181bc166191271de6fe708dca932df52c4b8> {
[Xcode] deviceSerialNumber: C39QV02FH2K8
[Xcode] identifier: 8214181bc166191271de6fe708dca932df52c4b8
[Xcode] deviceClass: iPhone
[Xcode] deviceName: Old’s iPhonetest
[Xcode] deviceIdentifier: 8214181bc166191271de6fe708dca932df52c4b8
[Xcode] productVersion: 12.1.4
[Xcode] buildVersion: 16D57
[Xcode] deviceSoftwareVersion: (null)
[Xcode] deviceArchitecture: arm64
[Xcode] deviceTotalCapacity: 60049637376
[Xcode] deviceAvailableCapacity: 56425979904
[Xcode] deviceIsTransient: NO
[Xcode] ignored: YES
[Xcode] deviceIsBusy: NO
[Xcode] deviceIsPaired: YES
[Xcode] deviceIsActivated: YES
[Xcode] deviceActivationState: Activated
[Xcode] isPasscodeLocked: NO
[Xcode] deviceType: <DVTDeviceType:0x7fc0a1f09560 Xcode.DeviceType.iPhone>
[Xcode] supportedDeviceFamilies: (null)
[Xcode] applications: (null)
[Xcode] provisioningProfiles: (null)
[Xcode] hasInternalSupport: NO
[Xcode] isSupportedOS: NO
[Xcode] developerDiskMountError: (null)
[Xcode] (null)
[Xcode] bootArgs: (null)
[Xcode] connected: no
[Xcode] isWirelessEnabled: no
[Xcode] connectionType: direct
[Xcode] hostname: (null)
[Xcode] bonjourServiceName: a4:d1:8c:f2:99:6b@fe80::a6d1:8cff:fef2:996b._apple-mobdev2._tcp.local.
[Xcode] } ((null))
Also, XCUITest gets this error when it's starting up the session after setting up real device (shown in the appium_logs_appiumdriver_switch_clicking.txt logs):
[XCUITest] No obsolete cached processes from previous WDA sessions listening on port 8150 have been found
[XCUITest] Starting iproxy to forward traffic from local port 8150 to device port 8100 over USB for the device 8214181bc166191271de6fe708dca932df52c4b8
[iProxy] Error connecting to device!
[XCUITest] WDA is not listening at 'http://localhost:8150/'
[XCUITest] WDA is currently not running. There is nothing to cache
[XCUITest] Killing running processes 'xcodebuild.*8214181bc166191271de6fe708dca932df52c4b8, iproxy 8150' for the device 8214181bc166191271de6fe708dca932df52c4b8...
[XCUITest] Starting iproxy to forward traffic from local port 8150 to device port 8100 over USB for the device 8214181bc166191271de6fe708dca932df52c4b8
If you require any additional logs (syslogs) for the iPhone (device under test) please let me know.
This behaviour is expected. iOS terminates all network connections including the one used by WDA
Thanks for your respond @mykola-mokhnach .
If iOS terminates all network connections including the one used by WDA, how am I able to click every other UI element except UI elements of type switches?
I was even able to click the UI elements of type switches on iPhones running iOS 11 so I am a little confused. Can you please provide more details?
Thanks
@mykola-mokhnach is there any follow up with regards to that issue?
Thanks
[iProxy] Error connecting to device!
It seems iOS behaved to stop some kind of communications...
Then, only Apple can change the behaviour.
You could try out the latest Appium, but if the above iproxy error means iOS stops usbmuxd communication, the same error could happen...