use of com.github.bordertech.wcomponents.test.selenium.driver.SeleniumWComponentsWebDriver in project wcomponents by BorderTech.
the class AutoReFocusExample_Test method testAutoRefocusWButton.
@Test
public void testAutoRefocusWButton() {
SeleniumWComponentsWebDriver driver = getDriver();
String path = "TextDuplicator/WButton";
driver.findElement(byWComponentPath(path)).click();
Assert.assertEquals("Incorrect focus", driver.findElement(byWComponentPath(path)).getActiveId(), driver.switchTo(true).activeElement().getAttribute("id"));
}
use of com.github.bordertech.wcomponents.test.selenium.driver.SeleniumWComponentsWebDriver in project wcomponents by BorderTech.
the class AutoReFocusExample_Test method testRefocusWDropdown.
@Test
public void testRefocusWDropdown() {
SeleniumWComponentsWebDriver driver = getDriver();
String path = "WDropdownSubmitOnChangeExample/WDropdown[0]";
driver.findWDropdown(byWComponentPath(path)).click();
UIContext uic = getUserContextForSession();
UIContextHolder.pushContext(uic);
try {
// The dropdowns in the example need something to be selected to trigger the submit
WComponent comp = TreeUtil.findWComponent(getUi(), path.split("/")).getComponent();
if (comp instanceof WDropdown) {
WDropdown dropdown = (WDropdown) comp;
driver.findElement(byWComponentPath(path, dropdown.getOptions().get(1))).click();
}
} finally {
UIContextHolder.popContext();
}
Assert.assertEquals("Incorrect focus", driver.findWDropdown(byWComponentPath(path)).getActiveId(), driver.switchTo(true).activeElement().getAttribute("id"));
}
use of com.github.bordertech.wcomponents.test.selenium.driver.SeleniumWComponentsWebDriver in project wcomponents by BorderTech.
the class AutoReFocusRepeaterExample_Test method testAutoReFocusWDropdowns.
@Test
public void testAutoReFocusWDropdowns() {
SeleniumWComponentsWebDriver driver = getDriver();
String[] paths = { ROOT_PATH + "[0]/AutoReFocusExample/WDropdown", ROOT_PATH + "[1]/AutoReFocusExample/WDropdown" };
for (String path : paths) {
driver.findWDropdown(byWComponentPath(path)).getInputField().click();
UIContext uic = getUserContextForSession();
UIContextHolder.pushContext(uic);
try {
// The dropdowns in the example need something to be selected to trigger the submit
WComponent comp = TreeUtil.findWComponent(getUi(), path.split("/"), false).getComponent();
if (comp instanceof WDropdown) {
WDropdown dropdown = (WDropdown) comp;
driver.findElement(byWComponentPath(path, dropdown.getOptions().get(1))).click();
}
} finally {
UIContextHolder.popContext();
}
Assert.assertEquals("Incorrect focus", driver.findWDropdown(byWComponentPath(path)).getActiveId(), driver.switchTo(true).activeElement().getAttribute("id"));
}
}
use of com.github.bordertech.wcomponents.test.selenium.driver.SeleniumWComponentsWebDriver in project wcomponents by BorderTech.
the class CheckBoxExample_Test method testDisabledCheckBox.
@Test
public void testDisabledCheckBox() {
SeleniumWComponentsWebDriver driver = getDriver();
Assert.assertFalse("Third checkbox should be unselected", driver.findWCheckBox(byWComponentPath("WCheckBox[2]")).isSelected());
Assert.assertFalse("Third checkbox should be disabled", driver.findWCheckBox(byWComponentPath("WCheckBox[2]")).isEnabled());
}
use of com.github.bordertech.wcomponents.test.selenium.driver.SeleniumWComponentsWebDriver in project wcomponents by BorderTech.
the class CheckBoxExample_Test method testExample.
@Test
public void testExample() {
SeleniumWComponentsWebDriver driver = getDriver();
Assert.assertFalse("First checkbox should be unselected", driver.findWCheckBox(byWComponentPath("WCheckBox[0]")).isSelected());
Assert.assertTrue("First checkbox should be enabled", driver.findWCheckBox(byWComponentPath("WCheckBox[0]")).isEnabled());
}
Aggregations