示例#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");
  }
  @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());
 }