use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class PolymerDefaultPropertyValueIT method initialModelValues_polymerHasDefaultValues.
@Test
public void initialModelValues_polymerHasDefaultValues() {
open();
TestBenchElement template = $(TestBenchElement.class).id("template");
TestBenchElement text = template.$(TestBenchElement.class).id("text");
Assert.assertEquals("foo", text.getText());
TestBenchElement name = template.$(TestBenchElement.class).id("name");
Assert.assertEquals("bar", name.getText());
TestBenchElement msg = template.$(TestBenchElement.class).id("message");
Assert.assertEquals("updated-message", msg.getText());
TestBenchElement email = template.$(TestBenchElement.class).id("email");
Assert.assertEquals("foo@example.com", email.getText());
findElement(By.id("show-email")).click();
WebElement serverSideEmailValue = findElement(By.id("email-value"));
Assert.assertEquals("foo@example.com", serverSideEmailValue.getText());
}
use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class PolymerPropertiesIT method propertyAdd_propertyBecomesAvailable.
@Test
public void propertyAdd_propertyBecomesAvailable() {
open();
TestBenchElement template = $(TestBenchElement.class).id("template");
template.$(TestBenchElement.class).id("set-property").click();
TestBenchElement name = template.$(TestBenchElement.class).id("name");
Assert.assertEquals("foo", name.getText());
}
use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class PolymerPropertyMutationInObserverIT method property_mutation_inside_observers_synced_correctly.
@Test
public void property_mutation_inside_observers_synced_correctly() {
open();
List<WebElement> modelValueDivs = findElements(By.className("model-value"));
Assert.assertEquals("Value changed twice initially", 2, modelValueDivs.size());
Assert.assertEquals("First value change should equal the initially set server side value", "Event old value: null, event value: initially set value, current model value: initially set value", modelValueDivs.get(0).getText());
Assert.assertEquals("Observer mutation has been transmitted to the server", "Event old value: initially set value, event value: mutated, current model value: mutated", modelValueDivs.get(1).getText());
TestBenchElement template = $(TestBenchElement.class).id("template");
template.$(TestBenchElement.class).id("input").sendKeys(Keys.BACK_SPACE);
modelValueDivs = findElements(By.className("model-value"));
Assert.assertEquals("Value changed 4 times in total after backspace", 4, modelValueDivs.size());
Assert.assertEquals("User action mutation synced to server", "Event old value: mutated, event value: mutate, current model value: mutated", modelValueDivs.get(2).getText());
Assert.assertEquals("Observer mutation acting on the user action mutation synced to server", "Event old value: mutate, event value: mutated, current model value: mutated", modelValueDivs.get(3).getText());
}
use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class BeanInListingIT method assertSelectionValue.
private void assertSelectionValue(String className, WebElement selected, String item) {
TestBenchElement template = $(TestBenchElement.class).id("template");
List<TestBenchElement> items = template.$(TestBenchElement.class).attribute("class", className).all();
items.stream().filter(itemElement -> itemElement.getText().equals(item)).findFirst().get().click();
waitUntil(new SelectedCondition(selected, item));
}
use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class BasicTypeInListIT method basicTypeInModeList.
@Test
public void basicTypeInModeList() {
open();
TestBenchElement template = $(TestBenchElement.class).id("template");
List<TestBenchElement> items = template.$(TestBenchElement.class).attribute("class", "item").all();
Assert.assertEquals(2, items.size());
Assert.assertEquals("foo", items.get(0).getText());
Assert.assertEquals("bar", items.get(1).getText());
findElement(By.id("add")).click();
items = template.$(TestBenchElement.class).attribute("class", "item").all();
Assert.assertEquals(3, items.size());
Assert.assertEquals("newItem", items.get(2).getText());
findElement(By.id("remove")).click();
items = template.$(TestBenchElement.class).attribute("class", "item").all();
Assert.assertEquals(2, items.size());
Assert.assertEquals("bar", items.get(0).getText());
}
Aggregations