Search in sources :

Example 6 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)

Example 7 with SeleniumWMultiSelectPairWebElement

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

Example 8 with SeleniumWMultiSelectPairWebElement

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

Example 9 with SeleniumWMultiSelectPairWebElement

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());
}
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)

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