Search in sources :

Example 1 with SelectList

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

the class TestSelectList method testDeselectByIndex.

@Test(groups = { "ut" })
public void testDeselectByIndex() throws IOException {
    when(option1.isSelected()).thenReturn(false);
    when(option2.isSelected()).thenReturn(true);
    when(element.getAttribute("multiple")).thenReturn("true");
    SelectList select = new SelectList("", By.id("select"));
    select.deselectByIndex(2);
    verify(option1, never()).click();
    verify(option2).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 2 with SelectList

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

the class TestSelectList method testSelectByCorrespondingText.

/**
 * Check only one option is selected when one text is given
 * @throws IOException
 */
@Test(groups = { "ut" })
public void testSelectByCorrespondingText() throws IOException {
    when(option1.isSelected()).thenReturn(false);
    when(option2.isSelected()).thenReturn(false);
    SelectList select = new SelectList("", By.id("select"));
    select.selectByCorrespondingText("Opt");
    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 3 with SelectList

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

the class TestSelectList method testDeselectByTextNotSelected.

@Test(groups = { "ut" })
public void testDeselectByTextNotSelected() throws IOException {
    when(option1.isSelected()).thenReturn(false);
    when(option2.isSelected()).thenReturn(true);
    when(element.getAttribute("multiple")).thenReturn("true");
    SelectList select = new SelectList("", By.id("select"));
    select.deselectByText("opt1");
    verify(option1, never()).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 4 with SelectList

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

the class TestSelectList method testSelectByCorrespondingTexts.

/**
 * Check only one option is selected when one text is given
 * @throws IOException
 */
@Test(groups = { "ut" })
public void testSelectByCorrespondingTexts() throws IOException {
    when(option1.isSelected()).thenReturn(false);
    when(option2.isSelected()).thenReturn(false);
    when(element.getAttribute("multiple")).thenReturn("true");
    SelectList select = new SelectList("", By.id("select"));
    select.selectByCorrespondingText("PT1", "PT2");
    verify(option1).click();
    verify(option2).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 5 with SelectList

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

the class TestSelectList method testDeselectByCorrespondingText.

@Test(groups = { "ut" })
public void testDeselectByCorrespondingText() throws IOException {
    when(option1.isSelected()).thenReturn(true);
    when(option2.isSelected()).thenReturn(true);
    when(element.getAttribute("multiple")).thenReturn("true");
    SelectList select = new SelectList("", By.id("select"));
    select.deselectByCorrespondingText("Pt2");
    verify(option1, never()).click();
    verify(option2).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