use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class TemplateHasInjectedSubTemplateIT method injectedSubTemplate_injectedInstanceWorks.
@Test
public void injectedSubTemplate_injectedInstanceWorks() throws InterruptedException {
open();
TestBenchElement template = $(TestBenchElement.class).id("template");
TestBenchElement child = template.$(TestBenchElement.class).id("child");
TestBenchElement text = child.$(TestBenchElement.class).id("text");
Assert.assertEquals("foo", text.getText());
template.$(TestBenchElement.class).id("button").click();
waitUntil(driver -> "bar".equals(text.getText()));
}
use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class TemplateInTemplateWithIdIT method childTemplateInstanceHandlesEvent.
@Test
public void childTemplateInstanceHandlesEvent() {
open();
TestBenchElement template = $(TestBenchElement.class).id("template");
TestBenchElement child = template.$(TestBenchElement.class).id("child");
WebElement text = child.$(TestBenchElement.class).id("text");
Assert.assertEquals("@Id injected!", text.getText());
}
use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class TemplatesVisibilityIT method grandParentVisibility_descendantsAreBound.
@Test
public void grandParentVisibility_descendantsAreBound() {
open();
TestBenchElement grandParent = $("js-grand-parent").first();
TestBenchElement subTemplate = grandParent.$("js-sub-template").first();
// Check child and grand child property values. They shouldn't be set
// since the elements are not bound
TestBenchElement subTemplateProp = subTemplate.$(TestBenchElement.class).id("prop");
TestBenchElement grandChild = subTemplate.$(TestBenchElement.class).id("js-grand-child");
WebElement grandChildFooProp = grandChild.$(TestBenchElement.class).id("foo-prop");
WebElement grandChildProp = assertInitialPropertyValues(subTemplateProp, grandChild, grandChildFooProp);
// make parent visible
findElement(By.id("grand-parent-visibility")).click();
// now all descendants should be bound and JS is executed for the
// grandchild
assertBound(subTemplateProp, grandChildFooProp, grandChildProp);
}
use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class TemplatesVisibilityIT method subTemplateVisibility_grandChildIsBound.
@Test
public void subTemplateVisibility_grandChildIsBound() {
open();
TestBenchElement grandParent = $("js-grand-parent").first();
TestBenchElement subTemplate = grandParent.$("js-sub-template").first();
// make sub template invisible
findElement(By.id("sub-template-visibility")).click();
// nothing has changed: parent is not bound -> descendants are still not
// bound
TestBenchElement subTemplateProp = subTemplate.$(TestBenchElement.class).id("prop");
TestBenchElement grandChild = subTemplate.$(TestBenchElement.class).id("js-grand-child");
WebElement grandChildFooProp = grandChild.$(TestBenchElement.class).id("foo-prop");
assertInitialPropertyValues(subTemplateProp, grandChild, grandChildFooProp);
// make parent visible
findElement(By.id("grand-parent-visibility")).click();
// sub template is invisible now, again: all properties have no values
WebElement grandChildProp = assertInitialPropertyValues(subTemplateProp, grandChild, grandChildFooProp);
// make sub template visible
findElement(By.id("sub-template-visibility")).click();
// now everything is bound
assertBound(subTemplateProp, grandChildFooProp, grandChildProp);
}
use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class TemplatesVisibilityIT method grandChildVisibility_grandChildIsBound.
@Test
public void grandChildVisibility_grandChildIsBound() {
open();
TestBenchElement grandParent = $("js-grand-parent").first();
TestBenchElement subTemplate = grandParent.$("js-sub-template").first();
// make grand child template invisible
findElement(By.id("grand-child-visibility")).click();
// nothing has changed: parent is not bound -> descendants are still not
// bound
TestBenchElement subTemplateProp = subTemplate.$(TestBenchElement.class).id("prop");
TestBenchElement grandChild = subTemplate.$(TestBenchElement.class).id("js-grand-child");
WebElement grandChildFooProp = grandChild.$(TestBenchElement.class).id("foo-prop");
assertInitialPropertyValues(subTemplateProp, grandChild, grandChildFooProp);
// make grand parent visible
findElement(By.id("grand-parent-visibility")).click();
// grand child template is invisible now, again: all its properties have
// no values
WebElement grandChildProp = grandChild.$(TestBenchElement.class).id("prop");
Assert.assertNotEquals("bar", grandChildFooProp.getText());
Assert.assertNotEquals("foo", grandChildProp.getText());
// make grand child template visible
findElement(By.id("grand-child-visibility")).click();
// now everything is bound
assertBound(subTemplateProp, grandChildFooProp, grandChildProp);
}
Aggregations