use of com.github.bordertech.wcomponents.test.selenium.ByLabel in project wcomponents by BorderTech.
the class WLabelExample_Test method testGetByLabelReadOnlyPartial.
@Test
public void testGetByLabelReadOnlyPartial() {
String labelText = "for a read only";
SeleniumWComponentsWebDriver driver = getDriver();
SeleniumWComponentWebElement expected = driver.findElement(byWComponentPath("WTextField[2]"));
SeleniumWComponentWebElement actual = driver.findElement(new ByLabel(labelText, true));
Assert.assertEquals(expected.getAttribute("id"), actual.getAttribute("id"));
}
use of com.github.bordertech.wcomponents.test.selenium.ByLabel in project wcomponents by BorderTech.
the class WLabelExample_Test method testGetByLabelSimplePartial.
@Test
public void testGetByLabelSimplePartial() {
String labelText = "Normal input";
SeleniumWComponentsWebDriver driver = getDriver();
SeleniumWComponentWebElement expected = driver.findElement(byWComponentPath("WTextField[0]"));
SeleniumWComponentWebElement actual = driver.findElement(new ByLabel(labelText, true));
Assert.assertEquals(expected.getAttribute("id"), actual.getAttribute("id"));
}
use of com.github.bordertech.wcomponents.test.selenium.ByLabel in project wcomponents by BorderTech.
the class WRadioButtonSelectExample_Test method testGetOptions.
@Test
public void testGetOptions() {
SeleniumWComponentsWebDriver driver = getDriver();
Assert.assertEquals(9, getExampleNoSelection().getOptions().size());
Assert.assertEquals(9, getDisabledExample().getOptions().size());
Assert.assertTrue(CollectionUtils.isEmpty(getReadOnlyExampleNoSelection().getOptions()));
// interactive but no options
Assert.assertTrue(CollectionUtils.isEmpty(driver.findWRadioButtonSelect(new ByLabel("Select from no options", false)).getOptions()));
}
use of com.github.bordertech.wcomponents.test.selenium.ByLabel in project wcomponents by BorderTech.
the class WCheckBoxExample_Test method testFindByLabelTextPartial.
/**
* Test that ByLabel works for CheckBoxes by label text partial match.
*/
@Test
public void testFindByLabelTextPartial() {
// Launch the web browser to the LDE
WebDriver driver = getDriver();
// Case sensitive match on partial text.
List<WebElement> checkBoxes = driver.findElements(new ByLabel("check box", true));
Assert.assertNotNull("Unable to find checkboxes by label text partial match", checkBoxes);
Assert.assertEquals("Incorrect number of check boxes found by partial text match", 5, checkBoxes.size());
}
use of com.github.bordertech.wcomponents.test.selenium.ByLabel in project wcomponents by BorderTech.
the class WCheckBoxExample_Test method testFindByLabelTextExact.
/**
* Test that ByLabel works for CheckBoxes by label text exact match.
*/
@Test
public void testFindByLabelTextExact() {
// Launch the web browser to the LDE
WebDriver driver = getDriver();
WContainer container = (WContainer) getUi();
WFieldLayout layout = (WFieldLayout) container.getChildAt(0);
WField field = (WField) layout.getChildAt(0);
String labelText = field.getLabel().getText();
String componentId = field.getField().getId();
WebElement checkBox = driver.findElement(new ByLabel(labelText, false));
Assert.assertNotNull("Unable to find checkbox by label text", checkBox);
Assert.assertEquals("Checkbox element ID does not match expected", componentId, checkBox.getAttribute("id"));
}
Aggregations