Search in sources :

Example 6 with SpanElement

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

the class TemplateIT method testElementIdMapping.

@Test
public void testElementIdMapping() {
    final String initialValue = "Default";
    SpanElement litSpan = $(LitComponent.TAG).first().$(SpanElement.class).first();
    Assert.assertEquals(initialValue, litSpan.getText());
    SpanElement polymerSpan = $(PolymerComponent.TAG).first().$(SpanElement.class).first();
    Assert.assertEquals(initialValue, polymerSpan.getText());
    SpanElement addonLitSpan = $(AddonLitComponent.TAG).first().$(SpanElement.class).first();
    Assert.assertEquals(initialValue, addonLitSpan.getText());
    final String newLabel = "New label";
    $(InputTextElement.class).first().setValue(newLabel);
    $(NativeButtonElement.class).first().click();
    Assert.assertEquals(newLabel, litSpan.getText());
    Assert.assertEquals(newLabel, polymerSpan.getText());
    Assert.assertEquals(newLabel, addonLitSpan.getText());
}
Also used : SpanElement(com.vaadin.flow.component.html.testbench.SpanElement) Test(org.junit.Test) ChromeBrowserTest(com.vaadin.flow.testutil.ChromeBrowserTest)

Example 7 with SpanElement

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

the class ApplicationThemeComponentIT method documentCssFonts_fontsAreAppliedAndAvailable.

@Test
public void documentCssFonts_fontsAreAppliedAndAvailable() {
    open();
    checkLogsForErrors();
    final TestBenchElement themedComponent = $("themed-component").first();
    final TestBenchElement embeddedComponent = themedComponent.$(DivElement.class).id(EMBEDDED_ID);
    final SpanElement handElement = embeddedComponent.$(SpanElement.class).id(HAND_ID);
    Assert.assertEquals("Font family faulty", "\"Font Awesome 5 Free\"", handElement.getCssValue("font-family"));
    Assert.assertEquals("Font weight faulty", "900", handElement.getCssValue("font-weight"));
    Assert.assertEquals("display value faulty", "inline-block", handElement.getCssValue("display"));
    getDriver().get(getRootURL() + "/path/VAADIN/static/@fortawesome/fontawesome-free/webfonts/fa-solid-900.woff2");
    Assert.assertFalse("Font resource should be available", driver.getPageSource().contains("HTTP ERROR 404 Not Found"));
}
Also used : SpanElement(com.vaadin.flow.component.html.testbench.SpanElement) DivElement(com.vaadin.flow.component.html.testbench.DivElement) TestBenchElement(com.vaadin.testbench.TestBenchElement) 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