use of com.github.bordertech.wcomponents.test.selenium.driver.SeleniumWComponentsWebDriver in project wcomponents by BorderTech.
the class WDropdownOptionsExample_Test method testExampleAjax.
/**
* Ajax test.
*/
@Test
public void testExampleAjax() {
WDropdownOptionsExample example = (WDropdownOptionsExample) getUi();
// Launch the web browser to the LDE
SeleniumWComponentsWebDriver driver = getDriver();
WDropdown.DropdownType type = WDropdown.DropdownType.NATIVE;
configureDropDown(driver, type, 2);
UIContext uic = getUserContextForSession();
UIContextHolder.pushContext(uic);
try {
WDropdown dropdown = (WDropdown) TreeUtil.findWComponent(example, new String[] { "WDropdown" }).getComponent();
List<?> options = dropdown.getOptions();
for (Object option : options) {
driver.findElement(byWComponent(dropdown, option)).click();
Assert.assertEquals("Incorrect option selected", option, dropdown.getSelected());
Assert.assertEquals("Incorrect text field text", option, driver.findElement(byWComponentPath("WDropdownOptionsExample/WPanel[1]")).getText());
}
} finally {
UIContextHolder.popContext();
}
}
use of com.github.bordertech.wcomponents.test.selenium.driver.SeleniumWComponentsWebDriver in project wcomponents by BorderTech.
the class WDropdownSpaceHandlingExample_Test method testDropdown.
@Test
public void testDropdown() {
WDropdownSpaceHandlingExample example = (WDropdownSpaceHandlingExample) getUi();
// Launch the web browser to the LDE
SeleniumWComponentsWebDriver driver = getDriver();
UIContext uic = getUserContextForSession();
UIContextHolder.pushContext(uic);
try {
WDropdown dropdown = (WDropdown) TreeUtil.findWComponent(example, new String[] { "WDropdown" }).getComponent();
List<?> options = dropdown.getOptions();
for (Object option : options) {
driver.findElement(byWComponent(dropdown, option)).click();
driver.findElement(byWComponentPath("WButton")).click();
Assert.assertEquals("Incorrect option selected", option, dropdown.getSelected());
}
} finally {
UIContextHolder.popContext();
}
}
use of com.github.bordertech.wcomponents.test.selenium.driver.SeleniumWComponentsWebDriver in project wcomponents by BorderTech.
the class WDropdownSpaceHandlingExample_Test method testCheckbox.
@Test
public void testCheckbox() {
WDropdownSpaceHandlingExample example = (WDropdownSpaceHandlingExample) getUi();
// Launch the web browser to the LDE
SeleniumWComponentsWebDriver driver = getDriver();
UIContext uic = getUserContextForSession();
UIContextHolder.pushContext(uic);
try {
WCheckBoxSelect group = (WCheckBoxSelect) TreeUtil.findWComponent(example, new String[] { "WCheckBoxSelect" }).getComponent();
List<?> options = group.getOptions();
for (Object option : options) {
driver.findElement(byWComponent(group, option)).click();
driver.findElement(byWComponentPath("WButton")).click();
Assert.assertEquals("Incorrect option selected", option, group.getSelected().get(0));
// De-select option
driver.findElement(byWComponent(group, option)).click();
}
} finally {
UIContextHolder.popContext();
}
}
Aggregations