Search in sources :

Example 1 with SeleniumWMultiSelectPairWebElement

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()));
}
Also used : SeleniumWComponentsWebDriver(com.github.bordertech.wcomponents.test.selenium.driver.SeleniumWComponentsWebDriver) SeleniumWMultiSelectPairWebElement(com.github.bordertech.wcomponents.test.selenium.element.SeleniumWMultiSelectPairWebElement) ByLabel(com.github.bordertech.wcomponents.test.selenium.ByLabel) Test(org.junit.Test)

Example 2 with SeleniumWMultiSelectPairWebElement

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));
        }
    }
}
Also used : SeleniumWMultiSelectPairWebElement(com.github.bordertech.wcomponents.test.selenium.element.SeleniumWMultiSelectPairWebElement) Test(org.junit.Test)

Example 3 with SeleniumWMultiSelectPairWebElement

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));
    }
}
Also used : SeleniumWMultiSelectPairWebElement(com.github.bordertech.wcomponents.test.selenium.element.SeleniumWMultiSelectPairWebElement) Test(org.junit.Test)

Example 4 with SeleniumWMultiSelectPairWebElement

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());
    }
}
Also used : SeleniumWMultiSelectPairWebElement(com.github.bordertech.wcomponents.test.selenium.element.SeleniumWMultiSelectPairWebElement) Test(org.junit.Test)

Example 5 with SeleniumWMultiSelectPairWebElement

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));
    }
}
Also used : SeleniumWMultiSelectPairWebElement(com.github.bordertech.wcomponents.test.selenium.element.SeleniumWMultiSelectPairWebElement) Test(org.junit.Test)

Aggregations

SeleniumWMultiSelectPairWebElement (com.github.bordertech.wcomponents.test.selenium.element.SeleniumWMultiSelectPairWebElement)9 Test (org.junit.Test)9 ByLabel (com.github.bordertech.wcomponents.test.selenium.ByLabel)2 SeleniumWComponentsWebDriver (com.github.bordertech.wcomponents.test.selenium.driver.SeleniumWComponentsWebDriver)2 WebElement (org.openqa.selenium.WebElement)1