use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class AttachExistingElementByIdIT method assertTemplate.
private void assertTemplate(String id, String initialLabelText, String placeholder) {
TestBenchElement template = $("*").id(id);
WebElement input = getInput(template);
Assert.assertEquals(initialLabelText, getLabel(template).getText());
Assert.assertEquals(placeholder, input.getAttribute("placeholder"));
input.sendKeys("Harley!");
input.sendKeys(Keys.ENTER);
Assert.assertEquals("Text from input Harley!", getLabel(template).getText());
// Reset values to defaults
$(TestBenchElement.class).id(id).$(TestBenchElement.class).id("button").click();
Assert.assertEquals("default", getLabel(template).getText());
}
use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class ExportedJSFunctionIT method poll.
private void poll() {
TestBenchElement counter = $(TestBenchElement.class).id("pollCounter");
TestBenchElement pollTrigger = $(TestBenchElement.class).id("poll");
Assert.assertEquals("No polls", counter.getText());
pollTrigger.click();
Assert.assertEquals("Poll called 1 times", counter.getText());
}
use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class ReusableThemeIT 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 NavigateBetweenViewsIT method openTsView_navigateToFlowView_isConnectedOnAttach.
@Test
public void openTsView_navigateToFlowView_isConnectedOnAttach() {
getDriver().get(getRootURL() + "/");
waitForDevServer();
waitUntil(input -> $("about-view").first().$("a").id("navigate-hello").isDisplayed());
TestBenchElement aboutView = $("about-view").first();
aboutView.$("*").id("navigate-hello").click();
getCommandExecutor().waitForVaadin();
assertIsConnected();
}
use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class NavigateBetweenViewsIT method openTsView_navigateToFlow_navigationSuccessful.
@Test
public void openTsView_navigateToFlow_navigationSuccessful() {
getDriver().get(getRootURL() + "/");
waitForDevServer();
// Wait for component inside shadowroot as there is no vaadin
// to wait for as with server-side
waitUntil(input -> $("about-view").first().$("a").id("navigate-hello").isDisplayed());
TestBenchElement aboutView = $("about-view").first();
aboutView.$("*").id("navigate-hello").click();
getCommandExecutor().waitForVaadin();
Assert.assertThat(getDriver().getCurrentUrl(), CoreMatchers.endsWith("/hello"));
Assert.assertTrue("Missing expected native button on page", $(NativeButtonElement.class).id(NAVIGATE_ABOUT).isDisplayed());
}
Aggregations