Appium and iOS App's Using SwiftUI

Hey all,

I am working with a team which uses Appium to help automate tests for a mobile application. On Android, all is well and no issues have been seen, but on iOS we notice our scripts run substantially slower.

Additionally, we have seen that when refreshing the inspector (using latest version at the time of this post) that some pages can take 4+ minutes to load. These pages typically have a decent amount of elements on them (30+). Are these known performance issues between Appium and SwiftUI, and if so are there plans to improve this in the future?

Thanks in advance for any information you can provide, and if more info could help diagnose any problems on our end I’d be happy to provide what I can!

  1. try decrease appium:waitForIdleTimeout and animationCoolOffTimeout
    Capabilities - Appium XCUITest Driver
    or
    Settings - Appium XCUITest Driver

  2. also try disable reduceMotion

1 Like

@Aleksei Thanks for the fast reply! We were able to try a few of your suggestions, but unfortunately we didn’t notice any improvement.

Tried:

  • waitForIdleTimeout: 0 (just to try it), 2, and 3
  • animationCoolOffTimeout: This is unfortunately not viable for us to change at the moment - though might help, will keep it in mind
    -reduceMotion: This only seems to affect simulators, whereas we are using physical devices for our testing

You can set reduceMotion on phones in settings.

PS maybe you can add a bit of code how you find elements…

1 Like

@Aleksei Unfortunately our devices have already been setup with the reduce motion disabled, so that isn’t it. Below is an example of how we are finding an element for both Android + iOS

@HowToUseLocators(androidAutomation = LocatorGroupStrategy.ALL_POSSIBLE)
@AndroidFindBy(xpath = "//android.widget.ImageButton[@content-desc='Navigate up']")
@AndroidFindBy(xpath = "//android.widget.ImageView[@content-desc='Back']")
@iOSXCUITFindBy(xpath = "//XCUIElementTypeButton[@label='BackArrow']")
private MobileElement backButton;

Try a bit different way. Xpath is VERY slow, specially on iOS.

    @AndroidFindAll(value = {
            @AndroidBy(uiAutomator = "new UiSelector().description(\"Navigate up\")"),
            @AndroidBy(uiAutomator = "new UiSelector().description(\"Back\")")
    })
    @iOSXCUITFindBy(iOSNsPredicate = "type == 'XCUIElementTypeButton' AND label == 'BackArrow'")
    private MobileElement backButton;
    
    // another way
    @AndroidFindAll(value = {
            @AndroidBy(uiAutomator = "new UiSelector().description(\"Navigate up\")"),
            @AndroidBy(uiAutomator = "new UiSelector().description(\"Back\")")
    })
    @iOSXCUITFindBy(iOSClassChain = "**/XCUIElementTypeButton[`label == \"BackArrow\"`]")
    private MobileElement backButton;
1 Like

Just an update, we use locators where possible and only use XPaths as a last resort. Slowness is seen either way. Recent discovery was that the issue is NOT seen when testing on iOS 17.4.1 (possible other 17 devices as well). We are pursuing this path at this time