@@ -52,14 +52,7 @@ public class ReconnectDialogThemeTest extends MultiBrowserThemeTestWithProxy { | |||
disconnectProxy(); | |||
helloButton.click(); | |||
testBench().disableWaitForVaadin(); | |||
waitUntil(new ExpectedCondition<Boolean>() { | |||
@Override | |||
public Boolean apply(WebDriver input) { | |||
boolean present = isElementPresent(reconnectDialogBy); | |||
return present; | |||
} | |||
}); | |||
waitUntil(driver -> isElementPresent(reconnectDialogBy)); | |||
WebElement dialog = findElement(reconnectDialogBy); | |||
WebElement spinner = dialog.findElement(By.className("spinner")); |
@@ -16,11 +16,9 @@ | |||
package com.vaadin.tests.components; | |||
import org.junit.Test; | |||
import org.openqa.selenium.WebDriver; | |||
import org.openqa.selenium.support.ui.ExpectedCondition; | |||
import com.vaadin.testbench.elements.ProgressBarElement; | |||
import com.vaadin.testbench.elements.ButtonElement; | |||
import com.vaadin.testbench.elements.ProgressBarElement; | |||
import com.vaadin.tests.tb3.SingleBrowserTest; | |||
public class NoLayoutUpdateWhichNeedsLayoutTest extends SingleBrowserTest { | |||
@@ -31,12 +29,9 @@ public class NoLayoutUpdateWhichNeedsLayoutTest extends SingleBrowserTest { | |||
ButtonElement open = $(ButtonElement.class).id("openWindow"); | |||
open.click(); | |||
final ProgressBarElement progress = $(ProgressBarElement.class).first(); | |||
waitUntil(new ExpectedCondition<Boolean>() { | |||
@Override | |||
public Boolean apply(WebDriver input) { | |||
double p = progress.getValue(); | |||
return Math.abs(p - 0.5) < 0.01; | |||
} | |||
waitUntil(driver -> { | |||
double p = progress.getValue(); | |||
return Math.abs(p - 0.5) < 0.01; | |||
}); | |||
ButtonElement close = $(ButtonElement.class).id("closeWindow"); |
@@ -23,10 +23,8 @@ import java.util.List; | |||
import org.junit.Before; | |||
import org.junit.Test; | |||
import org.openqa.selenium.WebDriver; | |||
import org.openqa.selenium.WebElement; | |||
import org.openqa.selenium.interactions.Actions; | |||
import org.openqa.selenium.support.ui.ExpectedCondition; | |||
import com.vaadin.testbench.By; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
@@ -73,13 +71,10 @@ public class ComboBoxSlowTest extends MultiBrowserTest { | |||
assertTrue(isPagingActive()); | |||
goToNextPage(); | |||
waitUntil(new ExpectedCondition<Boolean>() { | |||
@Override | |||
public Boolean apply(WebDriver input) { | |||
List<WebElement> filteredItems = getFilteredItems(popup); | |||
return filteredItems.size() == 1 | |||
&& "Item 129".equals(filteredItems.get(0).getText()); | |||
} | |||
waitUntil(input -> { | |||
List<WebElement> items = getFilteredItems(popup); | |||
return items.size() == 1 | |||
&& "Item 129".equals(items.get(0).getText()); | |||
}); | |||
} | |||
@@ -20,10 +20,8 @@ public class PopupDateFieldStatesTest extends MultiBrowserTest { | |||
WebElement loadingIndicator = findElement( | |||
By.className("v-loading-indicator")); | |||
Pattern pattern = Pattern.compile("display: *none;"); | |||
waitUntil(driver -> { | |||
return pattern.matcher(loadingIndicator.getAttribute("style")) | |||
.find(); | |||
}); | |||
waitUntil(driver -> pattern | |||
.matcher(loadingIndicator.getAttribute("style")).find()); | |||
compareScreen("dateFieldStates"); | |||
} |
@@ -20,10 +20,8 @@ public class PopupDateTimeFieldStatesTest extends MultiBrowserTest { | |||
WebElement loadingIndicator = findElement( | |||
By.className("v-loading-indicator")); | |||
Pattern pattern = Pattern.compile("display: *none;"); | |||
waitUntil(driver -> { | |||
return pattern.matcher(loadingIndicator.getAttribute("style")) | |||
.find(); | |||
}); | |||
waitUntil(driver -> pattern | |||
.matcher(loadingIndicator.getAttribute("style")).find()); | |||
compareScreen("dateFieldStates"); | |||
} |
@@ -97,10 +97,8 @@ public abstract class AbstractGridColumnAutoWidthTest extends MultiBrowserTest { | |||
WebElement loadingIndicator = findElement( | |||
By.className("v-loading-indicator")); | |||
Pattern pattern = Pattern.compile("display: *none;"); | |||
waitUntil(driver -> { | |||
return pattern.matcher(loadingIndicator.getAttribute("style")) | |||
.find(); | |||
}); | |||
waitUntil(driver -> pattern | |||
.matcher(loadingIndicator.getAttribute("style")).find()); | |||
compareScreen("grid-v8-initialRender"); | |||
} | |||
@@ -4,9 +4,7 @@ import static org.junit.Assert.assertEquals; | |||
import static org.junit.Assert.assertTrue; | |||
import org.junit.Test; | |||
import org.openqa.selenium.WebDriver; | |||
import org.openqa.selenium.WebElement; | |||
import org.openqa.selenium.support.ui.ExpectedCondition; | |||
import com.vaadin.testbench.By; | |||
import com.vaadin.testbench.TestBenchElement; | |||
@@ -24,14 +22,8 @@ public class GridApplyFilterWhenScrolledDownTest extends MultiBrowserTest { | |||
$(ButtonElement.class).first().click(); | |||
final TestBenchElement gridBody = grid.getBody(); | |||
// Can't use element API because it scrolls | |||
waitUntil(new ExpectedCondition<Boolean>() { | |||
@Override | |||
public Boolean apply(WebDriver input) { | |||
return gridBody.findElements(By.className("v-grid-row")) | |||
.size() == 1; | |||
} | |||
}); | |||
waitUntil(input -> gridBody.findElements(By.className("v-grid-row")) | |||
.size() == 1); | |||
WebElement cell = gridBody.findElements(By.className("v-grid-cell")) | |||
.get(0); | |||
assertEquals("Test", cell.getText()); |
@@ -16,9 +16,7 @@ | |||
package com.vaadin.tests.components.layout; | |||
import org.junit.Test; | |||
import org.openqa.selenium.WebDriver; | |||
import org.openqa.selenium.WebElement; | |||
import org.openqa.selenium.support.ui.ExpectedCondition; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
@@ -46,16 +44,13 @@ public class EmptySpaceOnPageAfterExpandedComponentTest | |||
final WebElement expandedElement = vaadinElementById("expandedElement"); | |||
final WebElement containerElement = vaadinElementById("container"); | |||
waitUntil(new ExpectedCondition<Boolean>() { | |||
@Override | |||
public Boolean apply(WebDriver input) { | |||
int expandedElementBottom = expandedElement.getLocation().getY() | |||
+ expandedElement.getSize().getHeight(); | |||
int containerElementBottom = containerElement.getLocation() | |||
.getY() + containerElement.getSize().getHeight(); | |||
waitUntil(input -> { | |||
int expandedElementBottom = expandedElement.getLocation().getY() | |||
+ expandedElement.getSize().getHeight(); | |||
int containerElementBottom = containerElement.getLocation().getY() | |||
+ containerElement.getSize().getHeight(); | |||
return expandedElementBottom + 1 == containerElementBottom; | |||
} | |||
return expandedElementBottom + 1 == containerElementBottom; | |||
}); | |||
} | |||
} |
@@ -19,9 +19,7 @@ import static org.junit.Assert.assertTrue; | |||
import org.junit.Test; | |||
import org.openqa.selenium.By; | |||
import org.openqa.selenium.WebDriver; | |||
import org.openqa.selenium.interactions.Actions; | |||
import org.openqa.selenium.support.ui.ExpectedCondition; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
@@ -38,14 +36,10 @@ public class NotificationDelayTest extends MultiBrowserTest { | |||
assertTrue("No notification found", hasNotification()); | |||
waitUntil(new ExpectedCondition<Boolean>() { | |||
waitUntil(input -> { | |||
new Actions(getDriver()).moveByOffset(10, 10).perform(); | |||
@Override | |||
public Boolean apply(WebDriver input) { | |||
new Actions(getDriver()).moveByOffset(10, 10).perform(); | |||
return !hasNotification(); | |||
} | |||
return !hasNotification(); | |||
}); | |||
} | |||
@@ -17,9 +17,7 @@ package com.vaadin.tests.components.table; | |||
import org.junit.Test; | |||
import org.openqa.selenium.By; | |||
import org.openqa.selenium.WebDriver; | |||
import org.openqa.selenium.interactions.Actions; | |||
import org.openqa.selenium.support.ui.ExpectedCondition; | |||
import com.vaadin.testbench.TestBenchElement; | |||
import com.vaadin.testbench.elements.TableElement; | |||
@@ -62,11 +60,6 @@ public class HeaderRightClickAfterDragTest extends MultiBrowserTest { | |||
private void closeWindow() { | |||
WindowElement window = $(WindowElement.class).first(); | |||
window.findElement(By.className("v-window-closebox")).click(); | |||
waitUntil(new ExpectedCondition<Boolean>() { | |||
@Override | |||
public Boolean apply(WebDriver driver) { | |||
return findElements(By.className("v-window")).isEmpty(); | |||
} | |||
}); | |||
waitUntil(input -> findElements(By.className("v-window")).isEmpty()); | |||
} | |||
} |
@@ -21,13 +21,11 @@ import java.util.List; | |||
import org.junit.Test; | |||
import org.openqa.selenium.By; | |||
import org.openqa.selenium.WebDriver; | |||
import org.openqa.selenium.WebElement; | |||
import org.openqa.selenium.interactions.Actions; | |||
import org.openqa.selenium.support.ui.ExpectedCondition; | |||
import com.vaadin.testbench.elements.TableElement; | |||
import com.vaadin.testbench.elements.ButtonElement; | |||
import com.vaadin.testbench.elements.TableElement; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
/** | |||
@@ -65,12 +63,7 @@ public class TableColumnResizeContentsWidthTest extends MultiBrowserTest { | |||
} | |||
private void waitUntilTextFieldWidthIs(final int width) { | |||
waitUntil(new ExpectedCondition<Object>() { | |||
@Override | |||
public Object apply(WebDriver input) { | |||
return getTextFieldWidth() == width; | |||
} | |||
}); | |||
waitUntil(input -> getTextFieldWidth() == width); | |||
} | |||
private int getTextFieldWidth() { |
@@ -9,10 +9,8 @@ import java.util.List; | |||
import org.junit.Test; | |||
import org.openqa.selenium.Dimension; | |||
import org.openqa.selenium.WebDriver; | |||
import org.openqa.selenium.interactions.Actions; | |||
import org.openqa.selenium.remote.DesiredCapabilities; | |||
import org.openqa.selenium.support.ui.ExpectedCondition; | |||
import com.vaadin.testbench.elements.ButtonElement; | |||
import com.vaadin.testbench.elements.LabelElement; | |||
@@ -98,12 +96,7 @@ public class TextAreaSizeResettedTest extends MultiBrowserTest { | |||
private void waitUntilPollingOccurs() { | |||
final String timestamp = getPollTimestamp(); | |||
waitUntil(new ExpectedCondition<Boolean>() { | |||
@Override | |||
public Boolean apply(WebDriver input) { | |||
return !timestamp.equals(getPollTimestamp()); | |||
} | |||
}); | |||
waitUntil(input -> !timestamp.equals(getPollTimestamp())); | |||
} | |||
private String getPollTimestamp() { |
@@ -3,8 +3,6 @@ package com.vaadin.tests.components.treegrid; | |||
import static org.junit.Assert.assertEquals; | |||
import org.junit.Test; | |||
import org.openqa.selenium.WebDriver; | |||
import org.openqa.selenium.support.ui.ExpectedCondition; | |||
import com.vaadin.testbench.elements.TreeGridElement; | |||
import com.vaadin.tests.tb3.SingleBrowserTestPhantomJS2; | |||
@@ -52,11 +50,6 @@ public class TreeGridCollapseExpandTest extends SingleBrowserTestPhantomJS2 { | |||
} | |||
private void waitUntilRowCountEquals(int expectedCount) { | |||
waitUntil(new ExpectedCondition<Boolean>() { | |||
@Override | |||
public Boolean apply(WebDriver input) { | |||
return grid.getRowCount() == expectedCount; | |||
} | |||
}); | |||
waitUntil(input -> grid.getRowCount() == expectedCount); | |||
} | |||
} |
@@ -5,8 +5,6 @@ import static org.junit.Assert.assertEquals; | |||
import java.net.URI; | |||
import org.junit.Test; | |||
import org.openqa.selenium.WebDriver; | |||
import org.openqa.selenium.support.ui.ExpectedCondition; | |||
import com.vaadin.testbench.By; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
@@ -50,13 +48,7 @@ public class PushStateAndReplaceStateTest extends MultiBrowserTest { | |||
private void assertUri(String uri) { | |||
final String expectedText = "Current Location: " + uri; | |||
waitUntil(new ExpectedCondition<Boolean>() { | |||
@Override | |||
public Boolean apply(WebDriver input) { | |||
return expectedText.equals(getLocationLabelValue()); | |||
} | |||
}); | |||
waitUntil(input -> expectedText.equals(getLocationLabelValue())); | |||
assertEquals(uri, driver.getCurrentUrl()); | |||
} |
@@ -18,8 +18,6 @@ package com.vaadin.tests.components.ui; | |||
import static org.junit.Assert.assertTrue; | |||
import org.junit.Test; | |||
import org.openqa.selenium.WebDriver; | |||
import org.openqa.selenium.support.ui.ExpectedCondition; | |||
import com.vaadin.testbench.elements.ButtonElement; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
@@ -69,12 +67,7 @@ public class UIAccessTest extends MultiBrowserTest { | |||
} | |||
private void waitForLogToContainText(final String text) { | |||
waitUntil(new ExpectedCondition<Object>() { | |||
@Override | |||
public Object apply(WebDriver input) { | |||
return logContainsText(text); | |||
} | |||
}); | |||
waitUntil(input -> logContainsText(text)); | |||
} | |||
@Test |
@@ -4,8 +4,6 @@ import static org.junit.Assert.assertEquals; | |||
import org.junit.Test; | |||
import org.openqa.selenium.JavascriptExecutor; | |||
import org.openqa.selenium.WebDriver; | |||
import org.openqa.selenium.support.ui.ExpectedCondition; | |||
import com.vaadin.testbench.By; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
@@ -53,14 +51,7 @@ public class UriFragmentTest extends MultiBrowserTest { | |||
private void assertFragment(String fragment) { | |||
final String expectedText = "Current URI fragment: " + fragment; | |||
waitUntil(new ExpectedCondition<Boolean>() { | |||
@Override | |||
public Boolean apply(WebDriver input) { | |||
return expectedText.equals(getFragmentLabelValue()); | |||
} | |||
}); | |||
waitUntil(input -> expectedText.equals(getFragmentLabelValue())); | |||
} | |||
private void navigateToEmptyFragment() { |
@@ -17,8 +17,6 @@ | |||
package com.vaadin.tests.extensions; | |||
import org.junit.Test; | |||
import org.openqa.selenium.WebDriver; | |||
import org.openqa.selenium.support.ui.ExpectedCondition; | |||
import com.vaadin.testbench.By; | |||
import com.vaadin.testbench.elements.PanelElement; | |||
@@ -41,12 +39,7 @@ public class ResponsiveLayoutUpdateTest extends MultiBrowserTest { | |||
// Resize below 600px width breakpoint | |||
testBench().resizeViewPortTo(400, 768); | |||
waitUntil(new ExpectedCondition<Boolean>() { | |||
@Override | |||
public Boolean apply(WebDriver input) { | |||
return panelElement.getSize().getWidth() < 500; | |||
} | |||
}); | |||
waitUntil(input -> panelElement.getSize().getWidth() < 500); | |||
compareScreen("small"); | |||
} | |||
} |
@@ -17,9 +17,7 @@ package com.vaadin.tests.push; | |||
import static org.junit.Assert.assertEquals; | |||
import org.openqa.selenium.WebDriver; | |||
import org.openqa.selenium.WebElement; | |||
import org.openqa.selenium.support.ui.ExpectedCondition; | |||
import com.vaadin.testbench.elements.NativeSelectElement; | |||
import com.vaadin.testbench.parallel.TestCategory; | |||
@@ -77,12 +75,6 @@ abstract class PushConfigurationTest extends MultiBrowserTest { | |||
protected void waitForServerCounterToUpdate() { | |||
int counter = getServerCounter(); | |||
final int waitCounter = counter + 2; | |||
waitUntil(new ExpectedCondition<Boolean>() { | |||
@Override | |||
public Boolean apply(WebDriver input) { | |||
return (getServerCounter() >= waitCounter); | |||
} | |||
}); | |||
waitUntil(input -> getServerCounter() >= waitCounter); | |||
} | |||
} |
@@ -16,8 +16,6 @@ | |||
package com.vaadin.tests.push; | |||
import org.junit.Test; | |||
import org.openqa.selenium.WebDriver; | |||
import org.openqa.selenium.support.ui.ExpectedCondition; | |||
import com.vaadin.testbench.parallel.TestCategory; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
@@ -28,13 +26,8 @@ public class PushFromInitTest extends MultiBrowserTest { | |||
public void testPushFromInit() { | |||
openTestURL(); | |||
waitUntil(new ExpectedCondition<Boolean>() { | |||
@Override | |||
public Boolean apply(WebDriver input) { | |||
return ("3. " + PushFromInit.LOG_AFTER_INIT) | |||
.equals(getLogRow(0)); | |||
} | |||
}); | |||
waitUntil(input -> ("3. " + PushFromInit.LOG_AFTER_INIT) | |||
.equals(getLogRow(0))); | |||
} | |||
} |
@@ -470,12 +470,7 @@ public abstract class AbstractTB3Test extends ParallelTest { | |||
} | |||
protected void waitForElementNotPresent(final By by) { | |||
waitUntil(new ExpectedCondition<Boolean>() { | |||
@Override | |||
public Boolean apply(WebDriver input) { | |||
return input.findElements(by).isEmpty(); | |||
} | |||
}); | |||
waitUntil(input -> input.findElements(by).isEmpty()); | |||
} | |||
protected void waitForElementVisible(final By by) { |
@@ -18,9 +18,7 @@ package com.vaadin.tests.urifragments; | |||
import java.util.List; | |||
import org.junit.Test; | |||
import org.openqa.selenium.WebDriver; | |||
import org.openqa.selenium.remote.DesiredCapabilities; | |||
import org.openqa.selenium.support.ui.ExpectedCondition; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
@@ -54,17 +52,13 @@ public class SettingNullFragmentTest extends MultiBrowserTest { | |||
private void assertFragment(String fragment) { | |||
final String expectedText = fragment; | |||
waitUntil(new ExpectedCondition<Boolean>() { | |||
@Override | |||
public Boolean apply(WebDriver input) { | |||
String currentURL = getDriver().getCurrentUrl(); | |||
String currentURIFragment = ""; | |||
if (currentURL.contains("#") && !currentURL.endsWith("#")) { | |||
currentURIFragment = currentURL.split("#")[1]; | |||
} | |||
return expectedText.equals(currentURIFragment); | |||
waitUntil(input -> { | |||
String currentURL = getDriver().getCurrentUrl(); | |||
String currentURIFragment = ""; | |||
if (currentURL.contains("#") && !currentURL.endsWith("#")) { | |||
currentURIFragment = currentURL.split("#")[1]; | |||
} | |||
return expectedText.equals(currentURIFragment); | |||
}); | |||
} | |||
@@ -21,8 +21,6 @@ import java.util.logging.Logger; | |||
import org.junit.Test; | |||
import org.openqa.selenium.By; | |||
import org.openqa.selenium.WebDriver; | |||
import org.openqa.selenium.support.ui.ExpectedCondition; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
import com.vaadin.tests.widgetset.client.csrf.CsrfButtonConnector; | |||
@@ -43,27 +41,22 @@ public abstract class AbstractCsrfTokenUITest extends MultiBrowserTest { | |||
getDriver().findElement(By.id(CsrfTokenDisabled.PRESS_ID)).click(); | |||
waitUntil(new ExpectedCondition<Boolean>() { | |||
waitUntil(input -> { | |||
getDriver().findElement(debugButton).click(); | |||
String debugMessage2 = input.findElement(debugButton).getText(); | |||
@Override | |||
public Boolean apply(WebDriver input) { | |||
getDriver().findElement(debugButton).click(); | |||
String debugMessage2 = input.findElement(debugButton).getText(); | |||
LOGGER.log(Level.INFO, "1: " + debugMessage1); | |||
LOGGER.log(Level.INFO, "2: " + debugMessage2); | |||
LOGGER.log(Level.INFO, "1: " + debugMessage1); | |||
LOGGER.log(Level.INFO, "2: " + debugMessage2); | |||
if (!debugMessage1.equals(debugMessage2)) { | |||
if (!debugMessage1.equals(debugMessage2)) { | |||
compareMessage(split(debugMessage1), split(debugMessage2)); | |||
compareMessage(split(debugMessage1), split(debugMessage2)); | |||
LOGGER.log(Level.INFO, "DONE"); | |||
LOGGER.log(Level.INFO, "DONE"); | |||
return true; | |||
} else { | |||
return false; | |||
} | |||
return true; | |||
} else { | |||
return false; | |||
} | |||
}); | |||
} |
@@ -4,8 +4,6 @@ import static org.hamcrest.CoreMatchers.containsString; | |||
import static org.hamcrest.MatcherAssert.assertThat; | |||
import org.junit.Test; | |||
import org.openqa.selenium.WebDriver; | |||
import org.openqa.selenium.support.ui.ExpectedCondition; | |||
import com.vaadin.testbench.By; | |||
import com.vaadin.v7.tests.components.grid.basicfeatures.GridBasicClientFeaturesTest; | |||
@@ -25,14 +23,8 @@ public class GridDisabledSideBarTest extends GridBasicClientFeaturesTest { | |||
private void toggleSideBarMenuAndDisable() { | |||
selectMenuPath("Component", "Sidebar", "Open sidebar and disable grid"); | |||
waitUntil(new ExpectedCondition<Boolean>() { | |||
@Override | |||
public Boolean apply(WebDriver input) { | |||
return !findElement(By.className("v-grid-sidebar-button")) | |||
.isEnabled(); | |||
} | |||
}); | |||
waitUntil(input -> !findElement(By.className("v-grid-sidebar-button")) | |||
.isEnabled()); | |||
} | |||
private void clickSideBarButton() { |