Search in sources :

Example 31 with TestBenchElement

use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.

the class DnDIT method testCopyEffectElement_disableTarget_dragOverTargetNotPresent.

@Test
public void testCopyEffectElement_disableTarget_dragOverTargetNotPresent() {
    open();
    TestBenchElement boxElement = getBoxElement("COPY");
    TestBenchElement targetElement = getLaneElement("COPY");
    clickElementWithJs("button-disable-enable-drop-targets");
    Assert.assertTrue("Invalid enabled state found in drop target", targetElement.hasAttribute("disabled"));
    dragElementOver(boxElement, targetElement);
    Assert.assertFalse(targetElement.hasClassName("v-drag-over-target"));
}
Also used : TestBenchElement(com.vaadin.testbench.TestBenchElement) ChromeBrowserTest(com.vaadin.flow.testutil.ChromeBrowserTest) Test(org.junit.Test)

Example 32 with TestBenchElement

use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.

the class DnDIT method verifyDropEvent.

private void verifyDropEvent(int i, TestBenchElement boxElement, TestBenchElement laneElement) {
    TestBenchElement eventlog = getEventlog(i);
    String effectAllowed = boxElement.getText();
    String dropEffect = laneElement.getText();
    String expected = new StringBuilder().append(i).append(": Drop: ").append(effectAllowed).append(" ").append(dropEffect).toString();
    Assert.assertEquals("Invalid drop event details", expected, eventlog.getText());
}
Also used : TestBenchElement(com.vaadin.testbench.TestBenchElement)

Example 33 with TestBenchElement

use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.

the class DnDIT method testCopyEffectElement_droppedToAllLanes.

@Test
public void testCopyEffectElement_droppedToAllLanes() {
    open();
    TestBenchElement boxElement = getBoxElement("COPY");
    // not testing with the lane that does not have drop effect set, because
    // that just causes complex mocking logic and doesn't validate
    // anything else
    dragBoxToLanes(boxElement, getLaneElement("COPY"), true);
    dragBoxToLanes(boxElement, getLaneElement("MOVE"), false);
    dragBoxToLanes(boxElement, getLaneElement("LINK"), false);
    dragBoxToLanes(boxElement, getLaneElement("NONE"), false);
}
Also used : TestBenchElement(com.vaadin.testbench.TestBenchElement) ChromeBrowserTest(com.vaadin.flow.testutil.ChromeBrowserTest) Test(org.junit.Test)

Example 34 with TestBenchElement

use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.

the class DnDIT method verifyStartEvent.

private void verifyStartEvent(int i, TestBenchElement boxElement) {
    TestBenchElement eventlog = getEventlog(i);
    String expected = new StringBuilder().append(i).append(": Start: ").append(boxElement.getText()).toString();
    Assert.assertEquals("Invalid start event details", expected, eventlog.getText());
}
Also used : TestBenchElement(com.vaadin.testbench.TestBenchElement)

Example 35 with TestBenchElement

use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.

the class ElementInitOrderIT method assertInitOrder.

private void assertInitOrder() {
    for (String name : Arrays.asList("init-order-polymer", "init-order-nopolymer")) {
        TestBenchElement element = $(name).first();
        String status = element.$(TestBenchElement.class).id("status").getText();
        Assert.assertEquals("property = property, attribute = attribute, child count = 1, style = style, class = class", status);
    }
}
Also used : TestBenchElement(com.vaadin.testbench.TestBenchElement)

Aggregations

TestBenchElement (com.vaadin.testbench.TestBenchElement)154 Test (org.junit.Test)120 ChromeBrowserTest (com.vaadin.flow.testutil.ChromeBrowserTest)98 WebElement (org.openqa.selenium.WebElement)46 By (org.openqa.selenium.By)6 DivElement (com.vaadin.flow.component.html.testbench.DivElement)5 List (java.util.List)5 Assert (org.junit.Assert)5 SpanElement (com.vaadin.flow.component.html.testbench.SpanElement)4 ChromeDeviceTest (com.vaadin.flow.testutil.ChromeDeviceTest)4 NativeButtonElement (com.vaadin.flow.component.html.testbench.NativeButtonElement)3 File (java.io.File)3 Ignore (org.junit.Ignore)3 ButtonElement (com.vaadin.flow.component.button.testbench.ButtonElement)2 DevModeGizmoElement (com.vaadin.flow.testutil.DevModeGizmoElement)2 Optional (java.util.Optional)2 JavascriptExecutor (org.openqa.selenium.JavascriptExecutor)2 WebDriver (org.openqa.selenium.WebDriver)2 ParagraphElement (com.vaadin.flow.component.html.testbench.ParagraphElement)1 TextFieldElement (com.vaadin.flow.component.textfield.testbench.TextFieldElement)1