Search in sources :

Example 6 with DivElement

use of com.vaadin.flow.component.html.testbench.DivElement in project flow by vaadin.

the class ModelListIT method clickOnOldItems_itemsAreUpdated.

@Test
public void clickOnOldItems_itemsAreUpdated() {
    DivElement repeat1 = findRepeatByID("repeat-1");
    DivElement repeat2 = findRepeatByID("repeat-2");
    DivElement repeat3 = findRepeatByID("repeat-3");
    DivElement repeat4 = findRepeatByID("repeat-4");
    assertClickedStates();
    repeat1.findElements(By.tagName("div")).get(0).click();
    assertClickedStates(0);
    repeat2.findElements(By.tagName("div")).get(0).click();
    assertClickedStates(0, 2);
    repeat3.findElements(By.tagName("div")).get(0).click();
    assertClickedStates(0, 2, 4);
    repeat3.findElements(By.tagName("div")).get(2).click();
    assertClickedStates(0, 2, 4, 6);
    repeat4.findElements(By.tagName("div")).get(0).click();
    assertClickedStates(0, 2, 4, 6, 8);
    findRepeatByID("item-with-item-div").click();
    assertClickedStates(0, 2, 4, 6, 8, 10);
}
Also used : DivElement(com.vaadin.flow.component.html.testbench.DivElement) Test(org.junit.Test) ChromeBrowserTest(com.vaadin.flow.testutil.ChromeBrowserTest)

Example 7 with DivElement

use of com.vaadin.flow.component.html.testbench.DivElement in project flow by vaadin.

the class ModelListIT method setNullValues_itemsAreUpdated.

@Test
public void setNullValues_itemsAreUpdated() {
    DivElement repeat1 = findRepeatByID("repeat-1");
    DivElement repeat2 = findRepeatByID("repeat-2");
    DivElement repeat3 = findRepeatByID("repeat-3");
    DivElement repeat4 = findRepeatByID("repeat-4");
    assertClickedStates();
    modelList.$(NativeButtonElement.class).id("set-null").click();
    List<WebElement> repeated1 = repeat1.findElements(By.tagName("div"));
    List<WebElement> repeated2 = repeat2.findElements(By.tagName("div"));
    List<WebElement> repeated3 = repeat3.findElements(By.tagName("div"));
    List<WebElement> repeated4 = repeat4.findElements(By.tagName("div"));
    Assert.assertEquals("false", repeated1.get(0).getText());
    Assert.assertEquals("false", repeated1.get(1).getText());
    Assert.assertEquals("false", repeated2.get(0).getText());
    Assert.assertEquals("false", repeated2.get(1).getText());
    Assert.assertEquals("false", repeated3.get(0).getText());
    Assert.assertEquals("false", repeated3.get(1).getText());
    Assert.assertEquals("false", repeated4.get(0).getText());
    Assert.assertEquals("false", repeated4.get(1).getText());
}
Also used : DivElement(com.vaadin.flow.component.html.testbench.DivElement) WebElement(org.openqa.selenium.WebElement) Test(org.junit.Test) ChromeBrowserTest(com.vaadin.flow.testutil.ChromeBrowserTest)

Example 8 with DivElement

use of com.vaadin.flow.component.html.testbench.DivElement in project flow by vaadin.

the class PolymerTemplateWithoutShadowRootIT method componentMappedCorrectly.

@Test
public void componentMappedCorrectly() {
    open();
    DivElement content = $(DivElement.class).attribute("real", "deal").first();
    Assert.assertEquals("Hello", content.getText());
    DivElement special = $(DivElement.class).id("special!#id");
    Assert.assertEquals("Special", special.getText());
    DivElement map = $(DivElement.class).id("map");
    Assert.assertEquals("Map", map.getText());
    content.click();
    Assert.assertEquals("Goodbye", content.getText());
}
Also used : DivElement(com.vaadin.flow.component.html.testbench.DivElement) Test(org.junit.Test) ChromeBrowserTest(com.vaadin.flow.testutil.ChromeBrowserTest)

Example 9 with DivElement

use of com.vaadin.flow.component.html.testbench.DivElement in project flow by vaadin.

the class SimpleLitTemplateShadowRootIT method idMappingWorks.

@Test
public void idMappingWorks() {
    NativeButtonElement mappedButton = template.$(NativeButtonElement.class).id("mappedButton");
    Assert.assertEquals("Server button", mappedButton.getText());
    mappedButton.click();
    DivElement label = template.$(DivElement.class).id("label");
    Assert.assertEquals("Hello from server component event listener", label.getText());
    DivElement sortDiv = template.$(DivElement.class).id("sort");
    Assert.assertEquals("Sort", sortDiv.getText());
}
Also used : DivElement(com.vaadin.flow.component.html.testbench.DivElement) NativeButtonElement(com.vaadin.flow.component.html.testbench.NativeButtonElement) Test(org.junit.Test) ChromeBrowserTest(com.vaadin.flow.testutil.ChromeBrowserTest)

Example 10 with DivElement

use of com.vaadin.flow.component.html.testbench.DivElement in project flow by vaadin.

the class ElementInnerHtmlIT method elementInitOrder.

@Test
public void elementInitOrder() {
    open();
    DivElement innerHtml = $(DivElement.class).id("inner-html-field");
    Assert.assertEquals("", innerHtml.getPropertyString("innerHTML"));
    $(NativeButtonElement.class).id("set-foo").click();
    Assert.assertEquals("<p>Foo</p>", innerHtml.getPropertyString("innerHTML"));
    $(NativeButtonElement.class).id("set-foo").click();
    Assert.assertEquals("<p>Foo</p>", innerHtml.getPropertyString("innerHTML"));
    $(NativeButtonElement.class).id("set-boo").click();
    Assert.assertEquals("<p>Boo</p>", innerHtml.getPropertyString("innerHTML"));
    $(NativeButtonElement.class).id("set-boo").click();
    Assert.assertEquals("<p>Boo</p>", innerHtml.getPropertyString("innerHTML"));
    $(NativeButtonElement.class).id("set-null").click();
    Assert.assertEquals("", innerHtml.getPropertyString("innerHTML"));
}
Also used : DivElement(com.vaadin.flow.component.html.testbench.DivElement) Test(org.junit.Test) ChromeBrowserTest(com.vaadin.flow.testutil.ChromeBrowserTest)

Aggregations

DivElement (com.vaadin.flow.component.html.testbench.DivElement)12 ChromeBrowserTest (com.vaadin.flow.testutil.ChromeBrowserTest)11 Test (org.junit.Test)11 NativeButtonElement (com.vaadin.flow.component.html.testbench.NativeButtonElement)2 WebElement (org.openqa.selenium.WebElement)2 LabelElement (com.vaadin.flow.component.html.testbench.LabelElement)1 ArrayList (java.util.ArrayList)1