Select select = new Select(timeSelects.get(0));
select.selectByValue("09");
- // selectByValue is flaky, repeat to ensure selection actually happens
- select.selectByValue("09");
+ // selecting is flaky, try index selection too to ensure selection
+ // actually happens
+ select.selectByIndex(9);
findElement(By.id("test-button")).click();
waitUntil(new ExpectedCondition<Boolean>() {
headerCellWidth + dragOffset,
headerCells.get(0).getSize().getWidth(), delta);
+ // make absolutely certain the mouse isn't pressed anymore before moving
+ // to the context menu
+ new Actions(getDriver()).release().perform();
+
// Make column 'Last Name' visible
WebElement menuButton = grid.findElement(By.className("v-contextmenu"))
.findElement(By.tagName("button"));
import static org.junit.Assert.assertEquals;
import org.junit.Test;
+import org.openqa.selenium.interactions.Actions;
+import com.vaadin.testbench.elements.LabelElement;
import com.vaadin.testbench.elements.MenuBarElement;
import com.vaadin.tests.tb3.MultiBrowserTest;
public class MenuBarNavigationMouseTest extends MultiBrowserTest {
+ private LabelElement label;
+
@Override
protected Class<?> getUIClass() {
return MenuBarNavigation.class;
public void testMenuBarMouseNavigation() throws Exception {
openTestURL();
MenuBarElement menuBar = $(MenuBarElement.class).first();
+ label = $(LabelElement.class).first();
+
+ // move to Label to ensure all mouse moves are treated the same
+ resetMousePosition();
// clicks separated to different calls for more informative errors
menuBar.clickItem("File");
assertEquals("1. MenuItem File/Export../As PDF... selected",
getLogRow(0));
+ resetMousePosition();
+
menuBar.clickItem("Edit");
menuBar.clickItem("Copy");
assertEquals("2. MenuItem Edit/Copy selected", getLogRow(0));
+ resetMousePosition();
+
menuBar.clickItem("Help");
assertEquals("3. MenuItem Help selected", getLogRow(0));
+ resetMousePosition();
+
menuBar.clickItem("File");
menuBar.clickItem("Exit");
assertEquals("4. MenuItem File/Exit selected", getLogRow(0));
}
+
+ private void resetMousePosition() {
+ new Actions(driver).moveToElement(label).perform();
+ }
}