use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class DnDAttachDetachIT method testDnD_moveComponents_dndOperationWorks.
@Test
public void testDnD_moveComponents_dndOperationWorks() {
open();
dragAndDrop(getDraggableText(), getDropTarget());
TestBenchElement eventElement = getEvent(0);
Assert.assertEquals("Drop: 0", eventElement.getText());
clickElementWithJs(MOVE_BUTTON_ID);
dragAndDrop(getDraggableText(), getDropTarget());
eventElement = getEvent(1);
Assert.assertEquals("Drop: 1", eventElement.getText());
Assert.assertFalse("No second event should have occurred", isElementPresent(By.id("drop-" + 2)));
}
use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class PushWithPreserveOnRefreshIT method ensurePushWorksAfterRefresh.
@Test
public void ensurePushWorksAfterRefresh() {
open();
WebElement loadingIndicator = findElement(By.className("v-loading-indicator"));
waitUntil(driver -> !loadingIndicator.isDisplayed());
TestBenchElement button = $(TestBenchElement.class).id("click");
button.click();
button.click();
Assert.assertEquals("Button has been clicked 2 times", getLastLog());
open();
Assert.assertEquals("Button has been clicked 2 times", getLastLog());
button = $(TestBenchElement.class).id("click");
button.click();
Assert.assertEquals("Button has been clicked 3 times", getLastLog());
}
use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class RemoveRoutersLayoutContentIT method assertSubLayoutHasNoOldContent.
private void assertSubLayoutHasNoOldContent() {
TestBenchElement subLayout = $("div").id(SUB_LAYOUT_ID);
List<WebElement> subLayoutChildren = subLayout.findElements(By.tagName("div"));
Assert.assertEquals(1, subLayoutChildren.size());
}
use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class ServiceWorkerIT method offlineNonRoot_reload_viewReloaded.
@Test
public void offlineNonRoot_reload_viewReloaded() 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-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());
} finally {
// Reset network conditions back
setConnectionType(NetworkConnection.ConnectionType.ALL);
}
}
use of com.vaadin.testbench.TestBenchElement in project flow by vaadin.
the class ServiceWorkerIT method offlineServerView_navigateToTsView_navigationSuccessful.
@Test
public void offlineServerView_navigateToTsView_navigationSuccessful() throws IOException {
getDriver().get(getRootURL() + "/hello");
waitForDevServer();
waitForServiceWorkerReady();
// Set offline network conditions in ChromeDriver
setConnectionType(NetworkConnection.ConnectionType.AIRPLANE_MODE);
try {
$("main-view").first().$("a").id("menu-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());
MatcherAssert.assertThat(getDriver().getCurrentUrl(), CoreMatchers.endsWith("/another"));
TestBenchElement anotherView = $("another-view").first();
Assert.assertTrue(anotherView.$("*").id("another-content").isDisplayed());
} finally {
// Reset network conditions back
setConnectionType(NetworkConnection.ConnectionType.ALL);
}
}
Aggregations