Search in sources :

Example 16 with MyPage

use of org.definitylabs.flue2ent.data.MyPage in project flue2ent by DefinityLabs.

the class AbstractWebElementProxyTest method findByWithoutArguments_undefined_throwsException.

@Test
public void findByWithoutArguments_undefined_throwsException() {
    MyPage myPage = newInstance(MyPage.class, website);
    expectedException.expect(IllegalArgumentException.class);
    expectedException.expectMessage("element path is not defined");
    myPage.undefined();
}
Also used : MyPage(org.definitylabs.flue2ent.data.MyPage) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 17 with MyPage

use of org.definitylabs.flue2ent.data.MyPage in project flue2ent by DefinityLabs.

the class AbstractWebElementProxyTest method args_elementByClassNameAndIndex_returnsWebElement.

@Test
public void args_elementByClassNameAndIndex_returnsWebElement() {
    WebElement sessionOneElement = mock(WebElement.class);
    WebElement sessionTwoElement = mock(WebElement.class);
    when(website.findElement(By.cssSelector(".session:nth-child(1)"))).thenReturn(new WebElementWrapper(sessionOneElement));
    when(website.findElement(By.cssSelector(".session:nth-child(2)"))).thenReturn(new WebElementWrapper(sessionTwoElement));
    MyPage myPage = newInstance(MyPage.class, website);
    WebElementWrapper sessionOne = myPage.elementByClassNameAndIndex("session", 1);
    WebElementWrapper sessionTwo = myPage.elementByClassNameAndIndex("session", 2);
    assertThat(sessionOne.webElement()).isSameAs(sessionOneElement);
    assertThat(sessionTwo.webElement()).isSameAs(sessionTwoElement);
}
Also used : WebElement(org.openqa.selenium.WebElement) MyPage(org.definitylabs.flue2ent.data.MyPage) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 18 with MyPage

use of org.definitylabs.flue2ent.data.MyPage in project flue2ent by DefinityLabs.

the class AbstractWebElementProxyTest method findByPlaceholder_email_returnsWebElement.

@Test
public void findByPlaceholder_email_returnsWebElement() {
    when(website.findElement(ExtendedBy.byPlaceholder("Email"))).thenReturn(new WebElementWrapper(webElement));
    MyPage myPage = newInstance(MyPage.class, website);
    WebElementWrapper email = myPage.email();
    assertThat(email.webElement()).isSameAs(webElement);
}
Also used : MyPage(org.definitylabs.flue2ent.data.MyPage) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 19 with MyPage

use of org.definitylabs.flue2ent.data.MyPage in project flue2ent by DefinityLabs.

the class AbstractWebElementProxyTest method findByTextLink_failedLink_throwsException.

@Test
public void findByTextLink_failedLink_throwsException() {
    when(website.findElement(By.linkText("link"))).thenReturn(new WebElementWrapper(webElement));
    MyPage myPage = newInstance(MyPage.class, website);
    expectedException.expect(RuntimeException.class);
    expectedException.expectMessage("Cannot create instance of org.definitylabs.flue2ent.element.WebElementDecorator");
    myPage.failedLink();
}
Also used : MyPage(org.definitylabs.flue2ent.data.MyPage) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 20 with MyPage

use of org.definitylabs.flue2ent.data.MyPage in project flue2ent by DefinityLabs.

the class AbstractWebElementProxyTest method findByValue_male_returnsWebElement.

@Test
public void findByValue_male_returnsWebElement() {
    when(website.findElement(ExtendedBy.byValue("MALE"))).thenReturn(new WebElementWrapper(webElement));
    MyPage myPage = newInstance(MyPage.class, website);
    WebElementWrapper genderMale = myPage.male();
    assertThat(genderMale.webElement()).isSameAs(webElement);
}
Also used : MyPage(org.definitylabs.flue2ent.data.MyPage) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Aggregations

MyPage (org.definitylabs.flue2ent.data.MyPage)25 Test (org.junit.Test)25 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)25 WebElement (org.openqa.selenium.WebElement)6 WebElementWrapper (org.definitylabs.flue2ent.element.WebElementWrapper)4 SubPage (org.definitylabs.flue2ent.data.SubPage)2 Method (java.lang.reflect.Method)1 SelectElement (org.definitylabs.flue2ent.element.list.SelectElement)1 TableElement (org.definitylabs.flue2ent.element.table.TableElement)1