Search in sources :

Example 1 with LabelElement

use of com.seleniumtests.uipage.htmlelements.LabelElement in project seleniumRobot by bhecquet.

the class TestFrameElement method testLabelElementOutsideFrame.

@Test(groups = { "ut" })
public void testLabelElementOutsideFrame() throws Exception {
    LabelElement el = new LabelElement("", By.id("el"));
    el.click();
    verify(locator, times(0)).frame(any(WebElement.class));
}
Also used : LabelElement(com.seleniumtests.uipage.htmlelements.LabelElement) WebElement(org.openqa.selenium.WebElement) RemoteWebElement(org.openqa.selenium.remote.RemoteWebElement) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) MockitoTest(com.seleniumtests.MockitoTest)

Example 2 with LabelElement

use of com.seleniumtests.uipage.htmlelements.LabelElement in project seleniumRobot by bhecquet.

the class TestFrameElement method testLabelElementInsideFrame.

@Test(groups = { "ut" })
public void testLabelElementInsideFrame() throws Exception {
    FrameElement frame = new FrameElement("", By.id("frameId"));
    LabelElement el = new LabelElement("", By.id("el"), frame);
    el.click();
    verify(locator).frame(any(WebElement.class));
    verify(locator).defaultContent();
}
Also used : LabelElement(com.seleniumtests.uipage.htmlelements.LabelElement) FrameElement(com.seleniumtests.uipage.htmlelements.FrameElement) WebElement(org.openqa.selenium.WebElement) RemoteWebElement(org.openqa.selenium.remote.RemoteWebElement) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) MockitoTest(com.seleniumtests.MockitoTest)

Example 3 with LabelElement

use of com.seleniumtests.uipage.htmlelements.LabelElement in project seleniumRobot by bhecquet.

the class TestLabelElement method testLabelElement.

@Test(groups = { "ut" })
public void testLabelElement() throws Exception {
    PowerMockito.mockStatic(WebUIDriver.class);
    Mockito.when(WebUIDriver.getWebDriver(anyBoolean())).thenReturn(driver);
    Mockito.when(driver.findElement(By.id("label"))).thenReturn(element);
    Mockito.when(element.getText()).thenReturn("textual label");
    Mockito.when(driver.switchTo()).thenReturn(locator);
    LabelElement el = Mockito.spy(new LabelElement("label", By.id("label")));
    Assert.assertEquals(el.getText(), "textual label");
    // check we called getDriver before using it
    PowerMockito.verifyPrivate(el, Mockito.times(1)).invoke("updateDriver");
}
Also used : LabelElement(com.seleniumtests.uipage.htmlelements.LabelElement) Test(org.testng.annotations.Test) MockitoTest(com.seleniumtests.MockitoTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Aggregations

MockitoTest (com.seleniumtests.MockitoTest)3 LabelElement (com.seleniumtests.uipage.htmlelements.LabelElement)3 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)3 Test (org.testng.annotations.Test)3 WebElement (org.openqa.selenium.WebElement)2 RemoteWebElement (org.openqa.selenium.remote.RemoteWebElement)2 FrameElement (com.seleniumtests.uipage.htmlelements.FrameElement)1