use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class ThemeIT method componentThemeIsApplied.
@Test
public void componentThemeIsApplied() {
open();
TestBenchElement myField = $(TestBenchElement.class).id(MY_COMPONENT_ID);
TestBenchElement input = myField.$("vaadin-input-container").attribute("part", "input-field").first();
Assert.assertEquals("Polymer text field should have red background", "rgba(255, 0, 0, 1)", input.getCssValue("background-color"));
}
use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class ThemeIT method typeScriptCssImport_stylesAreApplied.
@Test
public void typeScriptCssImport_stylesAreApplied() {
getDriver().get(getRootURL() + "/path/hello");
checkLogsForErrors();
final TestBenchElement helloWorld = $(TestBenchElement.class).first().findElement(By.tagName("hello-world-view"));
Assert.assertEquals("hello-world-view", helloWorld.getTagName());
Assert.assertEquals("CSS was not applied as background color was not as expected.", "rgba(255, 165, 0, 1)", helloWorld.getCssValue("background-color"));
}
use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class SendMultibyteCharactersTest method transportSupportsMultibyteCharacters.
@Test
public void transportSupportsMultibyteCharacters() {
open();
TestBenchElement textArea = $(TestBenchElement.class).id("text");
StringBuilder text = new StringBuilder();
for (int i = 0; i < 20; i++) {
text.append("之は日本語です、テストです。");
}
/*
* clean up logs up to the current state
*/
getBrowserLogs(true);
textArea.sendKeys(text.toString());
textArea.sendKeys(Keys.TAB);
findElement(By.id("label")).click();
List<String> messages = new ArrayList<>();
waitUntil(driver -> getBrowserLogs(true).stream().filter(String.class::isInstance).anyMatch(msg -> {
messages.add(msg.toString());
return msg.equals("Handling message from server");
}), 15);
checkLogsForErrors(msg -> msg.contains("sockjs-node") || msg.contains("[WDS]"));
Assert.assertTrue(messages.stream().anyMatch(msg -> msg.startsWith("Received ") && msg.contains("message:")));
}
use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class AppViewIT method should_beAble_toLogin_usingSpringForm.
@Test
public void should_beAble_toLogin_usingSpringForm() {
// Login by using the Spring Login Form
openTestUrl("/login");
TestBenchElement container = $("div").attributeContains("class", "container").first();
container.$(TestBenchElement.class).id("username").sendKeys("admin");
container.$(TestBenchElement.class).id("password").sendKeys("admin");
container.$("button").first().click();
// Wait for the server connect response
testComponent = $("test-component").first();
content = testComponent.$(TestBenchElement.class).id("content");
// Verify admin calls
verifyCallingAdminService("Hello, admin!");
}
use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class RouterLinksIT method handleEventOnServer.
@Test
public void handleEventOnServer() {
open();
String originalUrl = getDriver().getCurrentUrl();
WebElement textInput = $(TestBenchElement.class).id("template").$(TestBenchElement.class).id("input");
Assert.assertTrue("Input was not empty", textInput.getAttribute("value").isEmpty());
textInput.sendKeys(TEXT_INPUT);
Assert.assertEquals("Input was missing contents", TEXT_INPUT, textInput.getAttribute("value"));
List<TestBenchElement> links = $(TestBenchElement.class).id("template").$("a").all();
WebElement link = links.stream().filter(lnk -> lnk.getText().equals("Navigate")).findFirst().get();
getCommandExecutor().executeScript("return arguments[0].click()", link);
// Original url should end with UI and the navigation link Template
Assert.assertNotEquals(originalUrl, getDriver().getCurrentUrl());
textInput = $(TestBenchElement.class).id("template").$(TestBenchElement.class).id("input");
Assert.assertEquals("Input didn't keep content through navigation", TEXT_INPUT, textInput.getAttribute("value"));
}
Aggregations