Search in sources :

Example 6 with DevModeGizmoElement

use of com.vaadin.flow.testutil.DevModeGizmoElement in project flow by vaadin.

the class DebugWindowFeatureFlagsIT method exampleFeatureFlagNotShown.

@Test
public void exampleFeatureFlagNotShown() {
    open();
    DevModeGizmoElement debugWindow = $(DevModeGizmoElement.class).first();
    debugWindow.expand();
    debugWindow.showExperimentalFeatures();
    List<String> features = debugWindow.listExperimentalFeatures();
    for (String feature : features) {
        Assert.assertFalse("Example feature should not be shown in the debug window", feature.contains("Example feature"));
    }
}
Also used : DevModeGizmoElement(com.vaadin.flow.testutil.DevModeGizmoElement) ChromeBrowserTest(com.vaadin.flow.testutil.ChromeBrowserTest) Test(org.junit.Test)

Example 7 with DevModeGizmoElement

use of com.vaadin.flow.testutil.DevModeGizmoElement in project flow by vaadin.

the class DebugWindowErrorHandlingIT method clientSideErrorsReported.

@Test
public void clientSideErrorsReported() {
    open();
    clientSideError();
    DevModeGizmoElement gizmo = $(DevModeGizmoElement.class).first();
    gizmo.waitForErrorMessage(text -> text.equals("Client side error"));
    Assert.assertTrue(gizmo.isExpanded());
}
Also used : DevModeGizmoElement(com.vaadin.flow.testutil.DevModeGizmoElement) ChromeBrowserTest(com.vaadin.flow.testutil.ChromeBrowserTest) Test(org.junit.Test)

Example 8 with DevModeGizmoElement

use of com.vaadin.flow.testutil.DevModeGizmoElement in project flow by vaadin.

the class DebugWindowErrorHandlingIT method clientSideExceptionReported.

@Test
public void clientSideExceptionReported() {
    open();
    clientSideException();
    DevModeGizmoElement gizmo = $(DevModeGizmoElement.class).first();
    gizmo.waitForErrorMessage(text -> text.matches("Uncaught TypeError: Cannot read properties of null \\(reading 'foo'\\).*"));
}
Also used : DevModeGizmoElement(com.vaadin.flow.testutil.DevModeGizmoElement) ChromeBrowserTest(com.vaadin.flow.testutil.ChromeBrowserTest) Test(org.junit.Test)

Example 9 with DevModeGizmoElement

use of com.vaadin.flow.testutil.DevModeGizmoElement in project flow by vaadin.

the class DebugWindowErrorHandlingIT method numberOfLogRowsLimited.

@Test
public void numberOfLogRowsLimited() {
    open();
    DevModeGizmoElement gizmo = $(DevModeGizmoElement.class).first();
    gizmo.expand();
    causeErrors("1001");
    gizmo.waitForLastErrorMessageToMatch(msg -> msg.equals("Error 1001"));
    Assert.assertEquals("Error 2", gizmo.getFirstErrorLogRow());
    Assert.assertEquals("Error 1001", gizmo.getLastErrorLogRow());
    Assert.assertEquals(1000, gizmo.getNumberOfErrorLogRows());
    causeErrors("2");
    gizmo.waitForLastErrorMessageToMatch(msg -> msg.equals("Error 2"));
    Assert.assertEquals("Error 4", gizmo.getFirstErrorLogRow());
    Assert.assertEquals("Error 2", gizmo.getLastErrorLogRow());
}
Also used : DevModeGizmoElement(com.vaadin.flow.testutil.DevModeGizmoElement) ChromeBrowserTest(com.vaadin.flow.testutil.ChromeBrowserTest) Test(org.junit.Test)

Example 10 with DevModeGizmoElement

use of com.vaadin.flow.testutil.DevModeGizmoElement in project flow by vaadin.

the class JavaLiveReloadIT method overlayShouldRender.

@Test
public void overlayShouldRender() {
    open();
    // Upon opening, the LiveReloadUI should show the indicator but not the
    // message window
    DevModeGizmoElement liveReload = $(DevModeGizmoElement.class).waitForFirst();
    TestBenchElement window = liveReload.$("*").attributeContains("class", "window").first();
    Assert.assertFalse(window.isDisplayed());
    // After clicking the icon in the indicator, the live-reload message
    // window should appear
    WebElement liveReloadIcon = liveReload.$("*").attributeContains("class", "gizmo").first();
    liveReloadIcon.click();
    waitForElementPresent(By.tagName("vaadin-devmode-gizmo"));
    WebElement window2 = liveReload.$("*").attributeContains("class", "gizmo").first();
    Assert.assertTrue(window2.isDisplayed());
}
Also used : WebElement(org.openqa.selenium.WebElement) DevModeGizmoElement(com.vaadin.flow.testutil.DevModeGizmoElement) TestBenchElement(com.vaadin.testbench.TestBenchElement) Test(org.junit.Test)

Aggregations

DevModeGizmoElement (com.vaadin.flow.testutil.DevModeGizmoElement)13 Test (org.junit.Test)12 ChromeBrowserTest (com.vaadin.flow.testutil.ChromeBrowserTest)7 WebElement (org.openqa.selenium.WebElement)4 TestBenchElement (com.vaadin.testbench.TestBenchElement)2