TestProject Forum

How to deploy IPA with io.testproject:java-sdk (OpenSDK)

Hi,

how do I deploy an existing IPA to the device with io.testproject:java-sdk?

Currently I try to deploy the ipa with the following capability:

capabilities.setCapability(MobileCapabilityType.APP, “myPathToExistingIPA.ipa”)

The test crashes with following error:

Could not complete the request to start a new session. Another program such as an antivirus/firewall seems to be interfering with the connection.
io.testproject.sdk.internal.exceptions.AgentConnectException: Could not complete the request to start a new session. Another program such as an antivirus/firewall seems to be interfering with the connection.
	at io.testproject.sdk.internal.rest.AgentClient.translateAgentConnectFailure(AgentClient.java:667)
	at io.testproject.sdk.internal.rest.AgentClient.startSession(AgentClient.java:598)
	at io.testproject.sdk.internal.rest.AgentClient.<init>(AgentClient.java:231)
	at io.testproject.sdk.internal.rest.AgentClient.getClient(AgentClient.java:460)
	at io.testproject.sdk.drivers.ios.IOSDriver.<init>(IOSDriver.java:359)
	at io.testproject.sdk.drivers.ios.IOSDriver.<init>(IOSDriver.java:165)

The equivalent android test (setting MobileCapabilityType.APP) is running without issues.
Following (green) tests will fail until the TestProject Agent is restarted.

Agent failed to interrupt existing development session to start a new one, try again.
io.testproject.sdk.internal.exceptions.ObsoleteVersionException: Agent failed to interrupt existing development session to start a new one, try again.
	at io.testproject.sdk.internal.rest.AgentClient.handleSessionStartFailure(AgentClient.java:755)
	at io.testproject.sdk.internal.rest.AgentClient.startSession(AgentClient.java:604)
	at io.testproject.sdk.internal.rest.AgentClient.<init>(AgentClient.java:231)
	at io.testproject.sdk.internal.rest.AgentClient.getClient(AgentClient.java:460)
	at io.testproject.sdk.drivers.android.AndroidDriver.<init>(AndroidDriver.java:361)
	at io.testproject.sdk.drivers.android.AndroidDriver.<init>(AndroidDriver.java:167)

I think the TestProject Agent is kind of destroyed until restart.

How do you deploy IPA-files to your test devices with the OpenSDK?

Thanks in advance

Do you have any questions? Did I forgot to write down any essential information?

Or does nobody use the OpenSDK with iOS?

Thanks!

Hello @patrick.teufel.

This is indeed an issue, can you please send your agent logs to support@testproject.io ?
They can be found and downloaded from the agent tab:

Please send the entire zip file.

I face the same issue on my machine when executing an iOS native app automation script. Were you able to solve this issue?. But I am able to Manually Record and Playback on the same device through the TestProject cloud.

Hello @karthik.ganesan2, are you using the Java SDK as well?

The issue has been handled previously and should work on Agent 65.30,
For example while using the capability in the following code snippet:

import io.appium.java_client.ios.IOSElement;
import io.appium.java_client.remote.MobileCapabilityType;
import io.appium.java_client.remote.MobilePlatform;
import io.testproject.sdk.drivers.ios.IOSDriver;
import org.openqa.selenium.remote.DesiredCapabilities;

public class test {
    public static void main(String[] args) throws Exception {
        
        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, MobilePlatform.IOS);
        capabilities.setCapability(MobileCapabilityType.UDID, "UDID");
        capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "My iPhone");
        capabilities.setCapability(MobileCapabilityType.APP, "C:\\path\\to\\file\\demo.ipa");

        // Driver initialization.
        IOSDriver<IOSElement> driver = new IOSDriver<>("TOKEN",
                capabilities, "iOS Capability Test");

        // Close session.
        driver.quit();
    }
}

Can you share the code which is not running for you?

When I use 2 devices running on the same machine. But 1 device turned off goes to reset Testproject Agent. All other device operations have been stopped

Hey @quoctrunggol36, does this relate to the original topic of deploying an IPA file with the MobileCapabilityType.APP capability?

If so, can you please explain further what exactly you’re doing and possibly share your agent logs and code with us at support@testproject.io?

If not, please open a separate thread detailing the exact scenario and issue you’re experiencing and once again, share the logs/code with us at our support address.

Hey @david.goichman,

unfortunately, I still face the same issue with Agent 65.30 (on MacOS).

Tests with preinstalled app and capability IOSMobileCapabilityType.BUNDLE_ID instead of MobileCapabilityType.APP are working, but we want to use the feature of automatic installation for our pipeline.

Should I share my agent logs with you?

Yes, please send them to support@testproject.io

Hi @david.goichman ,

Yes, I am using Java SDK (0.65.1-RELEASE). It works fine when I pass APP path (TestProject Demo App)

capabilities.setCapability(MobileCapabilityType.APP, “C:\Users\\Downloads\Demo.ipa”);

But when I pass BundleID of an already installed app like below, it still gives the same error. Our requirement is to automate preinstalled apps.

capabilities.setCapability(CapabilityType.BROWSER_NAME, “”);
capabilities.setCapability(IOSMobileCapabilityType.BUNDLE_ID, “io.testproject.Demo”);

Code:
package com.testproject;

import io.appium.java_client.ios.IOSElement;
import io.appium.java_client.remote.IOSMobileCapabilityType;
import io.appium.java_client.remote.MobileCapabilityType;
import io.appium.java_client.remote.MobilePlatform;
import io.testproject.sdk.drivers.ios.IOSDriver;

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;

public class IOSTestTP {
public static void main(String args) throws Exception {

    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, MobilePlatform.IOS);
    capabilities.setCapability(MobileCapabilityType.UDID, "UUID");
    capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "devie name");
   // capabilities.setCapability(MobileCapabilityType.APP, "C:\\Users\\z094435\\Downloads\\Demo.ipa");
    capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
    //capabilities.setCapability("skipServerInstallation", true);
    //capabilities.setCapability("skipDeviceInitialization", true);

    // Compile and deploy the App from source https://github.com/testproject-io/ios-demo-app
    capabilities.setCapability(IOSMobileCapabilityType.BUNDLE_ID, "io.testproject.Demo");

    // Driver initialization.
    IOSDriver<IOSElement> driver = new IOSDriver<>("TOKEN",
            capabilities, "iOS Capability Test");
    
   

    // Reset App
    driver.resetApp();

    // Login using provided credentials
    driver.findElement(By.id("name")).sendKeys("John Smith");
    driver.findElement(By.id("password")).sendKeys("12345");
    driver.findElement(By.id("login")).click();

    boolean passed = driver.findElement(By.id("logout")).isDisplayed();
    if (passed) {
        System.out.println("Test Passed");
    } else {
        System.out.println("Test Failed");
    }

    driver.closeApp();
    // Close session.
    driver.quit();
}

}

Hi @karthik.ganesan2 ,

Your test seems to run with no issue on my end, what do you see in your console output?
Have you tried other apps with different bundleId’s instead of the TestProject demo application?

Can you also share your agent logs with us through support@testproject.io?

@david.goichman Thanks David. I was passing wrong bundleId(io.testproject.Demo) that is why It was not working. I have tried with two different bundleIds, all worked fine now.

1 Like