Connect to an iOS Simulator

Important to note that we are trying to test on an iOS
simulator. I followed the instructions to create a simulator device. Could this be specific to a simulator ?

import com.experitest.appium.;
import io.appium.java_client.remote.IOSMobileCapabilityType;
import io.appium.java_client.remote.MobileCapabilityType;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.openqa.selenium.ScreenOrientation;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.By;
import org.junit.
;
import java.net.URL;
import java.net.MalformedURLException;

public class Main {
private String host = “localhost”;
private int port = 8889;
private String reportDirectory = “reports”;
private String reportFormat = “xml”;
private String testName = “Untitled”;
protected SeeTestIOSDriver driver = null;

@Before
public void setUp() throws MalformedURLException {
    DesiredCapabilities dc = new DesiredCapabilities();
    dc.setCapability(SeeTestCapabilityType.REPORT_DIRECTORY, reportDirectory);
    dc.setCapability(SeeTestCapabilityType.REPORT_FORMAT, reportFormat);
    dc.setCapability(SeeTestCapabilityType.TEST_NAME, testName);
    dc.setCapability(MobileCapabilityType.UDID, "2B3D5D58-298F-4A86-9D10-C3C90F160E63");
    dc.setCapability(IOSMobileCapabilityType.BUNDLE_ID, "pro.oyster.heartbeat");
    driver = new SeeTestIOSDriver<>(new URL("http://"+host+":"+port), dc);
}

@Test
public void testUntitled() {
    driver.findElement(By.xpath("//*[@accessibilityLabel='LoginUserName']")).sendKeys("walter");
    driver.findElement(By.xpath("//*[@accessibilityLabel='LoginPassword']")).click();
    new WebDriverWait(driver, 10).until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[@accessibilityLabel='LoginPassword']")));
    driver.findElement(By.xpath("//*[@accessibilityLabel='LoginPassword']")).sendKeys("kelt");
    driver.findElement(By.xpath("//*[@accessibilityLabel='LoginLoginButton']")).click();
}

@After
public void tearDown() {
    driver.quit();
}

}

Below is the trace from the code:
[Thu May 18 08:36:43 EDT 2017] [driver] Starting test: ‘Untitled’
[Thu May 18 08:36:43 EDT 2017] [driver] {dontGoHomeOnQuit=false, noReset=false, dontStopAppOnReset=false, instrumentApp=false, bundleId=pro.oyster.heartbeat, reservationDuration=240, reportFormat=xml, fullReset=false, waitForDeviceTimeout=120000, useRemoteGrid=false, reportDirectory=reports, [enableclientlog, enableclientlogger]=false, autoWebview=false, udid=2B3D5D58-298F-4A86-9D10-C3C90F160E63, platformName=iOS, testName=Untitled}
[Thu May 18 08:36:43 EDT 2017] [driver] context: NATIVE_APP
[Thu May 18 08:36:43 EDT 2017] [driver] application under test:
[Thu May 18 08:36:43 EDT 2017] [driver] app path: null
[Thu May 18 08:36:43 EDT 2017] [driver] full reset: false
[Thu May 18 08:36:43 EDT 2017] [driver] instrument: false
[Thu May 18 08:36:43 EDT 2017] [driver] no reset: false
[Thu May 18 08:36:43 EDT 2017] [driver] bundleId: pro.oyster.heartbeat
[Thu May 18 08:36:43 EDT 2017] [driver] launch timeout ms: null
[Thu May 18 08:36:43 EDT 2017] [driver] browser: false
[Thu May 18 08:36:43 EDT 2017] [driver] connecting localhost:8889
[Thu May 18 08:36:43 EDT 2017] [driver] Call of getSessionID returned: d0ba
[Thu May 18 08:36:43 EDT 2017] [driver] setting reporter directory: reports
[Thu May 18 08:36:43 EDT 2017] [driver] setting reporter format: xml
[Thu May 18 08:36:43 EDT 2017] [driver] setting test name: Untitled
[Thu May 18 08:36:43 EDT 2017] [driver] wait for device ‘@serialnumber=‘2B3D5D58-298F-4A86-9D10-C3C90F160E63’’ timeout-ms=‘120000’

com.experitest.client.InternalException: Timeout wait for device

at com.experitest.client.JavaClientInternals.waitForDevice(JavaClientInternals.java:395)
at com.experitest.client.Client.waitForDevice(Client.java:234)
at com.experitest.appium.STClientFacade.<init>(STClientFacade.java:178)
at com.experitest.appium.STIOSClientFacade.<init>(STIOSClientFacade.java:15)
at com.experitest.appium.SeeTestIOSDriver.<init>(SeeTestIOSDriver.java:82)
at Main.setUp(Main.java:30)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

Hi Walter

this is due to the fact that you are working with emulators

please use the following capability to select your iOS device

dc.setCapability(SeeTestCapabilityType.DEVICE_QUERY, "@os=ios and @emulator='true'");