use of com.github.bordertech.wcomponents.test.selenium.driver.SeleniumWComponentsWebDriver in project wcomponents by BorderTech.
the class AjaxWDropdownExample_Test method testExample.
@Test
public void testExample() {
// Launch the web browser to the LDE
SeleniumWComponentsWebDriver driver = getDriver();
// Region and suburb drop-downs should be blank to begin with
Assert.assertTrue("Region drop-down should be empty", !driver.getPageSource().contains("Woden"));
Assert.assertTrue("Suburb drop-down should be empty", !driver.getPageSource().contains("Torrens"));
// Select "ACT" from State dropdown
driver.findElement(byWComponentPath("WDropdown[0]")).click();
driver.findElement(byWComponentPath("WDropdown[0]", "ACT")).click();
// Select "Woden" from Region dropdown
Assert.assertTrue("Region drop-down should contain 'Woden'", driver.getPageSource().contains("Woden"));
Assert.assertTrue("Suburb drop-down should be empty", !driver.getPageSource().contains("Torrens"));
driver.findElement(byWComponentPath("WDropdown[1]")).click();
driver.findElement(byWComponentPath("WDropdown[1]", "Woden")).click();
// Select "Torrens" from Suburb dropdown
Assert.assertTrue("Suburb drop-down should contain 'Torrens'", driver.getPageSource().contains("Torrens"));
driver.findElement(byWComponentPath("WDropdown[2]")).click();
driver.findElement(byWComponentPath("WDropdown[2]", "Torrens")).click();
// No server-side interaction for last dropdown
Assert.assertTrue("Incorrect suburb selection on client", driver.findElement(byWComponentPath("WDropdown[2]", "Torrens")).isSelected());
}
use of com.github.bordertech.wcomponents.test.selenium.driver.SeleniumWComponentsWebDriver in project wcomponents by BorderTech.
the class AppPreferenceParameterExample_Test method testExample.
@Test
public void testExample() {
// Launch the web browser to the LDE
SeleniumWComponentsWebDriver driver = getDriver();
// Note: When deployed to portal, the parameter "portlet.wcomponents-examples.example.preferred.state" will be used.
String preferenceParam = Config.getInstance().getString("example.preferred.state");
Assert.assertTrue("Incorrect default selection", driver.findElement(byWComponentPath("WDropdown", preferenceParam)).isSelected());
driver.findElement(byWComponentPath("WDropdown")).click();
driver.findElement(byWComponentPath("WDropdown", "")).click();
driver.findElement(byWComponentPath("WButton")).click();
Assert.assertTrue("Incorrect default selection", driver.findElement(byWComponentPath("WDropdown", preferenceParam)).isSelected());
}
use of com.github.bordertech.wcomponents.test.selenium.driver.SeleniumWComponentsWebDriver in project wcomponents by BorderTech.
the class AutoReFocusRepeaterExample_Test method testAutoReFocusWRadioButtons.
@Test
public void testAutoReFocusWRadioButtons() {
SeleniumWComponentsWebDriver driver = getDriver();
String[] paths = { ROOT_PATH + "[0]/WRadioButtonTriggerActionExample/WRadioButton", ROOT_PATH + "[1]/WRadioButtonTriggerActionExample/WRadioButton" };
for (String path : paths) {
driver.findWRadioButton(byWComponentPath(path)).getInputField().click();
Assert.assertEquals("Incorrect focus", driver.findWRadioButton(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 testSelectedCheckBox.
@Test
public void testSelectedCheckBox() {
SeleniumWComponentsWebDriver driver = getDriver();
Assert.assertTrue("Second checkbox should be selected", driver.findWCheckBox(byWComponentPath("WCheckBox[1]")).isSelected());
Assert.assertTrue("Second checkbox should be enabled", driver.findWCheckBox(byWComponentPath("WCheckBox[1]")).isEnabled());
}
use of com.github.bordertech.wcomponents.test.selenium.driver.SeleniumWComponentsWebDriver in project wcomponents by BorderTech.
the class EntryFieldExample_Test method testDefaultSubmit.
@Test
public void testDefaultSubmit() {
// Launch the web browser to the LDE
SeleniumWComponentsWebDriver driver = getDriver();
// Need to scroll the button into view, otherwise Selenium won't click it.
driver.findWTextArea(byWComponentPath("WTextArea")).getInputField().sendKeys(" ");
driver.findElement(byWComponentPath("WButton")).click();
String text = driver.findWTextArea(byWComponentPath("WTextArea")).getValue();
Assert.assertEquals("Incorrect text value", "Text 1 = blah blah" + "\nText 2 = abc" + "\nText 3 = abc" + "\nText 4 = " + "\nNumeric 1 = " + "\nNumeric 2 = " + "\nNumeric 3 = " + "\nEmail = " + "\nDrop 1 = One" + "\nMulti1 = " + "\nMulti2 = " + "\nMultiCb = " + "\nCheckboxes =" + "\n", text);
}
Aggregations