Search in sources :

Example 1 with DevModeGizmoElement

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

the class PreserveOnRefreshLiveReloadIT method notificationShownWhenLoadingPreserveOnRefreshView.

@Test
public void notificationShownWhenLoadingPreserveOnRefreshView() {
    open();
    DevModeGizmoElement liveReload = $(DevModeGizmoElement.class).waitForFirst();
    WebElement messageDetails = liveReload.$("*").attributeContains("class", "warning").first();
    Assert.assertTrue(messageDetails.getText().contains("@PreserveOnRefresh"));
}
Also used : WebElement(org.openqa.selenium.WebElement) DevModeGizmoElement(com.vaadin.flow.testutil.DevModeGizmoElement) Test(org.junit.Test)

Example 2 with DevModeGizmoElement

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

the class DependencyIT method loadingUnavailableResources.

@Test
public void loadingUnavailableResources() throws IOException {
    open();
    findElement(By.id("loadUnavailableResources")).click();
    DevModeGizmoElement gizmo = $(DevModeGizmoElement.class).first();
    gizmo.waitForErrorMessage(s -> s.startsWith("Error loading http://") && s.endsWith("/not-found.css"));
    gizmo.waitForErrorMessage(s -> s.startsWith("Error loading http://") && s.endsWith("/not-found.js"));
}
Also used : DevModeGizmoElement(com.vaadin.flow.testutil.DevModeGizmoElement) ChromeBrowserTest(com.vaadin.flow.testutil.ChromeBrowserTest) Test(org.junit.Test)

Example 3 with DevModeGizmoElement

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

the class DebugWindowErrorHandlingIT method clientSidePromiseRejectionReported.

@Test
public void clientSidePromiseRejectionReported() {
    open();
    clientSidePromiseRejection();
    DevModeGizmoElement gizmo = $(DevModeGizmoElement.class).first();
    gizmo.waitForErrorMessage(text -> text.matches("TypeError: Failed to fetch dynamically imported module: .*this-file-does-not-exist.js"));
}
Also used : DevModeGizmoElement(com.vaadin.flow.testutil.DevModeGizmoElement) ChromeBrowserTest(com.vaadin.flow.testutil.ChromeBrowserTest) Test(org.junit.Test)

Example 4 with DevModeGizmoElement

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

the class DebugWindowErrorHandlingIT method execJSExceptionReported.

@Test
public void execJSExceptionReported() {
    open();
    execJSException();
    DevModeGizmoElement gizmo = $(DevModeGizmoElement.class).first();
    gizmo.waitForErrorMessage(text -> text.equals("Exception is thrown during JavaScript execution. Stacktrace will be dumped separately."));
    gizmo.waitForErrorMessage(text -> text.equals("The error has occurred in the JS code: 'null.foo'"));
    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 5 with DevModeGizmoElement

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

the class FeatureIT method toggleViteFeature.

private void toggleViteFeature(boolean expectedInitialState) {
    DevModeGizmoElement gizmo = $(DevModeGizmoElement.class).waitForFirst();
    gizmo.expand();
    gizmo.$(NativeButtonElement.class).id("features").click();
    TestBenchElement toggleButton = gizmo.$(TestBenchElement.class).id("feature-toggle-viteForFrontendBuild");
    String checked = getCommandExecutor().executeScript("return arguments[0].checked", toggleButton).toString();
    Assert.assertEquals("Toggle button state expected " + expectedInitialState, Boolean.toString(expectedInitialState), checked);
    toggleButton.click();
}
Also used : DevModeGizmoElement(com.vaadin.flow.testutil.DevModeGizmoElement) TestBenchElement(com.vaadin.testbench.TestBenchElement)

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