use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class ClearNodeChildrenIT method processContainerWithTextNodes_allNodesAreRemoved.
private void processContainerWithTextNodes_allNodesAreRemoved(String buttonToClick, String expectedMessage, String expectedInnerText) {
TestBenchElement container = root.$(TestBenchElement.class).id("containerWithMixedChildren");
Assert.assertThat(container.getText(), CoreMatchers.allOf(CoreMatchers.containsString("Some text 1"), CoreMatchers.containsString("Some text 2"), CoreMatchers.containsString("Some text 3")));
List<WebElement> divs = container.findElements(By.tagName("div"));
Assert.assertEquals(2, divs.size());
TestBenchElement button = root.$(TestBenchElement.class).id(buttonToClick);
String oldTtext = message.getText();
button.click();
waitForMessageToChange(oldTtext);
assertMessageEndsWith(expectedMessage);
divs = container.findElements(By.tagName("div"));
Assert.assertEquals(0, divs.size());
Assert.assertEquals(expectedInnerText, container.getAttribute("innerText"));
}
use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class ClearNodeChildrenIT method processContainerWithClientAndServerSideNodes_allNodesAreRemoved_serverNodesAreDetached.
private void processContainerWithClientAndServerSideNodes_allNodesAreRemoved_serverNodesAreDetached(String buttonToClick, String expectedMessage, String expectedInnerText) {
TestBenchElement container = root.$(TestBenchElement.class).id("containerWithElementChildren");
List<WebElement> divs = container.findElements(By.tagName("div"));
Assert.assertEquals(2, divs.size());
TestBenchElement add = root.$(TestBenchElement.class).id("addChildToContainer1");
String oldTtext = message.getText();
add.click();
waitForMessageToChange(oldTtext);
assertMessageEndsWith("Div 'Server div 1' attached.");
divs = container.findElements(By.tagName("div"));
Assert.assertEquals(3, divs.size());
TestBenchElement button = root.$(TestBenchElement.class).id(buttonToClick);
oldTtext = message.getText();
button.click();
waitForMessageToChange(oldTtext);
assertMessageEndsWith(expectedMessage);
divs = container.findElements(By.tagName("div"));
Assert.assertEquals(0, divs.size());
Assert.assertEquals(expectedInnerText, container.getAttribute("innerText"));
}
use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class ClearNodeChildrenIT method addNodeToSlot_processContainer_allNodesAreRemoved_serverNodesAreDetached.
private void addNodeToSlot_processContainer_allNodesAreRemoved_serverNodesAreDetached(String buttonToClick, String expectedMessage, String expectedInnerText) {
List<WebElement> divs = root.findElements(By.tagName("div"));
Assert.assertEquals(0, divs.size());
TestBenchElement add = root.$(TestBenchElement.class).id("addChildToSlot");
String oldTtext = message.getText();
add.click();
waitForMessageToChange(oldTtext);
assertMessageEndsWith("Div 'Server div 1' attached.");
TestBenchElement button = root.$(TestBenchElement.class).id(buttonToClick);
oldTtext = message.getText();
button.click();
waitForMessageToChange(oldTtext);
assertMessageEndsWith(expectedMessage);
divs = root.findElements(By.tagName("div"));
Assert.assertEquals(0, divs.size());
Assert.assertEquals(expectedInnerText, root.getAttribute("innerText"));
}
use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class ClearNodeChildrenIT method processContainerWithClientSideNodes_allNodesAreRemoved.
private void processContainerWithClientSideNodes_allNodesAreRemoved(String buttonToClick, String expectedMessage, String expectedInnerText) {
TestBenchElement container = root.$(TestBenchElement.class).id("containerWithElementChildren");
List<WebElement> divs = container.findElements(By.tagName("div"));
Assert.assertEquals(2, divs.size());
TestBenchElement button = root.$(TestBenchElement.class).id(buttonToClick);
String oldTtext = message.getText();
button.click();
waitForMessageToChange(oldTtext);
assertMessageEndsWith(expectedMessage);
divs = container.findElements(By.tagName("div"));
Assert.assertEquals(0, divs.size());
Assert.assertEquals(expectedInnerText, container.getAttribute("innerText"));
}
use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class ClearNodeChildrenIT method addTextNode_processContainerWithClientSideNodes_allNodesAreRemoved.
private void addTextNode_processContainerWithClientSideNodes_allNodesAreRemoved(String buttonToClick, String expectedMessage, String expectedInnerText) {
TestBenchElement container = root.$(TestBenchElement.class).id("containerWithElementChildren");
List<WebElement> divs = container.findElements(By.tagName("div"));
Assert.assertEquals(2, divs.size());
TestBenchElement addTextNode = root.$(TestBenchElement.class).id("addTextNodeToContainer1");
String oldTtext = message.getText();
addTextNode.click();
waitForMessageToChange(oldTtext);
assertMessageEndsWith("Added 'Text node' to div with id 'containerWithElementChildren'.");
TestBenchElement button = root.$(TestBenchElement.class).id(buttonToClick);
oldTtext = message.getText();
button.click();
waitForMessageToChange(oldTtext);
assertMessageEndsWith(expectedMessage);
divs = container.findElements(By.tagName("div"));
Assert.assertEquals(0, divs.size());
Assert.assertEquals(expectedInnerText, container.getAttribute("innerText"));
}
Aggregations