Search in sources :

Example 1 with SeleniumWMultiDropdownWebElement

use of com.github.bordertech.wcomponents.test.selenium.element.SeleniumWMultiDropdownWebElement in project wcomponents by BorderTech.

the class WMultiDropdownTestingExample_Test method testGetAddButton.

@Test
public void testGetAddButton() {
    SeleniumWMultiDropdownWebElement component = getByLabel(WMultiDropdownTestingExample.LABEL_NO_SELECTION);
    WebElement button = component.getAddButton();
    Assert.assertNotNull(button);
    // what can we do with the add button?
    component = getByLabel(WMultiDropdownTestingExample.LABEL_DISABLED);
    button = component.getAddButton();
    Assert.assertNotNull(button);
    Assert.assertFalse(button.isEnabled());
}
Also used : SeleniumWMultiDropdownWebElement(com.github.bordertech.wcomponents.test.selenium.element.SeleniumWMultiDropdownWebElement) WebElement(org.openqa.selenium.WebElement) SeleniumWMultiDropdownWebElement(com.github.bordertech.wcomponents.test.selenium.element.SeleniumWMultiDropdownWebElement) Test(org.junit.Test)

Example 2 with SeleniumWMultiDropdownWebElement

use of com.github.bordertech.wcomponents.test.selenium.element.SeleniumWMultiDropdownWebElement in project wcomponents by BorderTech.

the class WMultiDropdownTestingExample_Test method testDeselectNull.

@Test(expected = IllegalArgumentException.class)
public void testDeselectNull() {
    SeleniumWMultiDropdownWebElement component = getByLabel(WMultiDropdownTestingExample.LABEL_ALL_SELECTED);
    component.deselect(null);
}
Also used : SeleniumWMultiDropdownWebElement(com.github.bordertech.wcomponents.test.selenium.element.SeleniumWMultiDropdownWebElement) Test(org.junit.Test)

Example 3 with SeleniumWMultiDropdownWebElement

use of com.github.bordertech.wcomponents.test.selenium.element.SeleniumWMultiDropdownWebElement in project wcomponents by BorderTech.

the class WMultiDropdownTestingExample_Test method testGetRemoveButton.

@Test
public void testGetRemoveButton() {
    SeleniumWMultiDropdownWebElement component = getByLabel(WMultiDropdownTestingExample.LABEL_ALL_SELECTED);
    // anything other than 0 for this test
    WebElement dropdown = component.getDropdown(1);
    Assert.assertNotNull(component.getRemoveButton(dropdown));
}
Also used : SeleniumWMultiDropdownWebElement(com.github.bordertech.wcomponents.test.selenium.element.SeleniumWMultiDropdownWebElement) WebElement(org.openqa.selenium.WebElement) SeleniumWMultiDropdownWebElement(com.github.bordertech.wcomponents.test.selenium.element.SeleniumWMultiDropdownWebElement) Test(org.junit.Test)

Example 4 with SeleniumWMultiDropdownWebElement

use of com.github.bordertech.wcomponents.test.selenium.element.SeleniumWMultiDropdownWebElement in project wcomponents by BorderTech.

the class WMultiDropdownTestingExample_Test method testDeselect.

// TODO: need exception tests for select
@Test
public void testDeselect() {
    // to do: this needs to be beefed up a bit.
    try {
        SeleniumWMultiDropdownWebElement component = getByLabel(WMultiDropdownTestingExample.LABEL_ALL_SELECTED);
        List<WebElement> startSelection = component.getSelected();
        // cannot deselect the oth item: have to switch it.
        String text = WMultiDropdownTestingExample.DATA_LIST.get(1);
        component.deselect(text);
        List<WebElement> endSelection = component.getSelected();
        Assert.assertEquals(startSelection.size() - 1, endSelection.size());
        for (WebElement option : endSelection) {
            if (text.equalsIgnoreCase(option.getText())) {
                Assert.assertFalse("Should not have this in the selection", true);
            }
        }
    } finally {
        reset();
    }
}
Also used : SeleniumWMultiDropdownWebElement(com.github.bordertech.wcomponents.test.selenium.element.SeleniumWMultiDropdownWebElement) WebElement(org.openqa.selenium.WebElement) SeleniumWMultiDropdownWebElement(com.github.bordertech.wcomponents.test.selenium.element.SeleniumWMultiDropdownWebElement) Test(org.junit.Test)

Example 5 with SeleniumWMultiDropdownWebElement

use of com.github.bordertech.wcomponents.test.selenium.element.SeleniumWMultiDropdownWebElement in project wcomponents by BorderTech.

the class WMultiDropdownTestingExample_Test method testDeselectNotSelected.

@Test(expected = SystemException.class)
public void testDeselectNotSelected() {
    SeleniumWMultiDropdownWebElement component = getByLabel(WMultiDropdownTestingExample.LABEL_SOME_SELECTED);
    component.deselect(StringUtils.join(WMultiDropdownTestingExample.DATA_SOME_SELECTED, " "));
}
Also used : SeleniumWMultiDropdownWebElement(com.github.bordertech.wcomponents.test.selenium.element.SeleniumWMultiDropdownWebElement) Test(org.junit.Test)

Aggregations

SeleniumWMultiDropdownWebElement (com.github.bordertech.wcomponents.test.selenium.element.SeleniumWMultiDropdownWebElement)28 Test (org.junit.Test)25 WebElement (org.openqa.selenium.WebElement)9 Select (org.openqa.selenium.support.ui.Select)1