use of com.vaadin.testbench.TestBenchElement 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"));
}
use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class BasicsIT method applicationStarts.
@Test
public void applicationStarts() {
TestBenchElement header = $("h2").first();
Assert.assertEquals("This place intentionally left empty", header.getText());
}
use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class ContextPathIT method applicationStarts.
@Test
public void applicationStarts() {
TestBenchElement header = $("h2").first();
Assert.assertEquals("Hello world!", header.getText());
}
use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class ThemeReloadIT method updateStyle_changeIsReloaded.
@Test
@Ignore
public void updateStyle_changeIsReloaded() throws IOException {
TestBenchElement header = $("h2").first();
Assert.assertEquals("rgba(0, 0, 255, 1)", header.getCssValue("color"));
File baseDir = new File(System.getProperty("user.dir", "."));
File themeFolder = new File(baseDir, "frontend/themes/vite-basics/");
File stylesCss = new File(themeFolder, "styles.css");
final String stylesContent = FileUtils.readFileToString(stylesCss, StandardCharsets.UTF_8);
try {
FileUtils.write(stylesCss, stylesContent + "\nh2 { color: rgba(255, 0, 0, 1); }", StandardCharsets.UTF_8.name());
waitUntil(webDriver -> webDriver.findElement(By.tagName("h2")).getCssValue("color").equals("rgba(255, 0, 0, 1)"), 30);
header = $("h2").first();
Assert.assertEquals("rgba(255, 0, 0, 1)", header.getCssValue("color"));
} finally {
FileUtils.write(stylesCss, stylesContent, StandardCharsets.UTF_8.name());
}
}
use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class ProductionBasicsIT method imageFromThemeShown.
@Test
public void imageFromThemeShown() {
getDriver().get(getRootURL());
waitForDevServer();
TestBenchElement img = $("img").id(MainView.PLANT);
waitUntil(driver -> {
String heightString = (String) executeScript("return getComputedStyle(arguments[0]).height.replace('px','')", img);
float height = Float.parseFloat(heightString);
return (height > 150);
});
}
Aggregations