コード例 #1
0
  @Test(expected = WidgetException.class)
  public void testHasTextException() throws WidgetException {
    wd.open(url);
    IElement element = new Element(getDiv("zzzzcontent"));

    element.hasText("Here");
  }
コード例 #2
0
  @Test
  public void testHasTextTrue() throws WidgetException {
    wd.open(url);
    IElement element = new Element(getDiv("removeContent"));

    Assert.assertTrue("Test that hasText returns true", element.hasText("some"));
  }
コード例 #3
0
  @Test(expected = WidgetException.class)
  public void testGetTextException() throws WidgetException {
    wd.open(url);

    IElement element = new Element(getSpan("INVALIDsomeText"));
    element.getText();
  }
コード例 #4
0
  @Test(expected = WidgetException.class)
  public void testIsAttributePresentException() throws WidgetException {
    wd.open(url);

    IElement element = new Element(getDiv("myContent"));
    element.isAttributePresent("randomAttrib");
  }
コード例 #5
0
  @Test(expected = WidgetException.class)
  public void testWaitForNotVisibleException() throws WidgetException {
    wd.open(url);

    IElement element = new Element(getButton("visibilityTest"));
    element.waitForNotVisible();
  }
コード例 #6
0
 @Test
 public void testGetLocator() throws WidgetException {
   wd.open(url);
   String test = "//DIV[@id='this_is_my_locator']";
   IElement e = new Element(test);
   Assert.assertEquals("Test get locator should return the value passed in", test, e.getLocator());
 }
コード例 #7
0
 @Test
 public void testGetInnerHtml() throws WidgetException {
   wd.open(url);
   IElement e = new Element("someText");
   String html = e.getInnerHTML();
   Assert.assertEquals("Here is some text", html);
 }
コード例 #8
0
 @Test
 public void testIsElementPresentTrue() throws WidgetException {
   wd.open(url);
   IElement e = new Element(button);
   Assert.assertTrue(
       "Test isElementPresent on an element that does exist returns true", e.isElementPresent());
 }
コード例 #9
0
  @Test(expected = WidgetException.class)
  public void testWaitForAttributeNotEqualToException() throws WidgetException {
    wd.open(url);
    IElement element = new Element(getDiv("content"));

    element.waitForAttributeNotEqualTo("randomAttrib", "Hello");
  }
コード例 #10
0
  @Test
  public void testIsAttributePresentFalse() throws WidgetException {
    wd.open(url);

    IElement element = new Element(getDiv("content"));
    Assert.assertFalse(
        "Test isAttributePresent returns false", element.isAttributePresent("someAttribute"));
  }
コード例 #11
0
  @Test
  public void testIsAttributePresentTrue() throws WidgetException {
    wd.open(url);

    IElement element = new Element(getDiv("content"));
    Assert.assertTrue(
        "Test isAttributePresent returns true", element.isAttributePresent("randomAttrib"));
  }
コード例 #12
0
  @Test
  public void testGetText() throws WidgetException {
    wd.open(url);

    IElement element = new Element(getSpan("someText"));
    String exp = "Here is some text";
    Assert.assertEquals(exp, element.getText());
  }
コード例 #13
0
  @Test(expected = WidgetException.class)
  public void testWaitForElementNotPresentTimeout() throws WidgetException {
    wd.open(url);

    IElement waitForElement = new Element(getSpan("someText"));

    waitForElement.waitForElementNotPresent();
  }
コード例 #14
0
 @Test
 public void testIsElementVisibleTimeoutTrue() throws WidgetException {
   wd.open(url);
   IElement hidden = new Element(button);
   Assert.assertTrue(
       "Testing isElementVisible on a hidden button should be return false",
       hidden.isElementVisible(500));
 }
コード例 #15
0
 @Test
 public void testIsElementVisibleFalse() throws WidgetException {
   wd.open(url);
   IElement hidden = new Element(invisibleButton);
   Assert.assertFalse(
       "Testing isElementVisible on a non-hidden button should be return true",
       hidden.isElementVisible());
 }
コード例 #16
0
 @Test
 public void testIsElementNotPresentTimeoutFalse() throws WidgetException {
   wd.open(url);
   IElement e = new Element(button);
   Assert.assertFalse(
       "Test isElementPresent on an element that does not exist returns false",
       e.isElementNotPresent(500));
 }
コード例 #17
0
 @Test
 public void testGetChildNodesValuesText() throws WidgetException {
   wd.open(url);
   IElement e = new Element("inner1");
   String[] actual = e.getChildNodesValuesText();
   String[] expected = new String[] {"hello world", "welcome"};
   Assert.assertArrayEquals(expected, actual);
 }
コード例 #18
0
 @Test(expected = WidgetException.class)
 public void testGetLocationYException() throws WidgetException {
   wd.open(url);
   IElement element = new Element(getButton("zzztestWaitButton"));
   int val = -1;
   val = element.getLocationY();
   Assert.assertNotEquals(-1, val);
 }
コード例 #19
0
 @Test
 public void testGetLocationY() throws WidgetException {
   wd.open(url);
   IElement element = new Element(getButton("testWaitButton"));
   int val = -1;
   val = element.getLocationY();
   Assert.assertNotEquals("Test that getLocationY returned an int value", -1, val);
 }
コード例 #20
0
 @Test
 public void testIsElementPresentFalse() throws WidgetException {
   wd.open(url);
   String test = "//button[@id='myButtonDoesntExist']";
   IElement e = new Element(test);
   Assert.assertFalse(
       "Test isElementPresent on an element that doesn't exist returns false",
       e.isElementPresent());
 }
コード例 #21
0
  @Test
  public void testWaitForText() throws WidgetException {
    wd.open(url);
    IInteractiveElement clickButton = new Button(getButton("testWaitButton"));
    IElement element = new Element(getDiv("content"));

    clickButton.click();
    element.waitForText();
  }
コード例 #22
0
  @Test(expected = WidgetException.class)
  public void testWaitForElementPresentTimeout() throws WidgetException {
    wd.open(url);

    IInteractiveElement clickButton = new Button(getButton("testWaitButton"));
    IElement waitForElement = new Element(getSpan("failMe"));

    clickButton.click();
    waitForElement.waitForElementPresent();
  }
コード例 #23
0
  @Test
  public void testWaitForElementNotPresent() throws WidgetException {
    wd.open(url);

    IInteractiveElement clickButton = new Button(getButton("testWaitElementNotPresentButton"));
    IElement waitForElement = new Element(getSpan("someText"));

    clickButton.click();
    waitForElement.waitForElementNotPresent();
  }
コード例 #24
0
  @Test
  public void testWaitForNotVisible() throws WidgetException {
    wd.open(url);

    IInteractiveElement clickButton = new Button(getButton("nonVisibilityTest"));
    IElement element = new Element(getButton("visibilityTest"));

    clickButton.click();
    element.waitForNotVisible();
  }
コード例 #25
0
  @Test(expected = WidgetException.class)
  public void testGetCssValueException() throws WidgetException {
    wd.open(url);
    IElement element = new Element(getButton("zzzmyInvisibleButton"));

    Assert.assertEquals(
        "Test that getCssValue returns the correct attribute",
        "hidden",
        element.getCssValue("visibility"));
  }
コード例 #26
0
  @Test
  public void testWaitForAttributeNotEqualTo() throws WidgetException {
    wd.open(url);

    IInteractiveElement clickButton = new Button(getButton("attributeChanger"));
    IElement element = new Element(getDiv("content"));

    clickButton.click();
    element.waitForAttributeNotEqualTo("randomAttrib", "Hello");
  }
コード例 #27
0
  @Test
  public void testMouseMoveOut() throws WidgetException {
    wd.open(url);

    IInteractiveElement ie = new InteractiveElement(getDiv("dest"));
    IElement element = new Element(getDiv("content"));
    ie.waitForElementPresent();
    ie.mouseMove();
    ie.mouseMoveOut();
    Assert.assertEquals("Mouse Moved Out", element.getText());
  }
コード例 #28
0
  @Test
  public void testGetAttribute() throws WidgetException {
    wd.open(url);

    IElement element = new Element(getDiv("content"));
    String expected = "Hello";
    Assert.assertEquals(
        "Test getAttribute returns expected string",
        expected,
        element.getAttribute("randomAttrib"));
  }
コード例 #29
0
 @Test
 public void testCSSSelector2() throws WidgetException {
   wd.open(url);
   IElement e = new Element("#removeContent>span");
   Assert.assertEquals("Here is some text", e.getText());
 }
コード例 #30
0
 @Test
 public void testCSSSelector() throws WidgetException {
   wd.open(url);
   IElement e = new Element("#myButton");
   Assert.assertEquals("Click me", e.getText());
 }