Change-Id: I0d1747d41b3b9e0a32d995a5cea9081292c8c2c6tags/7.3.0.alpha2^2
@@ -47,6 +47,9 @@ public class VerifyBrowserVersionTest extends MultiBrowserTest { | |||
expectedUserAgent | |||
.put(Browser.CHROME.getDesiredCapabilities(), | |||
"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.117 Safari/537.36"); | |||
expectedUserAgent | |||
.put(Browser.PHANTOMJS.getDesiredCapabilities(), | |||
"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.7 Safari/534.34"); | |||
} | |||
@@ -4,26 +4,22 @@ import java.util.List; | |||
import org.junit.Assert; | |||
import org.junit.Test; | |||
import org.openqa.selenium.WebElement; | |||
import org.openqa.selenium.interactions.Actions; | |||
import org.openqa.selenium.remote.DesiredCapabilities; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
public class ActionsOnInvisibleComponentsTest extends MultiBrowserTest { | |||
private static final String LAST_INIT_LOG = "3. 'C' triggers a click on a visible and enabled button"; | |||
// This method should be removed once #12785 is fixed | |||
@Override | |||
public List<DesiredCapabilities> getBrowsersToTest() { | |||
List<DesiredCapabilities> browsers = super.getBrowsersToTest(); | |||
// sendKeys does nothing on these browsers | |||
// Send Keys does not function correctly on these browsers. | |||
browsers.remove(Browser.CHROME.getDesiredCapabilities()); | |||
browsers.remove(Browser.FIREFOX.getDesiredCapabilities()); | |||
browsers.remove(Browser.IE8.getDesiredCapabilities()); | |||
browsers.remove(Browser.OPERA.getDesiredCapabilities()); | |||
// Causes 'cannot focus element' | |||
browsers.remove(Browser.CHROME.getDesiredCapabilities()); | |||
return browsers; | |||
} | |||
@@ -40,7 +36,6 @@ public class ActionsOnInvisibleComponentsTest extends MultiBrowserTest { | |||
} | |||
private void invokeShortcut(CharSequence key) { | |||
WebElement shortcutTarget = vaadinElementById("test-root"); | |||
shortcutTarget.sendKeys(key); | |||
new Actions(getDriver()).sendKeys(key).perform(); | |||
} | |||
} |
@@ -20,9 +20,11 @@ import static org.junit.Assert.assertEquals; | |||
import org.junit.Test; | |||
import org.openqa.selenium.Keys; | |||
import org.openqa.selenium.WebElement; | |||
import org.openqa.selenium.interactions.Actions; | |||
import com.vaadin.testbench.By; | |||
import com.vaadin.testbench.commands.TestBenchElementCommands; | |||
import com.vaadin.testbench.elements.ComboBoxElement; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
/** | |||
@@ -35,21 +37,18 @@ public class ComboBoxSetNullWhenNewItemsAllowedTest extends MultiBrowserTest { | |||
throws InterruptedException { | |||
setDebug(true); | |||
openTestURL(); | |||
Thread.sleep(1000); | |||
WebElement element = findElement(); | |||
WebElement element = $(ComboBoxElement.class).first().findElement( | |||
By.vaadin("#textbox")); | |||
((TestBenchElementCommands) element).click(8, 7); | |||
element.clear(); | |||
element.sendKeys("New value"); | |||
assertEquals("New value", element.getAttribute("value")); | |||
element.sendKeys(Keys.RETURN); | |||
if (BrowserUtil.isPhantomJS(getDesiredCapabilities())) { | |||
new Actions(getDriver()).sendKeys(Keys.ENTER).perform(); | |||
} else { | |||
element.sendKeys(Keys.RETURN); | |||
} | |||
assertEquals("", element.getAttribute("value")); | |||
} | |||
private WebElement findElement() { | |||
return getDriver() | |||
.findElement( | |||
By.vaadin("runcomvaadintestscomponentscomboboxComboBoxSetNullWhenNewItemsAllowed::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]#textbox")); | |||
} | |||
} |
@@ -19,10 +19,10 @@ import org.junit.Assert; | |||
import org.junit.Test; | |||
import org.openqa.selenium.By; | |||
import org.openqa.selenium.Dimension; | |||
import org.openqa.selenium.NoSuchElementException; | |||
import org.openqa.selenium.WebElement; | |||
import org.openqa.selenium.interactions.Actions; | |||
import com.vaadin.testbench.elements.NotificationElement; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
public class DateFieldTestTest extends MultiBrowserTest { | |||
@@ -44,12 +44,8 @@ public class DateFieldTestTest extends MultiBrowserTest { | |||
} | |||
private void assertNoErrorNotification() { | |||
try { | |||
getDriver().findElement( | |||
By.xpath("//div[contains(@class, 'v-Notification') ]")); | |||
Assert.fail("Error notification shown!"); | |||
} catch (NoSuchElementException e) { | |||
// As expected | |||
if (isElementPresent(NotificationElement.class)) { | |||
Assert.fail("Notification was present"); | |||
} | |||
} | |||
@@ -32,7 +32,9 @@ public class CtrlShiftMultiselectTest extends MultiBrowserTest { | |||
@Override | |||
public List<DesiredCapabilities> getBrowsersToTest() { | |||
List<DesiredCapabilities> browsers = super.getBrowsersToTest(); | |||
// Shift + click doesn't select all rows correctly on these browsers | |||
browsers.remove(Browser.FIREFOX.getDesiredCapabilities()); | |||
browsers.remove(Browser.PHANTOMJS.getDesiredCapabilities()); | |||
return browsers; | |||
} |
@@ -17,9 +17,8 @@ package com.vaadin.tests.components.table; | |||
import org.junit.Assert; | |||
import org.junit.Test; | |||
import org.openqa.selenium.By; | |||
import org.openqa.selenium.NoSuchElementException; | |||
import com.vaadin.testbench.elements.NotificationElement; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
public class EmptyTableTest extends MultiBrowserTest { | |||
@@ -33,12 +32,9 @@ public class EmptyTableTest extends MultiBrowserTest { | |||
} | |||
private void ensureNoErrors() { | |||
try { | |||
getDriver().findElement(By.className("v-Notification")); | |||
} catch (NoSuchElementException e) { | |||
return; | |||
if (isElementPresent(NotificationElement.class)) { | |||
Assert.fail("Error notification was shown!"); | |||
} | |||
Assert.fail("Error notification was shown!"); | |||
} | |||
} |
@@ -47,10 +47,11 @@ public class SelectAllRowsTest extends MultiBrowserTest { | |||
@Override | |||
public List<DesiredCapabilities> getBrowsersToTest() { | |||
// Pressing Shift modifier key does not work with Firefox | |||
// Pressing Shift modifier key does not work with Firefox and PhantomJS | |||
ArrayList<DesiredCapabilities> browsers = new ArrayList<DesiredCapabilities>( | |||
super.getBrowsersToTest()); | |||
browsers.remove(Browser.FIREFOX.getDesiredCapabilities()); | |||
browsers.remove(Browser.PHANTOMJS.getDesiredCapabilities()); | |||
return browsers; | |||
} | |||
@@ -18,16 +18,28 @@ package com.vaadin.tests.components.tabsheet; | |||
import static org.junit.Assert.assertFalse; | |||
import static org.junit.Assert.assertTrue; | |||
import java.util.List; | |||
import org.junit.Test; | |||
import org.openqa.selenium.Keys; | |||
import org.openqa.selenium.WebElement; | |||
import org.openqa.selenium.interactions.Actions; | |||
import org.openqa.selenium.remote.DesiredCapabilities; | |||
import com.vaadin.testbench.By; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
public class TabSheetFocusedTabTest extends MultiBrowserTest { | |||
@Override | |||
public List<DesiredCapabilities> getBrowsersToTest() { | |||
List<DesiredCapabilities> browsers = super.getBrowsersToTest(); | |||
// PhantomJS doesn't send Focus / Blur events when clicking or | |||
// navigating with keyboard | |||
browsers.remove(Browser.PHANTOMJS.getDesiredCapabilities()); | |||
return browsers; | |||
} | |||
@Override | |||
protected Class<?> getUIClass() { | |||
return TabsheetScrolling.class; | |||
@@ -41,7 +53,7 @@ public class TabSheetFocusedTabTest extends MultiBrowserTest { | |||
assertTrue(isFocused(getTab(1))); | |||
new Actions(getDriver()).sendKeys(Keys.RIGHT).perform(); | |||
new Actions(getDriver()).sendKeys(Keys.ARROW_RIGHT).perform(); | |||
assertFalse(isFocused(getTab(1))); | |||
assertTrue(isFocused(getTab(3))); | |||
@@ -65,6 +77,7 @@ public class TabSheetFocusedTabTest extends MultiBrowserTest { | |||
} | |||
private boolean isFocused(WebElement tab) { | |||
return tab.getAttribute("class").contains("v-tabsheet-tabitem-focus"); | |||
} | |||
@@ -22,6 +22,7 @@ import org.openqa.selenium.WebElement; | |||
import org.openqa.selenium.interactions.Actions; | |||
import com.vaadin.testbench.By; | |||
import com.vaadin.testbench.elements.ButtonElement; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
public class TabsheetScrollingTest extends MultiBrowserTest { | |||
@@ -38,19 +39,11 @@ public class TabsheetScrollingTest extends MultiBrowserTest { | |||
} | |||
private WebElement getTab(int index) { | |||
return getDriver().findElement( | |||
By.vaadin("/VVerticalLayout[0]/Slot[1]" | |||
+ "/VVerticalLayout[0]/Slot[0]/VTabsheet[0]" | |||
+ "/domChild[0]/domChild[0]/domChild[0]" | |||
+ "/domChild[0]/domChild[" + index + "]")); | |||
return getDriver().findElement(By.vaadin("//TabSheet#tab[1]")); | |||
} | |||
private String getHideButtonText() { | |||
WebElement buttonCaption = getDriver().findElement( | |||
By.vaadin("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]" | |||
+ "/Slot[0]/VTabsheet[0]/VTabsheetPanel[0]" | |||
+ "/VButton[0]/domChild[0]/domChild[0]")); | |||
ButtonElement buttonCaption = $(ButtonElement.class).first(); | |||
return buttonCaption.getText(); | |||
} | |||
@@ -48,10 +48,10 @@ public class TextAreaEventPropagation extends AbstractTestUIWithLog { | |||
FormLayout form = new FormLayout(); | |||
TextArea textArea = new TextArea("Text input"); | |||
TextField textField = new TextField("Text field input"); | |||
enterButtonPressed = new Label("Enter Label"); | |||
enterButtonPressed.setCaption(NO_BUTTON_PRESSED); | |||
escapeButtonPressed = new Label("Escape Label"); | |||
escapeButtonPressed.setCaption(NO_BUTTON_PRESSED); | |||
enterButtonPressed = new Label(NO_BUTTON_PRESSED); | |||
enterButtonPressed.setCaption("Enter Label"); | |||
escapeButtonPressed = new Label(NO_BUTTON_PRESSED); | |||
escapeButtonPressed.setCaption("Escape Label"); | |||
Button enterButton = new Button("Enter"); | |||
enterButton.setClickShortcut(KeyCode.ENTER); | |||
@@ -60,7 +60,7 @@ public class TextAreaEventPropagation extends AbstractTestUIWithLog { | |||
@Override | |||
public void buttonClick(ClickEvent event) { | |||
enterButtonPressed.setCaption(BUTTON_PRESSED); | |||
enterButtonPressed.setValue(BUTTON_PRESSED); | |||
} | |||
}); | |||
@@ -71,7 +71,7 @@ public class TextAreaEventPropagation extends AbstractTestUIWithLog { | |||
@Override | |||
public void buttonClick(ClickEvent event) { | |||
escapeButtonPressed.setCaption(BUTTON_PRESSED); | |||
escapeButtonPressed.setValue(BUTTON_PRESSED); | |||
} | |||
}); | |||
@@ -18,11 +18,13 @@ package com.vaadin.tests.components.ui; | |||
import static org.junit.Assert.assertEquals; | |||
import org.junit.Test; | |||
import org.openqa.selenium.By; | |||
import org.openqa.selenium.Keys; | |||
import org.openqa.selenium.WebElement; | |||
import org.openqa.selenium.interactions.Actions; | |||
import com.vaadin.testbench.elements.LabelElement; | |||
import com.vaadin.testbench.elements.TextAreaElement; | |||
import com.vaadin.testbench.elements.TextFieldElement; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
/** | |||
@@ -35,7 +37,7 @@ public class TextAreaEventPropagationTest extends MultiBrowserTest { | |||
@Test | |||
public void testTextAreaEnterEventPropagation() throws InterruptedException { | |||
openTestURL(); | |||
WebElement textArea = vaadinElement("//TextArea[0]"); | |||
WebElement textArea = $(TextAreaElement.class).first(); | |||
Actions builder = new Actions(driver); | |||
builder.click(textArea); | |||
builder.sendKeys(textArea, "first line asdf"); | |||
@@ -43,11 +45,11 @@ public class TextAreaEventPropagationTest extends MultiBrowserTest { | |||
builder.sendKeys(textArea, "second line jkl;"); | |||
builder.perform(); | |||
WebElement enterLabel = driver.findElement(By.id("gwt-uid-8")); | |||
String text = enterLabel.getText(); | |||
String text = $(LabelElement.class).caption("Enter Label").first() | |||
.getText(); | |||
assertEquals(TextAreaEventPropagation.NO_BUTTON_PRESSED, text); | |||
WebElement textField = vaadinElement("//TextField[0]"); | |||
WebElement textField = $(TextFieldElement.class).first(); | |||
Actions builder2 = new Actions(driver); | |||
builder2.click(textField); | |||
@@ -56,7 +58,7 @@ public class TextAreaEventPropagationTest extends MultiBrowserTest { | |||
builder2.perform(); | |||
text = enterLabel.getText(); | |||
text = $(LabelElement.class).caption("Enter Label").first().getText(); | |||
assertEquals(TextAreaEventPropagation.BUTTON_PRESSED, text); | |||
@@ -66,7 +68,7 @@ public class TextAreaEventPropagationTest extends MultiBrowserTest { | |||
public void testTextAreaEscapeEventPropagation() | |||
throws InterruptedException { | |||
openTestURL(); | |||
WebElement textArea = vaadinElement("//TextArea[0]"); | |||
WebElement textArea = $(TextAreaElement.class).first(); | |||
Actions builder = new Actions(driver); | |||
builder.click(textArea); | |||
builder.sendKeys(textArea, "first line asdf"); | |||
@@ -75,11 +77,10 @@ public class TextAreaEventPropagationTest extends MultiBrowserTest { | |||
builder.sendKeys(Keys.ESCAPE); | |||
builder.perform(); | |||
WebElement enterLabel = driver.findElement(By.id("gwt-uid-8")); | |||
String text = enterLabel.getText(); | |||
String text = $(LabelElement.class).caption("Enter Label").first() | |||
.getText(); | |||
assertEquals(TextAreaEventPropagation.NO_BUTTON_PRESSED, text); | |||
WebElement escapeLabel = driver.findElement(By.id("gwt-uid-10")); | |||
text = escapeLabel.getText(); | |||
text = $(LabelElement.class).caption("Escape Label").first().getText(); | |||
assertEquals(TextAreaEventPropagation.BUTTON_PRESSED, text); | |||
} | |||
@@ -88,7 +89,7 @@ public class TextAreaEventPropagationTest extends MultiBrowserTest { | |||
public void testTextFieldEscapeEventPropagation() | |||
throws InterruptedException { | |||
openTestURL(); | |||
WebElement textArea = vaadinElement("//TextArea[0]"); | |||
WebElement textArea = $(TextAreaElement.class).first(); | |||
Actions builder = new Actions(driver); | |||
builder.click(textArea); | |||
builder.sendKeys(textArea, "first line asdf"); | |||
@@ -96,12 +97,11 @@ public class TextAreaEventPropagationTest extends MultiBrowserTest { | |||
builder.sendKeys(textArea, "second line jkl;"); | |||
builder.perform(); | |||
WebElement enterLabel = driver.findElement(By.id("gwt-uid-8")); | |||
String text = enterLabel.getText(); | |||
String text = $(LabelElement.class).caption("Enter Label").first() | |||
.getText(); | |||
assertEquals(TextAreaEventPropagation.NO_BUTTON_PRESSED, text); | |||
WebElement escapeLabel = driver.findElement(By.id("gwt-uid-10")); | |||
WebElement textField = vaadinElement("//TextField[0]"); | |||
WebElement textField = $(TextFieldElement.class).first(); | |||
Actions builder2 = new Actions(driver); | |||
builder2.click(textField); | |||
@@ -111,13 +111,10 @@ public class TextAreaEventPropagationTest extends MultiBrowserTest { | |||
builder2.perform(); | |||
text = enterLabel.getText(); | |||
text = $(LabelElement.class).caption("Enter Label").first().getText(); | |||
assertEquals(TextAreaEventPropagation.BUTTON_PRESSED, text); | |||
text = escapeLabel.getText(); | |||
text = $(LabelElement.class).caption("Escape Label").first().getText(); | |||
assertEquals(TextAreaEventPropagation.BUTTON_PRESSED, text); | |||
} | |||
} |
@@ -57,11 +57,6 @@ import com.vaadin.ui.TwinColSelect; | |||
import com.vaadin.ui.Upload; | |||
import com.vaadin.ui.VerticalLayout; | |||
/** | |||
* | |||
* @since | |||
* @author Vaadin Ltd | |||
*/ | |||
public class FontIcons extends AbstractTestUI { | |||
@Override | |||
@@ -105,7 +100,7 @@ public class FontIcons extends AbstractTestUI { | |||
Notification n = new Notification("Hey there!"); | |||
n.setIcon(icon); | |||
n.setPosition(Position.BOTTOM_CENTER); | |||
n.setDelayMsec(-1); | |||
n.setDelayMsec(300000); | |||
n.show(Page.getCurrent()); | |||
// grid of compoents |
@@ -21,11 +21,6 @@ import org.junit.Test; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
/** | |||
* | |||
* @since | |||
* @author Vaadin Ltd | |||
*/ | |||
public class FontIconsTest extends MultiBrowserTest { | |||
@Test |
@@ -38,6 +38,8 @@ public class PushConfigurationStreamingTest extends PushConfigurationTest { | |||
@Test | |||
public void testStreaming() throws InterruptedException { | |||
openDebugLogTab(); | |||
new Select(getTransportSelect()).selectByVisibleText("STREAMING"); | |||
new Select(getPushModeSelect()).selectByVisibleText("AUTOMATIC"); | |||
@@ -33,6 +33,7 @@ public class PushConfigurationWebSocketTest extends PushConfigurationTest { | |||
List<DesiredCapabilities> browsers = super.getBrowsersToTest(); | |||
browsers.remove(Browser.IE8.getDesiredCapabilities()); | |||
browsers.remove(Browser.IE9.getDesiredCapabilities()); | |||
browsers.remove(Browser.PHANTOMJS.getDesiredCapabilities()); | |||
return browsers; | |||
} |
@@ -20,6 +20,7 @@ import org.junit.Test; | |||
import org.openqa.selenium.By; | |||
import org.openqa.selenium.WebElement; | |||
import com.vaadin.testbench.elements.LabelElement; | |||
import com.vaadin.tests.annotations.TestCategory; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
@@ -31,11 +32,15 @@ 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", | |||
vaadinElement( | |||
"/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VLabel[0]") | |||
.getText()); | |||
$(LabelElement.class).get(idx).getText()); | |||
WebElement table = vaadinElementById("testtable"); | |||
WebElement row = table.findElement(By |
@@ -956,10 +956,14 @@ public abstract class AbstractTB3Test extends TestBenchTestCase { | |||
} | |||
public void hitButton(String id) { | |||
WebDriverBackedSelenium selenium = new WebDriverBackedSelenium(driver, | |||
driver.getCurrentUrl()); | |||
if (BrowserUtil.isPhantomJS(getDesiredCapabilities())) { | |||
driver.findElement(By.id(id)).click(); | |||
} else { | |||
WebDriverBackedSelenium selenium = new WebDriverBackedSelenium( | |||
driver, driver.getCurrentUrl()); | |||
selenium.keyPress("id=" + id, "\\13"); | |||
selenium.keyPress("id=" + id, "\\13"); | |||
} | |||
} | |||
protected void openDebugLogTab() { |
@@ -66,6 +66,7 @@ public abstract class MultiBrowserTest extends PrivateTB3Configuration { | |||
// Uncomment once we have the capability to run on Safari 6 | |||
// allBrowsers.add(SAFARI); | |||
allBrowsers.add(Browser.CHROME.getDesiredCapabilities()); | |||
allBrowsers.add(Browser.PHANTOMJS.getDesiredCapabilities()); | |||
// Re-enable this when it is possible to run on a modern Opera version | |||
// allBrowsers.add(Browser.OPERA.getDesiredCapabilities()); | |||
} |
@@ -41,6 +41,7 @@ public abstract class WebsocketTest extends PrivateTB3Configuration { | |||
websocketBrowsers.addAll(MultiBrowserTest.getAllBrowsers()); | |||
websocketBrowsers.remove(Browser.IE8.getDesiredCapabilities()); | |||
websocketBrowsers.remove(Browser.IE9.getDesiredCapabilities()); | |||
websocketBrowsers.remove(Browser.PHANTOMJS.getDesiredCapabilities()); | |||
} | |||
/** |