Search in sources :

Example 1 with SpanElement

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

the class TemplateIT method testElementReferencedByReflection.

@Test
public void testElementReferencedByReflection() {
    SpanElement span = $(ReflectivelyReferencedComponent.TAG).first().$(SpanElement.class).first();
    Assert.assertEquals("ReflectivelyReferencedComponent contents", span.getText());
}
Also used : SpanElement(com.vaadin.flow.component.html.testbench.SpanElement) Test(org.junit.Test) ChromeBrowserTest(com.vaadin.flow.testutil.ChromeBrowserTest)

Example 2 with SpanElement

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

the class ApplicationThemeComponentIT method validateEmbeddedComponent.

private void validateEmbeddedComponent(TestBenchElement themedComponent, String target) {
    Assert.assertEquals(target + " didn't contain the background image", "url(\"" + getRootURL() + "/VAADIN/static/themes/embedded-theme/img/bg.jpg\")", themedComponent.getCssValue("background-image"));
    Assert.assertEquals(target + " didn't contain font-family", "Ostrich", themedComponent.getCssValue("font-family"));
    final TestBenchElement embeddedComponent = themedComponent.$(DivElement.class).id(EMBEDDED_ID);
    final SpanElement handElement = embeddedComponent.$(SpanElement.class).id(HAND_ID);
    Assert.assertEquals("Color should have been applied", "rgba(0, 128, 0, 1)", handElement.getCssValue("color"));
}
Also used : SpanElement(com.vaadin.flow.component.html.testbench.SpanElement) DivElement(com.vaadin.flow.component.html.testbench.DivElement) TestBenchElement(com.vaadin.testbench.TestBenchElement)

Example 3 with SpanElement

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

the class CustomRouteIT method testCustomErrorView.

@Test
public void testCustomErrorView() {
    getDriver().get(getRootURL() + "/none");
    final SpanElement error = $(SpanElement.class).id("error");
    Assert.assertEquals("Requested route was simply not found!", error.getText());
}
Also used : SpanElement(com.vaadin.flow.component.html.testbench.SpanElement) Test(org.junit.Test) ChromeBrowserTest(com.vaadin.flow.testutil.ChromeBrowserTest)

Example 4 with SpanElement

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

the class UtilityClassNameIT method lumoUtils_customStylesHaveBeenExpanded.

@Test
public void lumoUtils_customStylesHaveBeenExpanded() {
    open();
    checkLogsForErrors();
    SpanElement primary = $(SpanElement.class).id("primary");
    Assert.assertEquals("rgba(0, 128, 0, 1)", primary.getCssValue("color"));
}
Also used : SpanElement(com.vaadin.flow.component.html.testbench.SpanElement) Test(org.junit.Test) ChromeBrowserTest(com.vaadin.flow.testutil.ChromeBrowserTest)

Example 5 with SpanElement

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

the class CustomRouteIT method CustomRegistry_hasExpectedErrorHandlers.

@Test
public void CustomRegistry_hasExpectedErrorHandlers() {
    getDriver().get(getRootURL());
    final SpanElement notFoundException = $(SpanElement.class).id("NotFoundException");
    Assert.assertEquals("Wrong error handler registered", "NotFoundException :: CustomNotFoundView", notFoundException.getText());
    try {
        $(SpanElement.class).id("IllegalAccessException");
        Assert.fail("Found IllegalAccessException error handler even though it should not be registered");
    } catch (NoSuchElementException nsee) {
    // NO-OP as this should throw element not found
    }
}
Also used : SpanElement(com.vaadin.flow.component.html.testbench.SpanElement) NoSuchElementException(org.openqa.selenium.NoSuchElementException) Test(org.junit.Test) ChromeBrowserTest(com.vaadin.flow.testutil.ChromeBrowserTest)

Aggregations

SpanElement (com.vaadin.flow.component.html.testbench.SpanElement)7 ChromeBrowserTest (com.vaadin.flow.testutil.ChromeBrowserTest)6 Test (org.junit.Test)6 DivElement (com.vaadin.flow.component.html.testbench.DivElement)2 TestBenchElement (com.vaadin.testbench.TestBenchElement)2 NoSuchElementException (org.openqa.selenium.NoSuchElementException)1