Search in sources :

Example 11 with MobileDevice

use of com.testsigma.agent.mobile.MobileDevice in project testsigma by testsigmahq.

the class DeviceEventCallback method onDeviceRemoved.

public void onDeviceRemoved(String uuid) throws TestsigmaException, DeviceContainerException {
    MobileDevice mobileDevice = iosDeviceListener.getMobileDevice(uuid);
    mobileDevice.setIsOnline(false);
    mobileDevice.setIsEmulator(false);
    iosDeviceListener.removeDevice(mobileDevice);
    System.out.println("Removed: " + uuid);
}
Also used : LibIMobileDevice(com.testsigma.agent.mobile.ios.libs.LibIMobileDevice) MobileDevice(com.testsigma.agent.mobile.MobileDevice)

Example 12 with MobileDevice

use of com.testsigma.agent.mobile.MobileDevice in project testsigma by testsigmahq.

the class IosDeviceListener method getInitialDeviceList.

public void getInitialDeviceList() throws TestsigmaException, DeviceContainerException {
    List<Device> devices = iosDeviceService.deviceList();
    for (Device device : devices) {
        MobileDevice mobileDevice = getMobileDevice(device.getSerialNumber());
        mobileDevice.setMuxDeviceId(device.getDeviceId().toString());
        this.addDevice(mobileDevice);
    }
}
Also used : MobileDevice(com.testsigma.agent.mobile.MobileDevice) MobileDevice(com.testsigma.agent.mobile.MobileDevice)

Example 13 with MobileDevice

use of com.testsigma.agent.mobile.MobileDevice in project testsigma by testsigmahq.

the class IosDeviceListener method getMobileDevice.

public MobileDevice getMobileDevice(String uniqueId) throws TestsigmaException {
    MobileDevice mobileDevice = new MobileDevice();
    mobileDevice.setOsName(MobileOs.IOS);
    mobileDevice.setUniqueId(uniqueId);
    JSONObject deviceProperties = iosDeviceService.getDeviceProperties(uniqueId);
    mobileDevice.setName(deviceProperties.getString("DeviceName"));
    mobileDevice.setOsVersion(deviceProperties.getString("ProductVersion"));
    mobileDevice.setApiLevel(mobileDevice.getOsVersion());
    mobileDevice.setAbi(deviceProperties.getString("CPUArchitecture"));
    mobileDevice.setProductModel(deviceProperties.getString("ProductType"));
    mobileDevice.setScreenWidth(deviceProperties.getInt("ScreenWidth"));
    mobileDevice.setScreenHeight(deviceProperties.getInt("ScreenHeight"));
    mobileDevice.setIsOnline(true);
    mobileDevice.setIsEmulator(false);
    return mobileDevice;
}
Also used : MobileDevice(com.testsigma.agent.mobile.MobileDevice) JSONObject(org.json.JSONObject)

Example 14 with MobileDevice

use of com.testsigma.agent.mobile.MobileDevice in project testsigma by testsigmahq.

the class IosMobileAutomationServer method createSession.

public void createSession(String uniqueId) throws MobileAutomationServerSessionException {
    try {
        MobileDevice device = deviceContainer.getDevice(uniqueId);
        log.info("Creating IosDriver Session on device - " + device.getUniqueId());
        DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
        desiredCapabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, MobileOs.IOS.getPlatformName());
        desiredCapabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, device.getOsVersion());
        desiredCapabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, MobileOs.IOS.getAutomationName());
        desiredCapabilities.setCapability(MobileCapabilityType.DEVICE_NAME, device.getName());
        desiredCapabilities.setCapability(MobileCapabilityType.UDID, device.getUniqueId());
        desiredCapabilities.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 3600);
        desiredCapabilities.setCapability("xcodeOrgId", "6F4CKCA4LX");
        desiredCapabilities.setCapability("xcodeSigningId", "iPhone Developer");
        desiredCapabilities.setCapability("app", "/Users/vikram/ios-apps/ios-test-app/build/Release-iphoneos/TestApp-iphoneos.app");
        device.setRemoteWebDriver(new IOSDriver<>(new URL(mobileAutomationServerService.getMobileAutomationServer().getServerURL()), desiredCapabilities));
    } catch (Exception e) {
        throw new MobileAutomationServerSessionException(e.getMessage());
    }
}
Also used : MobileDevice(com.testsigma.agent.mobile.MobileDevice) MobileAutomationServerSessionException(com.testsigma.agent.exception.MobileAutomationServerSessionException) DesiredCapabilities(org.openqa.selenium.remote.DesiredCapabilities) URL(java.net.URL) MobileAutomationServerSessionException(com.testsigma.agent.exception.MobileAutomationServerSessionException) TestsigmaException(com.testsigma.agent.exception.TestsigmaException)

Aggregations

MobileDevice (com.testsigma.agent.mobile.MobileDevice)14 TestsigmaException (com.testsigma.agent.exception.TestsigmaException)5 AdbCommandExecutionException (com.testsigma.agent.exception.AdbCommandExecutionException)4 NativeBridgeException (com.testsigma.agent.exception.NativeBridgeException)4 IDevice (com.android.ddmlib.IDevice)3 LibIMobileDevice (com.testsigma.agent.mobile.ios.libs.LibIMobileDevice)3 MobileLibraryInstallException (com.testsigma.agent.exception.MobileLibraryInstallException)2 DeviceNotConnectedException (com.testsigma.agent.exception.DeviceNotConnectedException)1 MobileAutomationServerSessionException (com.testsigma.agent.exception.MobileAutomationServerSessionException)1 URL (java.net.URL)1 JSONObject (org.json.JSONObject)1 DesiredCapabilities (org.openqa.selenium.remote.DesiredCapabilities)1 RemoteWebDriver (org.openqa.selenium.remote.RemoteWebDriver)1 GetMapping (org.springframework.web.bind.annotation.GetMapping)1