@@ -1,10 +1,13 @@ | |||
package com.vaadin.v7.tests.components.grid; | |||
import com.vaadin.server.UserError; | |||
import com.vaadin.server.VaadinRequest; | |||
import com.vaadin.tests.components.AbstractTestUI; | |||
import com.vaadin.tests.util.PersonContainer; | |||
import com.vaadin.ui.Button; | |||
import com.vaadin.v7.ui.Grid; | |||
@SuppressWarnings("deprecation") | |||
public class GridWithoutRenderer extends AbstractTestUI { | |||
@Override | |||
@@ -12,6 +15,8 @@ public class GridWithoutRenderer extends AbstractTestUI { | |||
Grid grid = new Grid(); | |||
grid.setContainerDataSource(PersonContainer.createWithTestData()); | |||
addComponent(grid); | |||
addComponent(new Button("Add error", | |||
e -> grid.setComponentError(new UserError("fail")))); | |||
} | |||
} |
@@ -10,6 +10,7 @@ import org.openqa.selenium.interactions.Actions; | |||
import com.vaadin.testbench.elements.ComboBoxElement; | |||
import com.vaadin.testbench.elements.MenuBarElement; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
import com.vaadin.ui.Notification.Type; | |||
/** | |||
* Test that checks whether Combobox popup is closed on click to autoopen | |||
@@ -21,7 +22,6 @@ public class ComboboxMenuBarAutoopenTest extends MultiBrowserTest { | |||
@Test | |||
public void closeComboboxPopupOnClickToMenuBar() { | |||
setDebug(true); | |||
openTestURL(); | |||
openPopup(); | |||
@@ -29,15 +29,24 @@ public class ComboboxMenuBarAutoopenTest extends MultiBrowserTest { | |||
menuBar.click(); | |||
assertFalse("Combobox popup items are visible", | |||
isElementPresent(By.className("gwt-MenuItem"))); | |||
} | |||
@Test | |||
public void closeComboboxPopupOnClickToMenuBarItem() { | |||
openTestURL(); | |||
openPopup(); | |||
menuBar = selectMenuBar(); | |||
// hover over menubar to open | |||
WebElement menuBarItem = findElement( | |||
By.className("v-menubar-menuitem-caption")); | |||
Actions actions = new Actions(getDriver()); | |||
actions.moveToElement(menuBarItem).build().perform(); | |||
menuBar.click(); | |||
moveToElement(menuBarItem); | |||
// click submenu item | |||
findElements(By.className("v-menubar-menuitem-caption")).get(1).click(); | |||
assertElementPresent(By.className( | |||
"v-Notification-" + Type.HUMANIZED_MESSAGE.getStyle())); | |||
assertFalse("Combobox popup items are visible", | |||
isElementPresent(By.className("gwt-MenuItem"))); | |||
} | |||
@@ -46,20 +55,20 @@ public class ComboboxMenuBarAutoopenTest extends MultiBrowserTest { | |||
ComboBoxElement combobox = $(ComboBoxElement.class).first(); | |||
combobox.openPopup(); | |||
Actions actions = new Actions(getDriver()); | |||
actions.moveToElement( | |||
getDriver().findElement(By.className("gwt-MenuItem"))).build() | |||
.perform(); | |||
moveToElement(findElement(By.className("gwt-MenuItem"))); | |||
} | |||
private MenuBarElement selectMenuBar() { | |||
MenuBarElement menuBar = $(MenuBarElement.class).first(); | |||
menuBar.focus(); | |||
Actions actions = new Actions(getDriver()); | |||
actions.moveToElement(menuBar).build().perform(); | |||
moveToElement(menuBar); | |||
return menuBar; | |||
} | |||
private void moveToElement(WebElement target) { | |||
Actions actions = new Actions(driver); | |||
actions.moveToElement(target).build().perform(); | |||
} | |||
} |
@@ -21,7 +21,6 @@ public class GridDetailsUpdateItemsTest extends MultiBrowserTest { | |||
ButtonElement button = $(ButtonElement.class).first(); | |||
String details0 = grid.getDetails(0).getText(); | |||
System.out.println("details: " + details0); | |||
// change the contents | |||
button.click(); |
@@ -1,5 +1,8 @@ | |||
package com.vaadin.tests.components.grid; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.junit.Assert.assertTrue; | |||
import java.util.List; | |||
import org.junit.Test; | |||
@@ -10,9 +13,6 @@ import com.vaadin.testbench.elements.GridElement; | |||
import com.vaadin.testbench.parallel.TestCategory; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.junit.Assert.assertTrue; | |||
@TestCategory("grid") | |||
public class GridEditorMultiselectTest extends MultiBrowserTest { | |||
@@ -27,7 +27,9 @@ public class GridEditorMultiselectTest extends MultiBrowserTest { | |||
public void testSelectCheckboxesEnabledBackOnSave() { | |||
openTestURL(); | |||
GridElement grid = openEditor(); | |||
grid.getEditor().save(); | |||
waitForElementPresent(By.className("v-grid-editor-save")); | |||
sleep(100); // wait for repositioning | |||
findElement(By.className("v-grid-editor-save")).click(); | |||
waitForElementNotPresent(By.className("v-grid-editor-cells")); | |||
assertCheckboxesEnabled(grid, true); | |||
} | |||
@@ -36,14 +38,17 @@ public class GridEditorMultiselectTest extends MultiBrowserTest { | |||
public void testSelectCheckboxesEnabledBackOnCancel() { | |||
openTestURL(); | |||
GridElement grid = openEditor(); | |||
grid.getEditor().cancel(); | |||
sleep(100); | |||
waitForElementPresent(By.className("v-grid-editor-cancel")); | |||
sleep(100); // wait for repositioning | |||
findElement(By.className("v-grid-editor-cancel")).click(); | |||
waitForElementNotPresent(By.className("v-grid-editor-cells")); | |||
assertCheckboxesEnabled(grid, true); | |||
} | |||
private GridElement openEditor() { | |||
GridElement grid = $(GridElement.class).first(); | |||
grid.getRow(0).doubleClick(); | |||
waitForElementPresent(By.className("v-grid-editor-cells")); | |||
assertTrue("Grid editor should be displayed.", | |||
grid.getEditor().isDisplayed()); | |||
return grid; |
@@ -62,6 +62,7 @@ public class GridResizeHiddenColumnTest extends MultiBrowserTest { | |||
// Click on "Last Name" menu item | |||
action.click(visibilityToggle).perform(); | |||
waitUntilLoadingIndicatorNotVisible(); | |||
sleep(100); // wait for layouting | |||
// Check if column "Last Name" is visible | |||
headerCells = grid.getHeaderCells(0); |
@@ -97,12 +97,15 @@ public class EscalatorSpacerTest extends EscalatorBasicClientFeaturesTest { | |||
assertFalse("No spacers should be shown at the start", | |||
spacersAreFoundInDom()); | |||
selectMenuPath(FEATURES, SPACERS, ROW_1, SET_100PX); | |||
waitForElementPresent(By.className("v-escalator-spacer")); | |||
assertNotNull("Spacer should be shown after setting it", getSpacer(1)); | |||
} | |||
@Test | |||
public void closeVisibleSpacer() { | |||
selectMenuPath(FEATURES, SPACERS, ROW_1, SET_100PX); | |||
waitForElementPresent(By.className("v-escalator-spacer")); | |||
assertNotNull("Unexpectedly missing spacer from row 1", getSpacer(1)); | |||
selectMenuPath(FEATURES, SPACERS, ROW_1, REMOVE); | |||
assertNull("Spacer should not exist after removing it", getSpacer(1)); | |||
} | |||
@@ -111,6 +114,7 @@ public class EscalatorSpacerTest extends EscalatorBasicClientFeaturesTest { | |||
public void spacerPushesVisibleRowsDown() { | |||
double oldTop = getElementTop(getBodyRow(2)); | |||
selectMenuPath(FEATURES, SPACERS, ROW_1, SET_100PX); | |||
waitForElementPresent(By.className("v-escalator-spacer")); | |||
double newTop = getElementTop(getBodyRow(2)); | |||
assertGreater("Row below a spacer was not pushed down", newTop, oldTop); | |||
@@ -123,6 +127,7 @@ public class EscalatorSpacerTest extends EscalatorBasicClientFeaturesTest { | |||
selectMenuPath(COLUMNS_AND_ROWS, BODY_ROWS, ADD_ONE_ROW_TO_BEGINNING); | |||
selectMenuPath(FEATURES, SPACERS, ROW_1, SET_100PX); | |||
waitForElementPresent(By.className("v-escalator-spacer")); | |||
double oldTop = getElementTop(getSpacer(1)); | |||
selectMenuPath(COLUMNS_AND_ROWS, BODY_ROWS, ADD_ONE_ROW_TO_BEGINNING); | |||
double newTop = getElementTop(getSpacer(2)); | |||
@@ -138,6 +143,7 @@ public class EscalatorSpacerTest extends EscalatorBasicClientFeaturesTest { | |||
selectMenuPath(COLUMNS_AND_ROWS, BODY_ROWS, ADD_ONE_ROW_TO_BEGINNING); | |||
selectMenuPath(FEATURES, SPACERS, ROW_1, SET_100PX); | |||
waitForElementPresent(By.className("v-escalator-spacer")); | |||
double oldTop = getElementTop(getSpacer(1)); | |||
selectMenuPath(COLUMNS_AND_ROWS, BODY_ROWS, ADD_ONE_ROW_TO_END); | |||
double newTop = getElementTop(getSpacer(1)); | |||
@@ -153,6 +159,7 @@ public class EscalatorSpacerTest extends EscalatorBasicClientFeaturesTest { | |||
selectMenuPath(COLUMNS_AND_ROWS, BODY_ROWS, ADD_ONE_ROW_TO_BEGINNING); | |||
selectMenuPath(FEATURES, SPACERS, ROW_1, SET_100PX); | |||
waitForElementPresent(By.className("v-escalator-spacer")); | |||
double spacerTop = getElementTop(getSpacer(1)); | |||
selectMenuPath(COLUMNS_AND_ROWS, BODY_ROWS, ADD_ONE_ROW_TO_END); | |||
double rowTop = getElementTop(getBodyRow(2)); | |||
@@ -175,6 +182,7 @@ public class EscalatorSpacerTest extends EscalatorBasicClientFeaturesTest { | |||
scrollVerticallyTo(999999); | |||
long oldBottomScrollTop = getScrollTop(); | |||
selectMenuPath(FEATURES, SPACERS, ROW_99, SET_100PX); | |||
waitForElementPresent(By.className("v-escalator-spacer")); | |||
assertEquals( | |||
"Adding a spacer underneath the current viewport should " | |||
@@ -194,6 +202,7 @@ public class EscalatorSpacerTest extends EscalatorBasicClientFeaturesTest { | |||
@Test | |||
public void removingRowAboveSpacerMovesSpacerUp() { | |||
selectMenuPath(FEATURES, SPACERS, ROW_1, SET_100PX); | |||
waitForElementPresent(By.className("v-escalator-spacer")); | |||
WebElement spacer = getSpacer(1); | |||
double originalElementTop = getElementTop(spacer); | |||
@@ -225,6 +234,7 @@ public class EscalatorSpacerTest extends EscalatorBasicClientFeaturesTest { | |||
public void spacersAreFixedInViewport_firstFreezeThenScroll() { | |||
selectMenuPath(FEATURES, FROZEN_COLUMNS, FREEZE_1_COLUMN); | |||
selectMenuPath(FEATURES, SPACERS, ROW_1, SET_100PX); | |||
waitForElementPresent(By.className("v-escalator-spacer")); | |||
assertEquals( | |||
"Spacer's left position should've been 0 at the " + "beginning", | |||
0d, getElementLeft(getSpacer(1)), WidgetUtil.PIXEL_EPSILON); | |||
@@ -244,6 +254,7 @@ public class EscalatorSpacerTest extends EscalatorBasicClientFeaturesTest { | |||
int scrollTo = 10; | |||
scrollHorizontallyTo(scrollTo); | |||
selectMenuPath(FEATURES, SPACERS, ROW_1, SET_100PX); | |||
waitForElementPresent(By.className("v-escalator-spacer")); | |||
assertEquals( | |||
"Spacer's left position should've been " + scrollTo | |||
+ " after scrolling " + scrollTo + "px", | |||
@@ -384,6 +395,7 @@ public class EscalatorSpacerTest extends EscalatorBasicClientFeaturesTest { | |||
selectMenuPath(FEATURES, SPACERS, FOCUSABLE_UPDATER); | |||
selectMenuPath(FEATURES, SPACERS, ROW_1, SET_100PX); | |||
waitForElementPresent(By.className("v-escalator-spacer")); | |||
WebElement inputElement = getEscalator() | |||
.findElement(By.tagName("input")); | |||
@@ -401,6 +413,7 @@ public class EscalatorSpacerTest extends EscalatorBasicClientFeaturesTest { | |||
@Test | |||
public void spacersAreInsertedInCorrectDomPosition() { | |||
selectMenuPath(FEATURES, SPACERS, ROW_1, SET_100PX); | |||
waitForElementPresent(By.className("v-escalator-spacer")); | |||
WebElement tbody = getEscalator().findElement(By.tagName("tbody")); | |||
WebElement spacer = getChild(tbody, 2); | |||
@@ -414,6 +427,7 @@ public class EscalatorSpacerTest extends EscalatorBasicClientFeaturesTest { | |||
public void spacersAreInCorrectDomPositionAfterScroll() | |||
throws InterruptedException { | |||
selectMenuPath(FEATURES, SPACERS, ROW_1, SET_100PX); | |||
waitForElementPresent(By.className("v-escalator-spacer")); | |||
scrollVerticallyTo(40); // roughly two rows' worth | |||
@@ -483,6 +497,7 @@ public class EscalatorSpacerTest extends EscalatorBasicClientFeaturesTest { | |||
public void spacerOpenedInViewGetsFocus() { | |||
selectMenuPath(FEATURES, SPACERS, FOCUSABLE_UPDATER); | |||
selectMenuPath(FEATURES, SPACERS, ROW_1, SET_100PX); | |||
waitForElementPresent(By.className("v-escalator-spacer")); | |||
tryToTabIntoFocusUpdaterElement(); | |||
WebElement focusedElement = getFocusedElement(); | |||
assertEquals("input", focusedElement.getTagName()); |
@@ -1,10 +1,11 @@ | |||
package com.vaadin.tests.components.ui; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.junit.Assert.assertFalse; | |||
import static org.junit.Assert.assertTrue; | |||
import org.junit.Test; | |||
import org.openqa.selenium.Keys; | |||
import org.openqa.selenium.WebElement; | |||
import org.openqa.selenium.interactions.Actions; | |||
import com.vaadin.testbench.elements.TextAreaElement; | |||
@@ -21,23 +22,17 @@ public class TextAreaEventPropagationTest extends MultiBrowserTest { | |||
@Test | |||
public void textAreaEnterEventPropagation() throws InterruptedException { | |||
openTestURL(); | |||
WebElement textArea = $(TextAreaElement.class).first(); | |||
TextAreaElement textArea = $(TextAreaElement.class).first(); | |||
Actions builder = new Actions(driver); | |||
builder.click(textArea); | |||
builder.sendKeys(textArea, "first line asdf"); | |||
builder.sendKeys(textArea, "first line asdf", Keys.ENTER, | |||
"second line jkl;"); | |||
builder.perform(); | |||
waitUntilLoadingIndicatorNotVisible(); | |||
builder.sendKeys(Keys.ENTER); | |||
builder.perform(); | |||
waitUntilLoadingIndicatorNotVisible(); | |||
builder.sendKeys(textArea, "second line jkl;"); | |||
builder.perform(); | |||
waitUntilLoadingIndicatorNotVisible(); | |||
builder.perform(); | |||
String text = textArea.getValue(); | |||
assertEquals("Unexpected text area content,", | |||
"first line asdf\nsecond line jkl;", text); | |||
// Should not have triggered shortcut | |||
assertEquals(" ", getLogRow(0)); | |||
} | |||
@@ -46,62 +41,55 @@ public class TextAreaEventPropagationTest extends MultiBrowserTest { | |||
public void testTextAreaEscapeEventPropagation() | |||
throws InterruptedException { | |||
openTestURL(); | |||
WebElement textArea = $(TextAreaElement.class).first(); | |||
TextAreaElement textArea = $(TextAreaElement.class).first(); | |||
Actions builder = new Actions(driver); | |||
builder.click(textArea); | |||
builder.sendKeys(textArea, "first line asdf"); | |||
builder.perform(); | |||
waitUntilLoadingIndicatorNotVisible(); | |||
builder.sendKeys(Keys.ESCAPE); | |||
builder.perform(); | |||
waitUntilLoadingIndicatorNotVisible(); | |||
builder.sendKeys(textArea, "second line jkl;"); | |||
builder.sendKeys(textArea, "first line asdf", Keys.ESCAPE, | |||
"second line jkl;"); | |||
builder.perform(); | |||
waitUntilLoadingIndicatorNotVisible(); | |||
String text = textArea.getValue(); | |||
// sendKeys is erratic and can eat some letters after escape, so only | |||
// test that beginning and end are present | |||
assertTrue("Unexpected text area content: " + text, | |||
text.startsWith("first line asdf")); | |||
assertTrue("Unexpected text area content: " + text, | |||
text.endsWith("nd line jkl;")); | |||
assertFalse("Unexpected text area content: " + text, | |||
text.contains("\n")); | |||
assertEquals("1. Escape button pressed", getLogRow(0)); | |||
} | |||
@Test | |||
public void testTextFieldEscapeEventPropagation() { | |||
openTestURL(); | |||
WebElement textField = $(TextFieldElement.class).first(); | |||
TextFieldElement textField = $(TextFieldElement.class).first(); | |||
Actions builder2 = new Actions(driver); | |||
builder2.click(textField); | |||
builder2.sendKeys("third line"); | |||
builder2.perform(); | |||
waitUntilLoadingIndicatorNotVisible(); | |||
builder2.sendKeys(Keys.ENTER); | |||
builder2.perform(); | |||
waitUntilLoadingIndicatorNotVisible(); | |||
builder2.sendKeys(Keys.ESCAPE); | |||
builder2.sendKeys(textField, "third line", Keys.ESCAPE); | |||
builder2.perform(); | |||
waitUntilLoadingIndicatorNotVisible(); | |||
assertEquals("1. Enter button pressed", getLogRow(1)); | |||
assertEquals("2. Escape button pressed", getLogRow(0)); | |||
String text = textField.getValue(); | |||
assertEquals("Unexpected text field content,", "third line", text); | |||
assertEquals("1. Escape button pressed", getLogRow(0)); | |||
} | |||
@Test | |||
public void testTextFieldEnterEventPropagation() { | |||
openTestURL(); | |||
WebElement textField = $(TextFieldElement.class).first(); | |||
TextFieldElement textField = $(TextFieldElement.class).first(); | |||
Actions builder2 = new Actions(driver); | |||
builder2.click(textField); | |||
builder2.sendKeys("third line"); | |||
builder2.perform(); | |||
waitUntilLoadingIndicatorNotVisible(); | |||
builder2.sendKeys(Keys.ENTER); | |||
builder2.sendKeys(textField, "third line", Keys.ENTER); | |||
builder2.perform(); | |||
waitUntilLoadingIndicatorNotVisible(); | |||
String text = textField.getValue(); | |||
assertEquals("Unexpected text field content,", "third line", text); | |||
assertEquals("1. Enter button pressed", getLogRow(0)); | |||
} | |||
} |
@@ -1,5 +1,9 @@ | |||
package com.vaadin.tests.elements.menubar; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.junit.Assert.assertFalse; | |||
import static org.junit.Assert.assertTrue; | |||
import java.util.List; | |||
import org.junit.Before; | |||
@@ -11,10 +15,6 @@ import org.openqa.selenium.WebElement; | |||
import com.vaadin.testbench.elements.MenuBarElement; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.junit.Assert.assertFalse; | |||
import static org.junit.Assert.assertTrue; | |||
public class MenuBarUITest extends MultiBrowserTest { | |||
@Override | |||
@@ -33,12 +33,15 @@ public class MenuBarUITest extends MultiBrowserTest { | |||
MenuBarElement menuBar = $(MenuBarElement.class).first(); | |||
menuBar.clickItem("File"); | |||
waitForElementPresent(By.className("v-menubar-popup")); | |||
assertTrue(isItemVisible("Export..")); | |||
menuBar.clickItem("Export.."); | |||
sleep(100); | |||
assertTrue(isItemVisible("As PDF...")); | |||
menuBar.clickItem("File"); | |||
sleep(100); | |||
assertFalse(isItemVisible("Export..")); | |||
} | |||
@@ -50,34 +53,41 @@ public class MenuBarUITest extends MultiBrowserTest { | |||
MenuBarElement menuBar = $(MenuBarElement.class).first(); | |||
menuBar.clickItem("File"); | |||
waitForElementPresent(By.className("v-menubar-popup")); | |||
assertTrue(isItemVisible("Save As..")); | |||
menuBar.clickItem("Export.."); | |||
sleep(100); | |||
assertTrue(isItemVisible("As PDF...")); | |||
// The Edit menu will be opened by moving the mouse over the item (done | |||
// by clickItem). The first click then actually closes the menu. | |||
menuBar.clickItem("Edit"); | |||
sleep(100); | |||
waitForElementNotPresent(By.className("v-menubar-popup")); | |||
menuBar.clickItem("Edit"); | |||
waitForElementPresent(By.className("v-menubar-popup")); | |||
assertFalse(isItemVisible("Save As..")); | |||
assertTrue(isItemVisible("Paste")); | |||
menuBar.clickItem("Edit"); | |||
sleep(100); | |||
assertFalse(isItemVisible("Save As..")); | |||
assertFalse(isItemVisible("Paste")); | |||
menuBar.clickItem("Edit"); | |||
sleep(100); | |||
assertFalse(isItemVisible("Save As..")); | |||
assertTrue(isItemVisible("Paste")); | |||
// Menu does not contain a submenu, no need to click twice. | |||
menuBar.clickItem("Help"); | |||
sleep(100); | |||
assertFalse(isItemVisible("Save As..")); | |||
assertFalse(isItemVisible("Paste")); | |||
// No submenu is open, so click only once to open the File menu. | |||
menuBar.clickItem("File"); | |||
sleep(100); | |||
assertTrue(isItemVisible("Save As..")); | |||
} | |||
@@ -88,6 +98,7 @@ public class MenuBarUITest extends MultiBrowserTest { | |||
public void testMenuBarClickPath() { | |||
MenuBarElement menuBar = $(MenuBarElement.class).first(); | |||
menuBar.clickItem("File", "Export.."); | |||
waitForElementPresent(By.className("v-menubar-popup")); | |||
assertTrue(isItemVisible("As Doc...")); | |||
} | |||
@@ -99,17 +110,22 @@ public class MenuBarUITest extends MultiBrowserTest { | |||
MenuBarElement menuBar = $(MenuBarElement.class).get(2); | |||
menuBar.clickItem("File"); | |||
waitForElementPresent(By.className("v-menubar-popup")); | |||
assertTrue(isItemVisible("Open2")); | |||
// Close the menu item | |||
menuBar.clickItem("File"); | |||
waitForElementNotPresent(By.className("v-menubar-popup")); | |||
menuBar = $(MenuBarElement.class).get(1); | |||
menuBar.clickItem("Edit2"); | |||
waitForElementPresent(By.className("v-menubar-popup")); | |||
assertTrue(isItemVisible("Cut")); | |||
menuBar.clickItem("Edit2"); | |||
waitForElementNotPresent(By.className("v-menubar-popup")); | |||
menuBar = $(MenuBarElement.class).first(); | |||
menuBar.clickItem("File"); | |||
waitForElementPresent(By.className("v-menubar-popup")); | |||
assertTrue(isItemVisible("Open")); | |||
} | |||
@@ -117,6 +133,7 @@ public class MenuBarUITest extends MultiBrowserTest { | |||
public void testMenuItemTooltips() { | |||
MenuBarElement first = $(MenuBarElement.class).first(); | |||
first.clickItem("File"); | |||
waitForElementPresent(By.className("v-menubar-popup")); | |||
assertTooltip("Open", "<b>Preformatted</b>\ndescription"); | |||
assertTooltip("Save", "plain description, <b>HTML</b> is visible"); | |||
assertTooltip("Exit", "HTML\ndescription"); |
@@ -49,7 +49,7 @@ public class GridClientRenderers extends MultiBrowserTest { | |||
return path; | |||
} | |||
@ServerClass("com.vaadin.tests.widgetset.server.grid.GridClientColumnRenderers.GridController") | |||
@ServerClass("com.vaadin.tests.widgetset.server.v7.grid.GridClientColumnRenderers.GridController") | |||
public static class MyClientGridElement extends GridElement { | |||
} | |||
@@ -1,5 +1,6 @@ | |||
package com.vaadin.v7.tests.components.grid; | |||
import static org.junit.Assert.assertFalse; | |||
import static org.junit.Assert.assertTrue; | |||
import java.util.List; | |||
@@ -8,6 +9,7 @@ import org.junit.Test; | |||
import org.openqa.selenium.By; | |||
import org.openqa.selenium.WebElement; | |||
import com.vaadin.testbench.elements.ButtonElement; | |||
import com.vaadin.testbench.parallel.TestCategory; | |||
import com.vaadin.tests.tb3.SingleBrowserTest; | |||
@@ -17,13 +19,18 @@ public class GridWithoutRendererTest extends SingleBrowserTest { | |||
@Test | |||
public void ensureNoError() { | |||
openTestURL(); | |||
// WebElement errorIndicator = findElement(By | |||
// .cssSelector("v-error-indicator")); | |||
// System.out.println(errorIndicator); | |||
waitForElementPresent(By.className("v-grid")); | |||
List<WebElement> errorIndicator = findElements( | |||
By.xpath("//span[@class='v-errorindicator']")); | |||
By.className("v-errorindicator")); | |||
assertTrue("There should not be an error indicator", | |||
errorIndicator.isEmpty()); | |||
// add an error to ensure that the check is correct | |||
$(ButtonElement.class).first().click(); | |||
errorIndicator = findElements(By.className("v-errorindicator")); | |||
assertFalse("There should be an error indicator", | |||
errorIndicator.isEmpty()); | |||
} | |||
} |
@@ -17,13 +17,25 @@ public class TreeItemDoubleClickTest extends MultiBrowserTest { | |||
openTestURL(); | |||
String caption = "Tree Item 2"; | |||
doubleClick(getTreeNodeByCaption(caption)); | |||
assertLogText("Double Click " + caption); | |||
try { | |||
assertLogText("Double Click " + caption); | |||
} catch (AssertionError e) { | |||
// double click is flaky, try again | |||
doubleClick(getTreeNodeByCaption(caption)); | |||
assertLogText("Double Click " + caption); | |||
} | |||
changeImmediate(); | |||
caption = "Tree Item 3"; | |||
doubleClick(getTreeNodeByCaption(caption)); | |||
assertLogText("Double Click " + caption); | |||
try { | |||
assertLogText("Double Click " + caption); | |||
} catch (AssertionError e) { | |||
// double click is flaky, try again | |||
doubleClick(getTreeNodeByCaption(caption)); | |||
assertLogText("Double Click " + caption); | |||
} | |||
} | |||
private void changeImmediate() { | |||
@@ -38,7 +50,7 @@ public class TreeItemDoubleClickTest extends MultiBrowserTest { | |||
private void doubleClick(WebElement element) { | |||
new Actions(getDriver()).doubleClick(element).build().perform(); | |||
sleep(100); | |||
} | |||
private void assertLogText(String text) { |