Examples of IOSCapabilities


Examples of org.uiautomation.ios.IOSCapabilities

    for (ServerSideSession s : sessions) {
      JSONObject session = new JSONObject();
      session.put("id", s.getSessionId());

      IOSRunningApplication app = s.getApplication();
      IOSCapabilities cap = app.getCapabilities();
      session.put("capabilities", cap.getRawCapabilities());
      res.put(session);
    }
    Response resp = new Response();
    resp.setSessionId("dummy one");
    resp.setStatus(0);
View Full Code Here

Examples of org.uiautomation.ios.IOSCapabilities

  public Response handle() throws Exception {

    ServerSideSession session = null;
    try {
      JSONObject payload = getRequest().getPayload();
      IOSCapabilities cap = new IOSCapabilities(payload.getJSONObject("desiredCapabilities"));

      long timeOut = TIMEOUT_SEC;
      for (int i = 0; i < MAX_RETRIES; i++) {
        session = safeStart(timeOut, cap);
        timeOut = (i + 2) * TIMEOUT_SEC;
 
View Full Code Here

Examples of org.uiautomation.ios.IOSCapabilities

    }
  }


  public IOSCapabilities getCapabilities() {
    IOSCapabilities cap = new IOSCapabilities();
    cap.setSupportedLanguages(getSupportedLanguagesCodes());
    cap.setCapability("applicationPath", getApplicationPath().getAbsoluteFile());
    List<DeviceType> supported = getSupportedDevices();

    if (supported.contains(DeviceType.iphone)) {
      cap.setDevice(DeviceType.iphone);
    } else {
      cap.setDevice(DeviceType.ipad);
    }

    if (this instanceof IPAApplication) {
      cap.setCapability(IOSCapabilities.SIMULATOR, false);
    } else {
      cap.setCapability(IOSCapabilities.SIMULATOR, true);
    }

    cap.setCapability(IOSCapabilities.SUPPORTED_DEVICES, supported);
    for (Iterator iterator = getMetadata().keys(); iterator.hasNext(); ) {
      String key = (String) iterator.next();

      try {
        Object value = getMetadata().get(key);
        cap.setCapability(key, value);
      } catch (JSONException e) {
        throw new WebDriverException("cannot get metadata", e);
      }
    }
    return cap;
View Full Code Here

Examples of org.uiautomation.ios.IOSCapabilities

  }

  @Test
  public void empty() throws JSONException {
    Map<String, Object> decoded = new IOSCapabilities(empty).getRawCapabilities();
    Assert.assertTrue(decoded.isEmpty());
  }
View Full Code Here

Examples of org.uiautomation.ios.IOSCapabilities

  }


  @Test
  public void simple1() throws JSONException {
    Map<String, Object> decoded = new IOSCapabilities(simple1).getRawCapabilities();
    Assert.assertEquals(decoded.size(), simple1.length());
    Assert.assertEquals(decoded.get("boolean"), true);
    Assert.assertEquals(decoded.get("string"), "abc");
  }
View Full Code Here

Examples of org.uiautomation.ios.IOSCapabilities

    Assert.assertEquals(decoded.get("string"), "abc");
  }

  @Test
  public void array() throws JSONException {
    Map<String, Object> decoded = new IOSCapabilities(array).getRawCapabilities();
    Assert.assertEquals(decoded.size(), array.length());
    Assert.assertEquals(decoded.get("boolean"), true);
    Assert.assertEquals(decoded.get("string"), "abc");
    Assert.assertTrue(decoded.get("array") instanceof List);
    List<String> a = new ArrayList<String>((List) decoded.get("array"));
View Full Code Here

Examples of org.uiautomation.ios.IOSCapabilities

                                 + "\"sdkVersion\":\"5.1\","
                                 + "\"rect\":{\"origin\":{\"x\":0,\"y\":0},\"size\":{\"width\":320,\"height\":480}}}";

  @Test(groups = {"capabilitiesMappingIsWrong", "broken"})
  public void propertiesAreAlignedWithUIAutomation() throws Exception {
    IOSCapabilities ipad = new IOSCapabilities(new JSONObject(ipadFromInstruments));
    Assert.assertEquals(ipad.getDevice(), DeviceType.ipad);
    Assert.assertEquals(ipad.getLanguage(), "de");
    Assert.assertEquals(ipad.getLocale(), "fr_CA");
    Assert.assertEquals(ipad.getSDKVersion(), "5.1");

    IOSCapabilities iphone = new IOSCapabilities(new JSONObject(iphoneFromInstruments));
    Assert.assertEquals(iphone.getDevice(), DeviceType.iphone);
    Assert.assertEquals(iphone.getLanguage(), "de");
    Assert.assertEquals(iphone.getLocale(), "fr_CA");
    Assert.assertEquals(iphone.getSDKVersion(), "5.1");

  }
View Full Code Here

Examples of org.uiautomation.ios.IOSCapabilities

*/
public final class AppCapabilityTest extends BaseIOSDriverTest {

  @Test(enabled = false)
  public void canSpecifyAppToUseAsCapability() throws MalformedURLException {
    IOSCapabilities caps = SampleApps.uiCatalogCap();
    caps.setCapability("app", SampleApps.getUICatalogZipURL());
    driver = getDriver(caps);
    String expected = "UIATableCell";
    WebElement element = driver.findElement(By.tagName(expected));
    Assert.assertEquals(element.getClass(), RemoteWebElement.class);
    Assert.assertEquals(element.getTagName(), expected);
View Full Code Here

Examples of org.uiautomation.ios.IOSCapabilities

    StringWriter s = new StringWriter();
    IOUtils.copy(in, s, "UTF-8");

    Session session = new Session(name);
    JSONObject t = new JSONObject(tree.toString());
    IOSCapabilities c = new IOSCapabilities(new JSONObject(cap.toString()));

     IDESessionModel
        model =
        new MockedModel(session, screenshot, t, c, new JSONObject(s.toString()));
    cache.put(session, model);
View Full Code Here

Examples of org.uiautomation.ios.IOSCapabilities

  public List<String> getSupportedLanguagesCodes() {
    return underlyingApplication.getSupportedLanguagesCodes();
  }

  public IOSCapabilities getCapabilities() {
    IOSCapabilities caps = underlyingApplication.getCapabilities();
    caps.setLanguage(currentLanguage.getIsoCode());
    return caps;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.