@@ -21,7 +21,7 @@ import java.util.List; | |||
import org.openqa.selenium.JavascriptExecutor; | |||
import org.openqa.selenium.Keys; | |||
import org.openqa.selenium.NoSuchElementException; | |||
import org.openqa.selenium.WebDriverException; | |||
import org.openqa.selenium.WebElement; | |||
import com.vaadin.testbench.By; | |||
@@ -183,7 +183,9 @@ public class ComboBoxElement extends AbstractSelectElement { | |||
try { | |||
getSuggestionPopup().findElement(byNextPage).click(); | |||
return true; | |||
} catch (NoSuchElementException e) { | |||
} catch (WebDriverException e) { | |||
// PhantomJS driver can throw WDE instead of the more specific | |||
// NoSuchElementException | |||
return false; | |||
} | |||
} | |||
@@ -197,7 +199,9 @@ public class ComboBoxElement extends AbstractSelectElement { | |||
try { | |||
getSuggestionPopup().findElement(byPrevPage).click(); | |||
return true; | |||
} catch (NoSuchElementException e) { | |||
} catch (WebDriverException e) { | |||
// PhantomJS driver can throw WDE instead of the more specific | |||
// NoSuchElementException | |||
return false; | |||
} | |||
} |
@@ -16,6 +16,7 @@ import org.openqa.selenium.By; | |||
import org.openqa.selenium.WebElement; | |||
import org.openqa.selenium.support.ui.Select; | |||
import com.vaadin.testbench.elements.AbstractComponentElement.ReadOnlyException; | |||
import com.vaadin.testbench.elements.ListSelectElement; | |||
import com.vaadin.tests.tb3.SingleBrowserTestPhantomJS2; | |||
@@ -108,14 +109,35 @@ public class ListSelectTest extends SingleBrowserTestPhantomJS2 { | |||
selectItem("Item 4"); | |||
Assert.assertEquals(lastLogRow, getLogRow(0)); | |||
assertNothingSelected(); | |||
} | |||
@Test(expected = ReadOnlyException.class) | |||
public void readOnly_selectByText() { | |||
selectMenuPath("Component", "Listeners", "Selection listener"); | |||
selectMenuPath("Component", "State", "Readonly"); | |||
List<WebElement> select = getListSelect() | |||
.findElements(By.tagName("select")); | |||
Assert.assertEquals(1, select.size()); | |||
Assert.assertNotNull(select.get(0).getAttribute("disabled")); | |||
addItemsToSelection("Item 2"); | |||
Assert.assertEquals(lastLogRow, getLogRow(0)); | |||
assertNothingSelected(); | |||
} | |||
@Test(expected = ReadOnlyException.class) | |||
public void readOnly_deselectByText() { | |||
selectMenuPath("Component", "Listeners", "Selection listener"); | |||
selectItem("Item 4"); | |||
selectMenuPath("Component", "State", "Readonly"); | |||
List<WebElement> select = getListSelect() | |||
.findElements(By.tagName("select")); | |||
Assert.assertEquals(1, select.size()); | |||
Assert.assertNotNull(select.get(0).getAttribute("disabled")); | |||
removeItemsFromSelection("Item 4"); | |||
Assert.assertEquals(lastLogRow, getLogRow(0)); | |||
assertNothingSelected(); | |||
} | |||
@Test |
@@ -21,7 +21,6 @@ import org.openqa.selenium.By; | |||
import org.openqa.selenium.WebElement; | |||
import com.vaadin.testbench.elements.LabelElement; | |||
import com.vaadin.testbench.parallel.BrowserUtil; | |||
import com.vaadin.testbench.parallel.TestCategory; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
@@ -33,15 +32,9 @@ public class PushErrorHandlingTest extends MultiBrowserTest { | |||
setPush(true); | |||
openTestURL(); | |||
vaadinElementById("npeButton").click(); | |||
int idx = 1; | |||
if (BrowserUtil.isPhantomJS(getDesiredCapabilities())) { | |||
// PhantomJS sends an extra event when page gets loaded. | |||
// This results as an extra error label. | |||
++idx; | |||
} | |||
Assert.assertEquals( | |||
"An error! Unable to invoke method click in com.vaadin.shared.ui.button.ButtonServerRpc", | |||
$(LabelElement.class).get(idx).getText()); | |||
$(LabelElement.class).get(1).getText()); | |||
WebElement table = vaadinElementById("testtable"); | |||
WebElement row = table |