Package net.sourceforge.jwebunit.api

Examples of net.sourceforge.jwebunit.api.IElement


    }
   
  }

  private void assertTargetVisible(boolean b) {
    IElement button = getButtonWithText("target");
    assertEquals("Button should be " + (b ? "visible" : "hidden"), b, isDisplayed(button));
  }
View Full Code Here


   * TODO move this implementation into JWebUnit
   *
   * @return the page title
   */
  public String getPageTitle() {
    IElement title = getElementByXPath("//title");
    if (title == null)
      return "null";
    return title.getTextContent();
  }
View Full Code Here

   * @throws Exception
   */
  public void testMapPoints() throws Exception {
    beginAtSitemapThenPage("Home");
   
    IElement map = assertHasMap("Target Map");
   
    if (!doCheckPoints()) return;
   
    // TODO how to check that the map points refer to the correct locations, are visible etc?
    {
      IElement point = assertHasMapPoint(map, "point 1");
      // and this point is not present anywhere else on the page
      assertEquals(point, assertHasMapPoint("point 1"));
    }
    {
      IElement point = assertHasMapPoint(map, "point 2");
      assertEquals(point, assertHasMapPoint("point 2"));
    }
    {
      IElement point = assertHasMapPoint(map, "point 3");
      assertEquals(point, assertHasMapPoint("point 3"));
    }
    {
      IElement point = assertHasMapPoint(map, "point 4");
      assertEquals(point, assertHasMapPoint("point 4"));
    }
    {
      IElement point = assertHasMapPoint(map, "point 5");
      assertEquals(point, assertHasMapPoint("point 5"));
    }
  }
View Full Code Here

  public IElement assertHasMap(String label) {
    // find a label with the given string
    String id = getLabelIDForText(label, "NOT_MAP_TEXT", "contains(@class, 'map')");
   
    // this should contain a 'map' <div>
    IElement wrapper = getElementById(id);
    assertNotNull(wrapper);
   
    // through label.for
    assertNotNull(wrapper.getAttribute("for"));
    IElement map = getElementById(wrapper.getAttribute("for"));
    assertNotNull(map);

    // assert that the map is visible
    assertTrue("Map " + map + "should be displayed", isDisplayed(map));
   
View Full Code Here

  /**
   * Assert a map with the given name does <em>not</em> exist.
   */
  public void assertHasNoMap(String label) {
    try {
      IElement map = assertHasMap(label);
      throw new RuntimeException("Unexpectedly found map with label '" + label + "': " + map);
    } catch (AssertionFailedError e) {
      // expected
    }
  }
View Full Code Here

  public IElement assertHasMapPoint(IElement map, String label) {
    // find a label with the given string
    String id = getLabelIDForText(label, "NOT_MAP_TEXT", "contains(@class, 'point')");
   
    // this should contain a 'map' <div>
    IElement wrapper = getElementById(id);
    assertNotNull(wrapper);
   
    // through label.for
    assertNotNull(wrapper.getAttribute("for"));
    IElement point = getElementById(wrapper.getAttribute("for"));
    assertNotNull(point);
   
    // assert that the map point is visible
    assertTrue("Map point " + point + "should be displayed", isDisplayed(point));
   
View Full Code Here

  public IElement assertHasMapPoint(String label) {
    // find a label with the given string
    String id = getLabelIDForText(label, "NOT_MAP_TEXT", "contains(@class, 'point')");
   
    // this should contain a 'map' <div>
    IElement wrapper = getElementById(id);
    assertNotNull(wrapper);
   
    // through label.for
    assertNotNull(wrapper.getAttribute("for"));
    IElement point = getElementById(wrapper.getAttribute("for"));
    assertNotNull(point);
   
    // assert that the map point is visible
    assertTrue("Map point " + point + "should be displayed", isDisplayed(point));
View Full Code Here

  /**
   * Assert that the given map point does <em>not</em> exist anywhere.
   */
  public void assertHasNoMapPoint(String label) {
    try {
      IElement point = assertHasMapPoint(label);
      throw new RuntimeException("Unexpectedly found map point '" + label + "': " + point);
    } catch (AssertionFailedError e) {
      // expected
    }
  }
View Full Code Here

   * @param map
   * @param string
   */
  public void assertHasNoMapPoint(IElement map, String string) {
    boolean failed = false;
    IElement point = null;
    try {
      point = assertHasMapPoint(map, string);
      failed = true;
    } catch (AssertionFailedError e) {
      // expected
View Full Code Here

   *
   * @param linkName
   * @return
   */
  public String getURLOfLink(String linkName) {
    IElement link = getElementByXPath("//a[contains(text(), '" + linkName + "')]");
    assertNotNull(link);
   
    // find the href
    String href = link.getAttribute("href");
    assertNotNull(href);
    assertNotEquals(href, "");
   
    // TODO get the current page URL from JWebUnit in order to work out
    // the current relative path to the sitemap
View Full Code Here

TOP

Related Classes of net.sourceforge.jwebunit.api.IElement

Copyright © 2018 www.massapicom. 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.