use of com.github.bordertech.wcomponents.test.selenium.element.SeleniumWMultiSelectPairWebElement in project wcomponents by BorderTech.
the class WMultiSelectPairTestingExample_Test method testGetOptions.
@Test
public void testGetOptions() {
SeleniumWComponentsWebDriver driver = getDriver();
int expected = SHAPES.length;
// get options should get a single ArrayList containing all of the same options as in SHAPES
Assert.assertEquals(expected, getExampleNoSelection().getOptions().size());
Assert.assertEquals(expected, getExampleWithSelection().getOptions().size());
Assert.assertEquals(expected, getExampleReadOnlyWithSelection().getOptions().size());
Assert.assertEquals(expected, getExampleDisabledWithSelection().getOptions().size());
Assert.assertEquals(expected, getExampleWithSomeSelection().getOptions().size());
// read-only with no selection has no options
Assert.assertTrue(CollectionUtils.isEmpty(getExampleRadOnlyNoSelection().getOptions()));
// make sure we are not erroring when we have no options
SeleniumWMultiSelectPairWebElement msp = driver.findWMultiSelectPair(new ByLabel("No options", false));
Assert.assertTrue(CollectionUtils.isEmpty(msp.getOptions()));
}
use of com.github.bordertech.wcomponents.test.selenium.element.SeleniumWMultiSelectPairWebElement in project wcomponents by BorderTech.
the class WMultiSelectPairTestingExample_Test method testIsSelected.
@Test
public void testIsSelected() {
SeleniumWMultiSelectPairWebElement noSelection = getExampleNoSelection();
SeleniumWMultiSelectPairWebElement withSelection = getExampleWithSelection();
SeleniumWMultiSelectPairWebElement disabled = getExampleDisabledWithSelection();
SeleniumWMultiSelectPairWebElement readOnly = getExampleReadOnlyWithSelection();
SeleniumWMultiSelectPairWebElement readOnlyNoSelection = getExampleRadOnlyNoSelection();
SeleniumWMultiSelectPairWebElement someSelected = getExampleWithSomeSelection();
int i = 0;
for (String shape : SHAPES) {
Assert.assertFalse(noSelection.isSelected(shape));
Assert.assertTrue(withSelection.isSelected(shape));
Assert.assertFalse(disabled.isSelected(shape));
Assert.assertTrue(readOnly.isSelected(shape));
Assert.assertFalse(readOnlyNoSelection.isSelected(shape));
if (i++ % 2 == 0) {
Assert.assertTrue(someSelected.isSelected(shape));
} else {
Assert.assertFalse(someSelected.isSelected(shape));
}
}
}
use of com.github.bordertech.wcomponents.test.selenium.element.SeleniumWMultiSelectPairWebElement in project wcomponents by BorderTech.
the class WMultiSelectPairTestingExample_Test method testSelect.
@Test
public void testSelect() {
SeleniumWMultiSelectPairWebElement msp = getExampleNoSelection();
for (String shape : SHAPES) {
Assert.assertFalse(msp.isSelected(shape));
msp.select(shape);
Assert.assertTrue(msp.isSelected(shape));
}
}
use of com.github.bordertech.wcomponents.test.selenium.element.SeleniumWMultiSelectPairWebElement in project wcomponents by BorderTech.
the class WMultiSelectPairTestingExample_Test method testGetOption.
@Test
public void testGetOption() {
SeleniumWMultiSelectPairWebElement noSelection = getExampleNoSelection();
SeleniumWMultiSelectPairWebElement withSelection = getExampleWithSelection();
SeleniumWMultiSelectPairWebElement disabled = getExampleDisabledWithSelection();
SeleniumWMultiSelectPairWebElement readOnly = getExampleReadOnlyWithSelection();
SeleniumWMultiSelectPairWebElement msp = getExampleWithSomeSelection();
for (String text : SHAPES) {
Assert.assertEquals(text, noSelection.getOption(text).getText());
Assert.assertEquals(text, withSelection.getOption(text).getText());
Assert.assertEquals(text, readOnly.getOption(text).getText());
Assert.assertEquals(text, disabled.getOption(text).getText());
Assert.assertEquals(text, msp.getOption(text).getText());
}
}
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));
}
}
Aggregations