Search in sources :

Example 31 with SelectList

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

the class TestSelectList method testDeselectAllNotMultiple.

@Test(groups = { "ut" }, expectedExceptions = UnsupportedOperationException.class)
public void testDeselectAllNotMultiple() throws IOException {
    when(option1.isSelected()).thenReturn(true);
    when(option2.isSelected()).thenReturn(false);
    when(element.getAttribute("multiple")).thenReturn("false");
    SelectList select = new SelectList("", By.id("select"));
    select.deselectAll();
}
Also used : SelectList(com.seleniumtests.uipage.htmlelements.SelectList) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) MockitoTest(com.seleniumtests.MockitoTest)

Example 32 with SelectList

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

the class TestSelectList method testGetAllSelectedOption.

@Test(groups = { "ut" })
public void testGetAllSelectedOption() throws IOException {
    when(option1.isSelected()).thenReturn(true);
    when(option2.isSelected()).thenReturn(true);
    SelectList select = new SelectList("", By.id("select"));
    List<WebElement> options = select.getAllSelectedOptions();
    Assert.assertEquals(options.size(), 2);
}
Also used : SelectList(com.seleniumtests.uipage.htmlelements.SelectList) WebElement(org.openqa.selenium.WebElement) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) MockitoTest(com.seleniumtests.MockitoTest)

Example 33 with SelectList

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

the class TestSelectList method testSelectByValue.

@Test(groups = { "ut" })
public void testSelectByValue() throws IOException {
    when(option1.isSelected()).thenReturn(false);
    when(option2.isSelected()).thenReturn(true);
    SelectList select = new SelectList("", By.id("select"));
    select.selectByValue("opti1");
    verify(option1).click();
    verify(option2, never()).click();
}
Also used : SelectList(com.seleniumtests.uipage.htmlelements.SelectList) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) MockitoTest(com.seleniumtests.MockitoTest)

Example 34 with SelectList

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

the class TestSelectList method testSelectedTextNoSelection.

@Test(groups = { "ut" })
public void testSelectedTextNoSelection() throws IOException {
    SelectList select = new SelectList("", By.id("select"));
    String txt = select.getSelectedText();
    Assert.assertEquals(txt, "");
}
Also used : SelectList(com.seleniumtests.uipage.htmlelements.SelectList) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) MockitoTest(com.seleniumtests.MockitoTest)

Example 35 with SelectList

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

the class TestSelectList method testDeselectAll.

@Test(groups = { "ut" })
public void testDeselectAll() throws IOException {
    when(option1.isSelected()).thenReturn(true);
    when(option2.isSelected()).thenReturn(false);
    when(element.getAttribute("multiple")).thenReturn("true");
    SelectList select = new SelectList("", By.id("select"));
    select.deselectAll();
    verify(option1).click();
    verify(option2, never()).click();
}
Also used : SelectList(com.seleniumtests.uipage.htmlelements.SelectList) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) MockitoTest(com.seleniumtests.MockitoTest)

Aggregations

SelectList (com.seleniumtests.uipage.htmlelements.SelectList)35 MockitoTest (com.seleniumtests.MockitoTest)34 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)34 Test (org.testng.annotations.Test)34 WebElement (org.openqa.selenium.WebElement)9 RemoteWebElement (org.openqa.selenium.remote.RemoteWebElement)2 ScenarioException (com.seleniumtests.customexception.ScenarioException)1 CheckBoxElement (com.seleniumtests.uipage.htmlelements.CheckBoxElement)1 Element (com.seleniumtests.uipage.htmlelements.Element)1 FrameElement (com.seleniumtests.uipage.htmlelements.FrameElement)1 GenericPictureElement (com.seleniumtests.uipage.htmlelements.GenericPictureElement)1 HtmlElement (com.seleniumtests.uipage.htmlelements.HtmlElement)1 LinkElement (com.seleniumtests.uipage.htmlelements.LinkElement)1 RadioButtonElement (com.seleniumtests.uipage.htmlelements.RadioButtonElement)1 NativeSelect (com.seleniumtests.uipage.htmlelements.select.NativeSelect)1 StubSelect (com.seleniumtests.uipage.htmlelements.select.StubSelect)1 NoSuchElementException (org.openqa.selenium.NoSuchElementException)1 WebDriverException (org.openqa.selenium.WebDriverException)1