Using deep links (URL Scheme) on iOS Simulator is slow - needs to restart app everytime


I have a single project that runs Appium tests on both Android and iOS. The app under test is very simple. It basically opens a screen, calls a local server to get some content and return the result on the screen.

The test routine follows the pattern on both platforms:

1 - Access a screen, the main screen, containing a textfield and a submit button
2 - Type a URL and click on the submit button, then waits for a custom screen to load
3 - Test the custom screen
4 - Restarts the app (driver.closeApp / driver.launchApp), so the next test / scenario / feature can start over freshly

In order to optimize this routine and test speed, I implemented deep links (URL Scheme on iOS). With this feature, there was no need to restart the app anymore, since each deep link call would load directly a custom screen. So the test routine now became this:

1 - Open a custom screen directly through a deep link
2 - Test the custom screen

That is, no more restarting app routine. This improved Android tests speed by over 50%!

The problem:

However, on iOS, I still needed to restart the app in the end because the test speed (looking up for elements, etc) became very slow. And that is the point I’m asking for help: what might cause this behavior on iOS?

Here’s the capabilities I use on iOS:

        capabilities.setCapability("noReset", true)
        capabilities.setCapability("waitForQuiescence", false)
        capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "iOS")
        capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, "XCUITest")
        capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "13.5")
        capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone 11")
        capabilities.setCapability(MobileCapabilityType.APP, PATH-TO-.APPFILE)
        driver = IOSDriver<MobileElement>(URL(APPIUM_URL), capabilities)

This is the way I’m calling deep links:

    if (SuiteSetup.isAndroid()) {
        val params = HashMap<String, String>()
        params["url"] = "appiumapp://bffurl/" + SuiteSetup.getBffBaseUrl() + bffRelativeUrlPath
        params["package"] = ""
        (getDriver() as JavascriptExecutor).executeScript("mobile:deepLink", params)
    } else {
        getDriver().get("appiumapp://" + SuiteSetup.getBffBaseUrl() + bffRelativeUrlPath)

My specs:
macOS Big Sur 11.2.3 (20D91)
i7, 16gb ram, SSD
Xcode 12.4
Build version 12D4e

The Appium project is implemented in Kotlin and Gradle. My dependencies:
dependencies {
implementation “org.jetbrains.kotlin:kotlin-stdlib”
compile group: ‘io.appium’, name: ‘java-client’, version: ‘7.4.1’
compile group: ‘commons-io’, name: ‘commons-io’, version: ‘2.8.0’
compile group: ‘com.github.romankh3’, name: ‘image-comparison’, version: ‘4.3.0’
testImplementation ‘io.cucumber:cucumber-java:6.8.2’
testImplementation ‘io.cucumber:cucumber-junit:6.8.2’

The Appium server is 1.20.2