use of com.github.bordertech.wcomponents.test.selenium.element.SeleniumWMultiSelectPairWebElement in project wcomponents by BorderTech.
the class WMultiSelectPairTestingExample_Test method testDeselect.
@Test
public void testDeselect() {
SeleniumWMultiSelectPairWebElement msp = getExampleWithSelection();
for (String shape : SHAPES) {
Assert.assertTrue(msp.isSelected(shape));
msp.deselect(shape);
Assert.assertFalse(msp.isSelected(shape));
}
}
use of com.github.bordertech.wcomponents.test.selenium.element.SeleniumWMultiSelectPairWebElement in project wcomponents by BorderTech.
the class WMultiSelectPairTestingExample_Test method testGetSelected.
@Test
public void testGetSelected() {
int expected = SHAPES.length;
Assert.assertEquals(expected, getExampleWithSelection().getSelected().size());
Assert.assertEquals(expected, getExampleReadOnlyWithSelection().getSelected().size());
Assert.assertTrue(CollectionUtils.isEmpty(getExampleDisabledWithSelection().getSelected()));
Assert.assertTrue(CollectionUtils.isEmpty(getExampleNoSelection().getSelected()));
Assert.assertTrue(CollectionUtils.isEmpty(getExampleRadOnlyNoSelection().getSelected()));
SeleniumWMultiSelectPairWebElement msp = getExampleWithSomeSelection();
List<WebElement> options = msp.getSelected();
Assert.assertEquals(3, options.size());
String text;
for (WebElement option : options) {
boolean found = false;
text = option.getText();
for (String shape : SHAPES) {
if (shape.equals(text)) {
found = true;
break;
}
}
Assert.assertTrue("Expected to find a match", found);
}
}
use of com.github.bordertech.wcomponents.test.selenium.element.SeleniumWMultiSelectPairWebElement in project wcomponents by BorderTech.
the class WMultiSelectPairTestingExample_Test method testDeselectAll.
@Test
public void testDeselectAll() {
SeleniumWMultiSelectPairWebElement msp = getExampleWithSelection();
for (String shape : SHAPES) {
Assert.assertTrue(msp.isSelected(shape));
}
msp.deselectAll();
for (String shape : SHAPES) {
Assert.assertFalse(msp.isSelected(shape));
}
}
use of com.github.bordertech.wcomponents.test.selenium.element.SeleniumWMultiSelectPairWebElement in project wcomponents by BorderTech.
the class WMultiSelectPairTestingExample_Test method testComponentProperties.
@Test
public void testComponentProperties() {
SeleniumWComponentsWebDriver driver = getDriver();
SeleniumWMultiSelectPairWebElement interactive = getExampleNoSelection();
SeleniumWMultiSelectPairWebElement disabled = getExampleDisabledWithSelection();
SeleniumWMultiSelectPairWebElement readOnly = getExampleReadOnlyWithSelection();
// isEnabled
Assert.assertTrue(interactive.isEnabled());
Assert.assertFalse(disabled.isEnabled());
Assert.assertFalse(readOnly.isEnabled());
// read-only
Assert.assertFalse(interactive.isReadOnly());
Assert.assertFalse(disabled.isReadOnly());
Assert.assertTrue(readOnly.isReadOnly());
// mandatory
Assert.assertFalse(interactive.isMandatory());
Assert.assertFalse(disabled.isMandatory());
Assert.assertFalse(readOnly.isMandatory());
SeleniumWMultiSelectPairWebElement msp = driver.findWMultiSelectPair(new ByLabel("Mandatory", false));
Assert.assertTrue(msp.isMandatory());
// hidden
Assert.assertTrue(interactive.isDisplayed());
Assert.assertTrue(disabled.isDisplayed());
Assert.assertTrue(readOnly.isDisplayed());
msp = driver.findWMultiSelectPair(new ByLabel("Hidden", false));
Assert.assertFalse(msp.isDisplayed());
}
Aggregations