use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class ChildOrderIT method prependElementsFromServer_elementsAreAddedBeforeExistingOnes.
@Test
public void prependElementsFromServer_elementsAreAddedBeforeExistingOnes() {
TestBenchElement container = root.$(TestBenchElement.class).id("containerWithElement");
assertNodeOrder(container, "Client child");
clickAndWaitForContainerToChange(container, "prependChildToContainer1");
assertNodeOrder(container, "Client child", "Server child 1");
clickAndWaitForContainerToChange(container, "prependChildToContainer1");
assertNodeOrder(container, "Client child", "Server child 2", "Server child 1");
clickAndWaitForContainerToChange(container, "addClientSideChildToContainer1");
assertNodeOrder(container, "Client child", "Server child 2", "Server child 1", "Client child");
clickAndWaitForContainerToChange(container, "prependChildToContainer1");
assertNodeOrder(container, "Client child", "Server child 3", "Server child 2", "Server child 1", "Client child");
clickAndWaitForContainerToChange(container, "removeChildFromContainer1");
assertNodeOrder(container, "Client child", "Server child 3", "Server child 2", "Client child");
clickAndWaitForContainerToChange(container, "removeChildFromContainer1");
assertNodeOrder(container, "Client child", "Server child 3", "Client child");
}
use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class ChildOrderIT method appendTextsFromServer_textsAreAddedAfterExistingOnes.
@Test
public void appendTextsFromServer_textsAreAddedAfterExistingOnes() {
TestBenchElement container = root.$(TestBenchElement.class).id("containerWithText");
assertNodeOrder(container, "Client text");
clickAndWaitForContainerToChange(container, "addChildToContainer2");
assertNodeOrder(container, "Client text", "Server text 1");
clickAndWaitForContainerToChange(container, "addChildToContainer2");
assertNodeOrder(container, "Client text", "Server text 1", "Server text 2");
clickAndWaitForContainerToChange(container, "addClientSideChildToContainer2");
assertNodeOrder(container, "Client text", "Server text 1", "Server text 2", "Client text");
/*
* Client side nodes added after the server side ones are not considered
* in the counting, so they are left behind
*/
clickAndWaitForContainerToChange(container, "addChildToContainer2");
assertNodeOrder(container, "Client text", "Server text 1", "Server text 2", "Server text 3", "Client text");
clickAndWaitForContainerToChange(container, "removeChildFromContainer2");
assertNodeOrder(container, "Client text", "Server text 1", "Server text 2", "Client text");
clickAndWaitForContainerToChange(container, "removeChildFromContainer2");
assertNodeOrder(container, "Client text", "Server text 1", "Client text");
}
use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class InjectScriptTagIT method openPage_scriptIsEscaped.
@Test
public void openPage_scriptIsEscaped() {
open();
TestBenchElement parent = $("inject-script-tag-template").first();
TestBenchElement div = parent.$(TestBenchElement.class).id("value-div");
Assert.assertEquals("<!-- <script>", div.getText());
WebElement slot = findElement(By.id("slot-1"));
Assert.assertEquals("<!-- <script> --><!-- <script></script>", slot.getText());
TestBenchElement button = parent.$(TestBenchElement.class).id("change-value");
button.click();
Assert.assertEquals("<!-- <SCRIPT>", div.getText());
slot = findElement(By.id("slot-2"));
Assert.assertEquals("<!-- <SCRIPT> --><!-- <SCRIPT></SCRIPT>", slot.getText());
}
use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class InjectsJsTemplateIT method executeJsOnInjectedElement.
@Test
public void executeJsOnInjectedElement() {
open();
TestBenchElement parent = $("injects-js-template").first();
TestBenchElement injectedTemplate = parent.$(TestBenchElement.class).id("injected-template");
WebElement fooLabel = injectedTemplate.$(TestBenchElement.class).id("foo-prop");
Assert.assertEquals("bar", fooLabel.getText());
WebElement bazLabel = injectedTemplate.$(TestBenchElement.class).id("baz-prop");
Assert.assertEquals("setFromParent", bazLabel.getText());
WebElement injectedDiv = parent.$(TestBenchElement.class).id("injected-div");
Assert.assertEquals("setFromParent", injectedDiv.getAttribute("class"));
}
use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class JsGrandParentIT method callJsInsideGrandInjected.
@Test
public void callJsInsideGrandInjected() {
open();
TestBenchElement parent = $("js-grand-parent").first();
TestBenchElement child = parent.$("js-sub-template").first();
TestBenchElement grandChild = child.$("js-injected-grand-child").first();
WebElement label = grandChild.$(TestBenchElement.class).id("foo-prop");
waitUntil(driver -> "bar".equals(label.getText()));
}
Aggregations