use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class NavigateBetweenViewsIT method openFlowView_navigateToTsView_navigationSuccessful.
@Test
public void openFlowView_navigateToTsView_navigationSuccessful() {
getDriver().get(getRootURL() + "/hello");
waitForDevServer();
Assert.assertThat(getDriver().getCurrentUrl(), CoreMatchers.endsWith("/hello"));
$(NativeButtonElement.class).id(NAVIGATE_ABOUT).click();
// 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());
Assert.assertThat(getDriver().getCurrentUrl(), CoreMatchers.endsWith("/about"));
TestBenchElement aboutView = $("about-view").first();
Assert.assertTrue(aboutView.$("*").id("navigate-hello").isDisplayed());
}
use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class ServiceWorkerIT method offlineDeepPath_reload_viewReloaded_baseUrlRewritten.
@Test
public void offlineDeepPath_reload_viewReloaded_baseUrlRewritten() throws IOException {
getDriver().get(getRootURL() + "/");
waitForDevServer();
waitForServiceWorkerReady();
// Set offline network conditions in ChromeDriver
setConnectionType(NetworkConnection.ConnectionType.AIRPLANE_MODE);
try {
$("main-view").first().$("a").id("menu-deep-another").click();
// Wait for component inside shadow root as there is no vaadin
// to wait for as with server-side
waitUntil(input -> $("another-view").first().$("div").id("another-content").isDisplayed());
// Reload the page in offline mode
executeScript("window.location.reload();");
waitUntil(webDriver -> ((JavascriptExecutor) driver).executeScript("return document.readyState").equals("complete"));
MatcherAssert.assertThat(getDriver().getCurrentUrl(), CoreMatchers.endsWith("/another"));
TestBenchElement anotherView = $("another-view").first();
Assert.assertTrue(anotherView.$("*").id("another-content").isDisplayed());
// Verify <base href> by navigating with a relative link
$("main-view").first().$("a").id("menu-about").click();
MatcherAssert.assertThat(getDriver().getCurrentUrl(), CoreMatchers.endsWith("/about"));
Assert.assertNotNull("Should have <about-view> in DOM", findElement(By.tagName("about-view")));
} finally {
// Reset network conditions back
setConnectionType(NetworkConnection.ConnectionType.ALL);
}
}
use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class UpgradeElementIT method twoWayDatabindingForUpgradedElement.
@Test
public void twoWayDatabindingForUpgradedElement() {
open();
findElement(By.id("upgrade")).click();
TestBenchElement template = $(TestBenchElement.class).id("template");
WebElement input = template.$(TestBenchElement.class).id("input");
new Actions(getDriver()).click(input).sendKeys("foo").sendKeys(Keys.ENTER).build().perform();
WebElement result = findElement(By.id("text-update"));
Assert.assertEquals("foo", result.getText());
}
use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class ListBindingIT method listDataBinding.
@Test
public void listDataBinding() {
open();
TestBenchElement template = $(TestBenchElement.class).id("template");
checkInitialState(template);
checkModelItemWorks(template);
// Before running those methods list is set to ["1", "2", "3"]
// see (ListBindingView.INITIAL_STATE)
assertMethodWorksCorrectly("addElement", template, "1", "2", "3", "4");
assertMethodWorksCorrectly("addElementByIndex", template, "4", "1", "2", "3");
assertMethodWorksCorrectly("addNumerousElements", template, "1", "2", "3", "4", "5");
assertMethodWorksCorrectly("addNumerousElementsByIndex", template, "4", "5", "1", "2", "3");
assertMethodWorksCorrectly("clearList", template);
assertMethodWorksCorrectly("removeSecondElementByIndex", template, "1", "3");
assertMethodWorksCorrectly("removeFirstElementWithIterator", template, "2", "3");
assertMethodWorksCorrectly("swapFirstAndSecond", template, "2", "1", "3");
assertMethodWorksCorrectly("sortDescending", template, "3", "2", "1");
assertMethodWorksCorrectly("setInitialStateToEachMessage", template, ListBindingView.INITIAL_STATE, ListBindingView.INITIAL_STATE, ListBindingView.INITIAL_STATE);
}
use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class OneWayPolymerBindingIT method initialModelValueIsPresentAndModelUpdatesNormally.
// Numerous tests are carried out in the single test case, because it's
// expensive to launch numerous Chrome instances
@Test
public void initialModelValueIsPresentAndModelUpdatesNormally() {
open();
TestBenchElement template = $(TestBenchElement.class).id("template");
checkInitialState(template);
checkTemplateModel(template);
template.$(TestBenchElement.class).id("changeModelValue").click();
checkStateAfterClick(template);
checkTemplateModel(template);
}
Aggregations