summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorHenri Sara <hesara@vaadin.com>2015-08-19 11:54:59 +0300
committerHenri Sara <hesara@vaadin.com>2015-08-19 11:54:59 +0300
commit123c9fbc74d52c66f59bb825414ad3260aaea975 (patch)
tree8deda9347560f9324d36a5513d4a6fc555d0f13d /uitest
parent7a3e03b5acd416141e1a95eae32c3808a8e5addd (diff)
parente7fda93b300b11d9507f25917306e1f3d57cb27c (diff)
downloadvaadin-framework-123c9fbc74d52c66f59bb825414ad3260aaea975.tar.gz
vaadin-framework-123c9fbc74d52c66f59bb825414ad3260aaea975.zip
Merge branch 'master-before-18503' into grid-unbuffered-editor
Conflicts: server/src/com/vaadin/data/RpcDataProviderExtension.java uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorTest.java Change-Id: I9e7907c9caf839fd043444db0505f9853f020a6a
Diffstat (limited to 'uitest')
-rw-r--r--uitest/integration_tests.xml3
-rw-r--r--uitest/ivy.xml2
-rw-r--r--uitest/src/com/vaadin/tests/VerifyBrowserVersionTest.java2
-rw-r--r--uitest/src/com/vaadin/tests/components/calendar/NullEventMoveHandler.java14
-rw-r--r--uitest/src/com/vaadin/tests/components/calendar/NullEventMoveHandlerTest.java15
-rw-r--r--uitest/src/com/vaadin/tests/components/combobox/ComboboxPopupScrolling.java40
-rw-r--r--uitest/src/com/vaadin/tests/components/combobox/ComboboxPopupScrollingTest.java60
-rw-r--r--uitest/src/com/vaadin/tests/components/combobox/CustomComboBoxElement.java40
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/GridDetailsLocationTest.java5
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/GridWithBrokenRenderer.java43
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/GridWithBrokenRendererTest.java41
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java20
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorTest.java2
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSelectionTest.java58
-rw-r--r--uitest/src/com/vaadin/tests/components/tabsheet/TabSheetInSplitPanel.java43
-rw-r--r--uitest/src/com/vaadin/tests/components/tabsheet/TabSheetInSplitPanelTest.java43
-rw-r--r--uitest/src/com/vaadin/tests/components/treetable/TreeTableScrollOnExpand.java51
-rw-r--r--uitest/src/com/vaadin/tests/components/treetable/TreeTableScrollOnExpandTest.java46
-rw-r--r--uitest/src/com/vaadin/tests/components/window/GridInWindow.java49
-rw-r--r--uitest/src/com/vaadin/tests/components/window/GridInWindowTest.java36
-rw-r--r--uitest/src/com/vaadin/tests/components/window/OpenModalWindowAndFocusField.java62
-rw-r--r--uitest/src/com/vaadin/tests/components/window/OpenModalWindowAndFocusFieldTest.java48
-rw-r--r--uitest/src/com/vaadin/tests/push/ManualLongPollingPushUI.java94
-rw-r--r--uitest/src/com/vaadin/tests/push/ManualLongPollingPushUITest.java54
-rw-r--r--uitest/src/com/vaadin/tests/resources/SpecialCharsInThemeResources.java52
-rw-r--r--uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java94
-rw-r--r--uitest/src/com/vaadin/tests/tb3/newelements/WindowElement.java10
27 files changed, 1015 insertions, 12 deletions
diff --git a/uitest/integration_tests.xml b/uitest/integration_tests.xml
index d56ba2683f..bdbf1f2e5b 100644
--- a/uitest/integration_tests.xml
+++ b/uitest/integration_tests.xml
@@ -404,7 +404,8 @@
<antcall target="integration-test-osgi" />
<antcall target="integration-test-tomcat7apacheproxy" />
<antcall target="integration-test-websphere8" />
- <antcall target="integration-test-websphereportal8" />
+ <!-- Currently the test system does not have a server for automatic testing of WebSphere Portal 8 -->
+ <!-- <antcall target="integration-test-websphereportal8" /> -->
</parallel>
</target>
diff --git a/uitest/ivy.xml b/uitest/ivy.xml
index 8f2765c7a4..281ba1ecdf 100644
--- a/uitest/ivy.xml
+++ b/uitest/ivy.xml
@@ -31,7 +31,7 @@
rev="4.2.0.Final" conf="build,ide -> default" />
<!-- Google App Engine -->
<dependency org="com.google.appengine" name="appengine-api-1.0-sdk"
- rev="1.2.1" conf="build-provided,ide -> default" />
+ rev="1.7.7" conf="build-provided,ide -> default" />
<!-- LIBRARY DEPENDENCIES (compile time) -->
<!-- Project modules -->
diff --git a/uitest/src/com/vaadin/tests/VerifyBrowserVersionTest.java b/uitest/src/com/vaadin/tests/VerifyBrowserVersionTest.java
index c6ccd1bf4c..ed0f1a9b4f 100644
--- a/uitest/src/com/vaadin/tests/VerifyBrowserVersionTest.java
+++ b/uitest/src/com/vaadin/tests/VerifyBrowserVersionTest.java
@@ -40,7 +40,7 @@ public class VerifyBrowserVersionTest extends MultiBrowserTest {
// Chrome version does not necessarily match the desired version
// because of auto updates...
browserIdentifier = getExpectedUserAgentString(getDesiredCapabilities())
- + "43";
+ + "44";
} else {
browserIdentifier = getExpectedUserAgentString(desiredCapabilities)
+ desiredCapabilities.getVersion();
diff --git a/uitest/src/com/vaadin/tests/components/calendar/NullEventMoveHandler.java b/uitest/src/com/vaadin/tests/components/calendar/NullEventMoveHandler.java
index c2dfdb26c1..40dd43abb2 100644
--- a/uitest/src/com/vaadin/tests/components/calendar/NullEventMoveHandler.java
+++ b/uitest/src/com/vaadin/tests/components/calendar/NullEventMoveHandler.java
@@ -5,17 +5,27 @@ import java.text.SimpleDateFormat;
import java.util.Locale;
import com.vaadin.server.VaadinRequest;
-import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
import com.vaadin.ui.Calendar;
import com.vaadin.ui.components.calendar.CalendarComponentEvents;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.EventClick;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.EventClickHandler;
import com.vaadin.ui.components.calendar.event.BasicEvent;
-public class NullEventMoveHandler extends AbstractTestUI {
+public class NullEventMoveHandler extends AbstractTestUIWithLog {
@Override
protected void setup(VaadinRequest request) {
Calendar calendar = getCalendar();
calendar.setHandler((CalendarComponentEvents.EventMoveHandler) null);
+ calendar.setHandler(new EventClickHandler() {
+
+ @Override
+ public void eventClick(EventClick event) {
+ log("Clicked on " + event.getCalendarEvent().getCaption());
+
+ }
+ });
addComponent(calendar);
}
diff --git a/uitest/src/com/vaadin/tests/components/calendar/NullEventMoveHandlerTest.java b/uitest/src/com/vaadin/tests/components/calendar/NullEventMoveHandlerTest.java
index c40cd9ce97..156100310c 100644
--- a/uitest/src/com/vaadin/tests/components/calendar/NullEventMoveHandlerTest.java
+++ b/uitest/src/com/vaadin/tests/components/calendar/NullEventMoveHandlerTest.java
@@ -3,6 +3,7 @@ package com.vaadin.tests.components.calendar;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
+import org.junit.Assert;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
@@ -23,11 +24,25 @@ public class NullEventMoveHandlerTest extends DndActionsTest {
}
@Test
+ public void eventIsClickableWhenNotMovableInMonthView() {
+ getEvent().click();
+ Assert.assertEquals("1. Clicked on foo", getLogRow(0));
+ }
+
+ @Test
public void eventIsNotMovableInWeekView() {
openWeekView();
assertEventCannotBeMoved();
}
+ @Test
+ public void eventIsClickableWhenNotMovableInWeekView() {
+ openWeekView();
+ getEvent().findElement(By.className("v-calendar-event-caption"))
+ .click();
+ Assert.assertEquals("1. Clicked on foo", getLogRow(0));
+ }
+
private void assertEventCannotBeMoved() {
int originalPosition = getEventXPosition();
diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboboxPopupScrolling.java b/uitest/src/com/vaadin/tests/components/combobox/ComboboxPopupScrolling.java
new file mode 100644
index 0000000000..9f1c4b9e03
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/combobox/ComboboxPopupScrolling.java
@@ -0,0 +1,40 @@
+package com.vaadin.tests.components.combobox;
+
+import com.vaadin.annotations.Theme;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
+import com.vaadin.ui.ComboBox;
+import com.vaadin.ui.HorizontalLayout;
+
+@Theme("valo")
+public class ComboboxPopupScrolling extends AbstractTestUIWithLog {
+ @Override
+ protected void setup(VaadinRequest request) {
+ ComboBox combobox = new ComboBox("100px wide combobox");
+ combobox.setWidth("100px");
+ combobox.addItem("AMERICAN SAMOA");
+ combobox.addItem("ANTIGUA AND BARBUDA");
+
+ ComboBox combobox2 = new ComboBox("250px wide combobox");
+ combobox2.setWidth("250px");
+ combobox2.addItem("AMERICAN SAMOA");
+ combobox2.addItem("ANTIGUA AND BARBUDA");
+
+ ComboBox combobox3 = new ComboBox("Undefined wide combobox");
+ combobox3.setWidth(null);
+ combobox3.addItem("AMERICAN SAMOA");
+ combobox3.addItem("ANTIGUA AND BARBUDA");
+
+ ComboBox combobox4 = new ComboBox("Another 100px wide combobox");
+ combobox4.setWidth("100px");
+ for (int i = 0; i < 10; i++) {
+ combobox4.addItem("AMERICAN SAMOA " + i);
+ combobox4.addItem("ANTIGUA AND BARBUDA " + i);
+ }
+
+ HorizontalLayout hl = new HorizontalLayout(combobox, combobox2,
+ combobox3, combobox4);
+ addComponent(hl);
+ }
+
+} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboboxPopupScrollingTest.java b/uitest/src/com/vaadin/tests/components/combobox/ComboboxPopupScrollingTest.java
new file mode 100644
index 0000000000..ec5bc088da
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/combobox/ComboboxPopupScrollingTest.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.combobox;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class ComboboxPopupScrollingTest extends MultiBrowserTest {
+
+ @Test
+ public void testNoScrollbarsValo() {
+ testNoScrollbars("valo");
+ }
+
+ @Test
+ public void testNoScrollbarsChameleon() {
+ testNoScrollbars("chameleon");
+ }
+
+ @Test
+ public void testNoScrollbarsRuno() {
+ testNoScrollbars("runo");
+ }
+
+ @Test
+ public void testNoScrollbarsReindeer() {
+ testNoScrollbars("reindeer");
+ }
+
+ private void testNoScrollbars(String theme) {
+ openTestURL("theme=" + theme);
+
+ for (CustomComboBoxElement cb : $(CustomComboBoxElement.class).all()) {
+ String caption = cb.getCaption();
+ cb.openPopup();
+ WebElement popup = cb.getSuggestionPopup();
+ WebElement scrollable = popup.findElement(By
+ .className("v-filterselect-suggestmenu"));
+ assertNoHorizontalScrollbar(scrollable, caption);
+ assertNoVerticalScrollbar(scrollable, caption);
+ }
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/combobox/CustomComboBoxElement.java b/uitest/src/com/vaadin/tests/components/combobox/CustomComboBoxElement.java
new file mode 100644
index 0000000000..697d5eb932
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/combobox/CustomComboBoxElement.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.combobox;
+
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.By;
+import com.vaadin.testbench.elements.ComboBoxElement;
+import com.vaadin.testbench.elementsbase.ServerClass;
+
+@ServerClass("com.vaadin.ui.ComboBox")
+public class CustomComboBoxElement extends ComboBoxElement {
+ private static org.openqa.selenium.By bySuggestionPopup = By
+ .vaadin("#popup");
+
+ public WebElement getSuggestionPopup() {
+ ensurePopupOpen();
+ return findElement(bySuggestionPopup);
+ }
+
+ private void ensurePopupOpen() {
+ if (!isElementPresent(bySuggestionPopup)) {
+ openPopup();
+ }
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/grid/GridDetailsLocationTest.java b/uitest/src/com/vaadin/tests/components/grid/GridDetailsLocationTest.java
index f20cc0f6f4..33f66d35be 100644
--- a/uitest/src/com/vaadin/tests/components/grid/GridDetailsLocationTest.java
+++ b/uitest/src/com/vaadin/tests/components/grid/GridDetailsLocationTest.java
@@ -23,7 +23,6 @@ import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
-import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.Keys;
import org.openqa.selenium.StaleElementReferenceException;
import org.openqa.selenium.WebDriver;
@@ -313,10 +312,6 @@ public class GridDetailsLocationTest extends MultiBrowserTest {
checkBoxElement.click(5, 5);
}
- private Object executeScript(String string, Object... param) {
- return ((JavascriptExecutor) getDriver()).executeScript(string, param);
- }
-
private void scrollAndToggle(int row) {
setRow(row);
getScrollAndToggle().click();
diff --git a/uitest/src/com/vaadin/tests/components/grid/GridWithBrokenRenderer.java b/uitest/src/com/vaadin/tests/components/grid/GridWithBrokenRenderer.java
new file mode 100644
index 0000000000..4d44eeb248
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/grid/GridWithBrokenRenderer.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.grid;
+
+import com.vaadin.server.ClassResource;
+import com.vaadin.server.Resource;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
+import com.vaadin.tests.integration.FlagSeResource;
+import com.vaadin.ui.Grid;
+import com.vaadin.ui.renderers.ImageRenderer;
+
+public class GridWithBrokenRenderer extends AbstractTestUIWithLog {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ final Grid grid = new Grid();
+ grid.addColumn("short", String.class);
+ grid.addColumn("icon", Resource.class);
+ grid.addColumn("country", String.class);
+
+ grid.getColumn("icon").setRenderer(new ImageRenderer());
+ addComponent(grid);
+
+ grid.addRow("FI", new ClassResource("fi.gif"), "Finland");
+ grid.addRow("SE", new FlagSeResource(), "Sweden");
+
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/grid/GridWithBrokenRendererTest.java b/uitest/src/com/vaadin/tests/components/grid/GridWithBrokenRendererTest.java
new file mode 100644
index 0000000000..011c8c92ce
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/grid/GridWithBrokenRendererTest.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.grid;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.vaadin.testbench.elements.GridElement;
+import com.vaadin.tests.tb3.SingleBrowserTest;
+
+public class GridWithBrokenRendererTest extends SingleBrowserTest {
+
+ @Test
+ public void ensureRendered() {
+ openTestURL();
+ GridElement grid = $(GridElement.class).first();
+ assertRow(grid, 0, "FI", "", "Finland");
+ assertRow(grid, 1, "SE", "", "Sweden");
+ }
+
+ private void assertRow(GridElement grid, int row, String... texts) {
+ for (int column = 0; column < texts.length; column++) {
+ Assert.assertEquals("Cell " + row + "," + column, texts[column],
+ grid.getCell(row, column).getText());
+ }
+
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java
index 33a54b1c9a..23226fb6cf 100644
--- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java
+++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java
@@ -792,6 +792,26 @@ public class GridBasicFeatures extends AbstractComponentTest<Grid> {
c.setColumnReorderingAllowed(value);
}
});
+
+ createClickAction("Select all", "State", new Command<Grid, String>() {
+ @Override
+ public void execute(Grid c, String value, Object data) {
+ SelectionModel selectionModel = c.getSelectionModel();
+ if (selectionModel instanceof SelectionModel.Multi) {
+ ((SelectionModel.Multi) selectionModel).selectAll();
+ }
+ }
+ }, null);
+
+ createClickAction("Select none", "State", new Command<Grid, String>() {
+ @Override
+ public void execute(Grid c, String value, Object data) {
+ SelectionModel selectionModel = c.getSelectionModel();
+ if (selectionModel instanceof SelectionModel.Multi) {
+ ((SelectionModel.Multi) selectionModel).deselectAll();
+ }
+ }
+ }, null);
}
protected void createHeaderActions() {
diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorTest.java
index 0a77d690a4..0cba2ce34b 100644
--- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorTest.java
+++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorTest.java
@@ -207,6 +207,8 @@ public abstract class GridEditorTest extends GridBasicFeaturesTest {
assertTrue("Noneditable cell should contain v-grid-cell classname",
classNames.contains("v-grid-cell"));
+
+ assertNoErrorNotifications();
}
@Test
diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSelectionTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSelectionTest.java
index 9953bbcae0..8bf8639d76 100644
--- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSelectionTest.java
+++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSelectionTest.java
@@ -20,8 +20,10 @@ import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.openqa.selenium.Keys;
+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.testbench.elements.GridElement;
@@ -335,6 +337,62 @@ public class GridSelectionTest extends GridBasicFeaturesTest {
getRow(5).isSelected());
}
+ @Test
+ public void testSelectionCheckBoxesHaveStyleNames() {
+ openTestURL();
+
+ setSelectionModelMulti();
+
+ assertTrue(
+ "Selection column CheckBox should have the proper style name set",
+ getGridElement().getCell(0, 0).findElement(By.tagName("span"))
+ .getAttribute("class")
+ .contains("v-grid-selection-checkbox"));
+
+ GridCellElement header = getGridElement().getHeaderCell(0, 0);
+ assertTrue("Select all CheckBox should have the proper style name set",
+ header.findElement(By.tagName("span")).getAttribute("class")
+ .contains("v-grid-select-all-checkbox"));
+ }
+
+ @Test
+ public void testServerSideSelectTogglesSelectAllCheckBox() {
+ openTestURL();
+
+ setSelectionModelMulti();
+ GridCellElement header = getGridElement().getHeaderCell(0, 0);
+
+ WebElement selectAll = header.findElement(By.tagName("input"));
+
+ selectMenuPath("Component", "State", "Select all");
+ waitUntilCheckBoxValue(selectAll, true);
+ assertTrue("Select all CheckBox wasn't selected as expected",
+ selectAll.isSelected());
+
+ selectMenuPath("Component", "State", "Select none");
+ waitUntilCheckBoxValue(selectAll, false);
+ assertFalse("Select all CheckBox was selected unexpectedly",
+ selectAll.isSelected());
+
+ selectMenuPath("Component", "State", "Select all");
+ waitUntilCheckBoxValue(selectAll, true);
+ getGridElement().getCell(5, 0).click();
+ waitUntilCheckBoxValue(selectAll, false);
+ assertFalse("Select all CheckBox was selected unexpectedly",
+ selectAll.isSelected());
+ }
+
+ private void waitUntilCheckBoxValue(final WebElement checkBoxElememnt,
+ final boolean expectedValue) {
+ waitUntil(new ExpectedCondition<Boolean>() {
+ @Override
+ public Boolean apply(WebDriver input) {
+ return expectedValue ? checkBoxElememnt.isSelected()
+ : !checkBoxElememnt.isSelected();
+ }
+ }, 5);
+ }
+
private void setSelectionModelMulti() {
selectMenuPath("Component", "State", "Selection mode", "multi");
}
diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetInSplitPanel.java b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetInSplitPanel.java
new file mode 100644
index 0000000000..b2313020a3
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetInSplitPanel.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.tabsheet;
+
+import com.vaadin.annotations.Theme;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.TabSheet;
+import com.vaadin.ui.UI;
+import com.vaadin.ui.VerticalSplitPanel;
+import com.vaadin.ui.themes.ValoTheme;
+
+@Theme("valo")
+public class TabSheetInSplitPanel extends UI {
+
+ @Override
+ protected void init(VaadinRequest request) {
+ VerticalSplitPanel verticalSplitter = new VerticalSplitPanel();
+ setContent(verticalSplitter);
+ verticalSplitter.setSizeFull();
+ TabSheet t = new TabSheet();
+ t.setHeight("100%");
+ t.addTab(new Label("Hello in tab"), "Hello tab");
+ t.setStyleName(ValoTheme.TABSHEET_FRAMED);
+ verticalSplitter.addComponent(t);
+ verticalSplitter.addComponent(new Label("Hello"));
+
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetInSplitPanelTest.java b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetInSplitPanelTest.java
new file mode 100644
index 0000000000..8070133bde
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetInSplitPanelTest.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.tabsheet;
+
+import java.util.List;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.elements.TabSheetElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class TabSheetInSplitPanelTest extends MultiBrowserTest {
+
+ @Test
+ public void ensureNoScrollbars() {
+ openTestURL();
+ TabSheetElement ts = $(TabSheetElement.class).first();
+ List<WebElement> scrollables = ts.findElements(By
+ .xpath("//*[contains(@class,'v-scrollable')]"));
+ for (WebElement scrollable : scrollables) {
+ assertNoHorizontalScrollbar(scrollable,
+ "Element should not have a horizontal scrollbar");
+ assertNoVerticalScrollbar(scrollable,
+ "Element should not have a vertical scrollbar");
+ }
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTableScrollOnExpand.java b/uitest/src/com/vaadin/tests/components/treetable/TreeTableScrollOnExpand.java
new file mode 100644
index 0000000000..07cf7f8c2e
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/treetable/TreeTableScrollOnExpand.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.treetable;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.TreeTable;
+
+public class TreeTableScrollOnExpand extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ TreeTable t = new TreeTable();
+ t.setSelectable(true);
+ t.setImmediate(true);
+ t.setSizeFull();
+ t.addContainerProperty("Name", String.class, "null");
+ for (int i = 1; i <= 100; i++) {
+ String parentID = "Item " + i;
+ Object parent = t.addItem(new Object[] { parentID }, parentID);
+ String childID = "Item " + (100 + i);
+ Object child = t.addItem(new Object[] { childID }, childID);
+ t.getContainerDataSource().setParent(childID, parentID);
+ }
+ addComponent(t);
+ }
+
+ @Override
+ public Integer getTicketNumber() {
+ return 18247;
+ }
+
+ @Override
+ public String getTestDescription() {
+ return "After selecting an item and scrolling it out of view, TreeTable should not scroll to the "
+ + "selected item when expanding an item.";
+ }
+} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTableScrollOnExpandTest.java b/uitest/src/com/vaadin/tests/components/treetable/TreeTableScrollOnExpandTest.java
new file mode 100644
index 0000000000..a17559cc81
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/treetable/TreeTableScrollOnExpandTest.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.treetable;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.elements.TreeTableElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class TreeTableScrollOnExpandTest extends MultiBrowserTest {
+
+ @Test
+ public void testScrollOnExpand() throws InterruptedException, IOException {
+ openTestURL();
+ TreeTableElement tt = $(TreeTableElement.class).first();
+ tt.getRow(0).click();
+ tt.scroll(300);
+ sleep(1000);
+ tt.getRow(20).toggleExpanded();
+ // Need to wait a bit to avoid accepting the case where the TreeTable is
+ // in the desired state only for a short while.
+ sleep(1000);
+ WebElement focusedRow = getDriver().findElement(
+ By.className("v-table-focus"));
+ assertEquals("Item 21", focusedRow.getText());
+ }
+} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/components/window/GridInWindow.java b/uitest/src/com/vaadin/tests/components/window/GridInWindow.java
new file mode 100644
index 0000000000..918a991cc1
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/window/GridInWindow.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.window;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Grid;
+import com.vaadin.ui.Window;
+
+public class GridInWindow extends AbstractTestUIWithLog {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ final Grid grid = new Grid();
+
+ grid.addColumn("Hidable column").setHidable(true);
+ grid.addRow("Close and reopen and it vanishes");
+
+ Button popupButton = new Button("Open PopUp",
+ new Button.ClickListener() {
+ @Override
+ public void buttonClick(Button.ClickEvent event) {
+ Window subWindow = new Window("Sub-window");
+ subWindow.setContent(grid);
+ subWindow.setWidth(600, Unit.PIXELS);
+ subWindow.setWidth(400, Unit.PIXELS);
+ getUI().addWindow(subWindow);
+ }
+ });
+
+ addComponent(popupButton);
+
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/window/GridInWindowTest.java b/uitest/src/com/vaadin/tests/components/window/GridInWindowTest.java
new file mode 100644
index 0000000000..301a7c60e4
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/window/GridInWindowTest.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.window;
+
+import org.junit.Test;
+
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.tests.tb3.SingleBrowserTest;
+import com.vaadin.tests.tb3.newelements.WindowElement;
+
+public class GridInWindowTest extends SingleBrowserTest {
+
+ @Test
+ public void ensureAttachInHierachyChange() {
+ openTestURL("debug");
+ $(ButtonElement.class).first().click();
+ assertNoErrorNotifications();
+ $(WindowElement.class).first().close();
+ assertNoErrorNotifications();
+ $(ButtonElement.class).first().click();
+ assertNoErrorNotifications();
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/window/OpenModalWindowAndFocusField.java b/uitest/src/com/vaadin/tests/components/window/OpenModalWindowAndFocusField.java
new file mode 100644
index 0000000000..1c82a3de02
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/window/OpenModalWindowAndFocusField.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.window;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.TextArea;
+import com.vaadin.ui.Window;
+
+public class OpenModalWindowAndFocusField extends AbstractTestUIWithLog {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ Button button = new Button("Open modal and focus textarea");
+ button.setId("openFocus");
+ button.addClickListener(new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ open(true);
+ }
+ });
+ addComponent(button);
+
+ button = new Button("Only open modal");
+ button.setId("open");
+ button.addClickListener(new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ open(false);
+ }
+
+ });
+ addComponent(button);
+
+ }
+
+ private void open(boolean focus) {
+ Window wind = new Window();
+ wind.setModal(true);
+ TextArea ta = new TextArea();
+ wind.setContent(ta);
+ addWindow(wind);
+ if (focus) {
+ ta.focus();
+ }
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/window/OpenModalWindowAndFocusFieldTest.java b/uitest/src/com/vaadin/tests/components/window/OpenModalWindowAndFocusFieldTest.java
new file mode 100644
index 0000000000..5dba1c3285
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/window/OpenModalWindowAndFocusFieldTest.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.window;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.TextAreaElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class OpenModalWindowAndFocusFieldTest extends MultiBrowserTest {
+
+ @Test
+ public void openModalAndFocusField() {
+ openTestURL();
+ $(ButtonElement.class).id("openFocus").click();
+ TextAreaElement textArea = $(TextAreaElement.class).first();
+
+ assertElementsEquals(textArea, getActiveElement());
+ }
+
+ @Test
+ public void openModal() {
+ openTestURL();
+ $(ButtonElement.class).id("open").click();
+ // WindowElement window = $(WindowElement.class).first();
+ WebElement windowFocusElement = findElement(By
+ .xpath("//div[@class='v-window-contents']/div[@class='v-scrollable']"));
+
+ assertElementsEquals(windowFocusElement, getActiveElement());
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/push/ManualLongPollingPushUI.java b/uitest/src/com/vaadin/tests/push/ManualLongPollingPushUI.java
new file mode 100644
index 0000000000..190f6daa24
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/push/ManualLongPollingPushUI.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.push;
+
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import com.vaadin.annotations.Push;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.shared.communication.PushMode;
+import com.vaadin.shared.ui.ui.Transport;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+
+@Push(value = PushMode.MANUAL, transport = Transport.LONG_POLLING)
+public class ManualLongPollingPushUI extends AbstractTestUIWithLog {
+
+ ExecutorService executor = Executors.newFixedThreadPool(1);
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ Button b = new Button("Manual push after 1s",
+ new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ executor.submit(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ access(new Runnable() {
+
+ @Override
+ public void run() {
+ log("Logged after 1s, followed by manual push");
+ push();
+ }
+ });
+
+ }
+ });
+ }
+ });
+ addComponent(b);
+
+ b = new Button("Double manual push after 1s",
+ new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ executor.submit(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ access(new Runnable() {
+
+ @Override
+ public void run() {
+ log("First message logged after 1s, followed by manual push");
+ push();
+ log("Second message logged after 1s, followed by manual push");
+ push();
+ }
+ });
+
+ }
+ });
+ }
+ });
+ addComponent(b);
+
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/push/ManualLongPollingPushUITest.java b/uitest/src/com/vaadin/tests/push/ManualLongPollingPushUITest.java
new file mode 100644
index 0000000000..096204ff75
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/push/ManualLongPollingPushUITest.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+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.elements.ButtonElement;
+import com.vaadin.tests.tb3.SingleBrowserTest;
+
+public class ManualLongPollingPushUITest extends SingleBrowserTest {
+
+ @Test
+ public void doubleManualPushDoesNotFreezeApplication() {
+ openTestURL();
+ $(ButtonElement.class).caption("Double manual push after 1s").first()
+ .click();
+ waitUntilLogText("2. Second message logged after 1s, followed by manual push");
+ $(ButtonElement.class).caption("Manual push after 1s").first().click();
+ waitUntilLogText("3. Logged after 1s, followed by manual push");
+ }
+
+ private void waitUntilLogText(final String expected) {
+ waitUntil(new ExpectedCondition<Boolean>() {
+ private String actual;
+
+ @Override
+ public Boolean apply(WebDriver arg0) {
+ actual = getLogRow(0);
+ return expected.equals(actual);
+ }
+
+ @Override
+ public String toString() {
+ return String.format("log text to become '%s' (was: '%s')",
+ expected, actual);
+ }
+ });
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/resources/SpecialCharsInThemeResources.java b/uitest/src/com/vaadin/tests/resources/SpecialCharsInThemeResources.java
new file mode 100644
index 0000000000..e584ec73cc
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/resources/SpecialCharsInThemeResources.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.resources;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.vaadin.tests.tb3.SingleBrowserTest;
+
+public class SpecialCharsInThemeResources extends SingleBrowserTest {
+
+ @Test
+ public void loadThemeResource() {
+ loadResource("/VAADIN/themes/tests-tickets/ordinary.txt");
+ checkSource();
+ }
+
+ @Test
+ public void loadThemeResourceWithPercentage() {
+ loadResource("/VAADIN/themes/tests-tickets/percentagein%2520name.txt");
+ checkSource();
+ }
+
+ @Test
+ public void loadThemeResourceWithSpecialChars() {
+ loadResource("/VAADIN/themes/tests-tickets/folder%20with%20space/resource%20with%20special%20$chars@.txt");
+ checkSource();
+ }
+
+ private void loadResource(String path) {
+ getDriver().get(getBaseURL() + path);
+ }
+
+ private void checkSource() {
+ String source = getDriver().getPageSource();
+ Assert.assertTrue("Incorrect contents (was: " + source + ")",
+ source.contains("Just ordinary contents here"));
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
index 842fcbb859..2e3854cb2b 100644
--- a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
+++ b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java
@@ -50,6 +50,7 @@ import org.openqa.selenium.interactions.Keyboard;
import org.openqa.selenium.interactions.Mouse;
import org.openqa.selenium.interactions.internal.Coordinates;
import org.openqa.selenium.internal.Locatable;
+import org.openqa.selenium.internal.WrapsElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.HttpCommandExecutor;
import org.openqa.selenium.remote.RemoteWebDriver;
@@ -368,8 +369,8 @@ public abstract class AbstractTB3Test extends ParallelTest {
* {@link org.openqa.selenium.JavascriptExecutor#executeScript(String, Object...)}
* returns
*/
- protected Object executeScript(String script) {
- return ((JavascriptExecutor) getDriver()).executeScript(script);
+ protected Object executeScript(String script, Object... args) {
+ return ((JavascriptExecutor) getDriver()).executeScript(script, args);
}
/**
@@ -1105,4 +1106,93 @@ public abstract class AbstractTB3Test extends ParallelTest {
return isElementPresent(By.className("v-debugwindow"));
}
+ protected void assertNoHorizontalScrollbar(WebElement element,
+ String errorMessage) {
+ // IE rounds clientWidth/clientHeight down and scrollHeight/scrollWidth
+ // up, so using clientWidth/clientHeight will fail if the element height
+ // is not an integer
+ int clientWidth = getClientWidth(element);
+ int scrollWidth = getScrollWidth(element);
+ boolean hasScrollbar = scrollWidth > clientWidth;
+
+ Assert.assertFalse(
+ "The element should not have a horizontal scrollbar (scrollWidth: "
+ + scrollWidth + ", clientWidth: " + clientWidth + "): "
+ + errorMessage, hasScrollbar);
+ }
+
+ protected void assertNoVerticalScrollbar(WebElement element,
+ String errorMessage) {
+ // IE rounds clientWidth/clientHeight down and scrollHeight/scrollWidth
+ // up, so using clientWidth/clientHeight will fail if the element height
+ // is not an integer
+ int clientHeight = getClientHeight(element);
+ int scrollHeight = getScrollHeight(element);
+ boolean hasScrollbar = scrollHeight > clientHeight;
+
+ Assert.assertFalse(
+ "The element should not have a vertical scrollbar (scrollHeight: "
+ + scrollHeight + ", clientHeight: " + clientHeight
+ + "): " + errorMessage, hasScrollbar);
+ }
+
+ protected int getScrollHeight(WebElement element) {
+ return ((Number) executeScript("return arguments[0].scrollHeight;",
+ element)).intValue();
+ }
+
+ protected int getScrollWidth(WebElement element) {
+ return ((Number) executeScript("return arguments[0].scrollWidth;",
+ element)).intValue();
+ }
+
+ /**
+ * Returns client height rounded up instead of as double because of IE9
+ * issues: https://dev.vaadin.com/ticket/18469
+ */
+ protected int getClientHeight(WebElement e) {
+ String script;
+ if (BrowserUtil.isIE8(getDesiredCapabilities())) {
+ script = "return arguments[0].clientHeight;"; //
+ } else {
+ script = "var cs = window.getComputedStyle(arguments[0]);"
+ + "return Math.ceil(parseFloat(cs.height)+parseFloat(cs.paddingTop)+parseFloat(cs.paddingBottom));";
+ }
+ return ((Number) executeScript(script, e)).intValue();
+ }
+
+ /**
+ * Returns client width rounded up instead of as double because of IE9
+ * issues: https://dev.vaadin.com/ticket/18469
+ */
+ protected int getClientWidth(WebElement e) {
+ String script;
+ if (BrowserUtil.isIE8(getDesiredCapabilities())) {
+ script = "return arguments[0].clientWidth;";
+ } else {
+ script = "var cs = window.getComputedStyle(arguments[0]);"
+ + "var h = parseFloat(cs.width)+parseFloat(cs.paddingLeft)+parseFloat(cs.paddingRight);"
+ + "return Math.ceil(h);";
+ }
+
+ return ((Number) executeScript(script, e)).intValue();
+ }
+
+ protected void assertElementsEquals(WebElement expectedElement,
+ WebElement actualElement) {
+ while (expectedElement instanceof WrapsElement) {
+ expectedElement = ((WrapsElement) expectedElement)
+ .getWrappedElement();
+ }
+ while (actualElement instanceof WrapsElement) {
+ actualElement = ((WrapsElement) actualElement).getWrappedElement();
+ }
+
+ Assert.assertEquals(expectedElement, actualElement);
+ }
+
+ protected WebElement getActiveElement() {
+ return (WebElement) executeScript("return document.activeElement;");
+
+ }
}
diff --git a/uitest/src/com/vaadin/tests/tb3/newelements/WindowElement.java b/uitest/src/com/vaadin/tests/tb3/newelements/WindowElement.java
index 34344324d0..784d203ab0 100644
--- a/uitest/src/com/vaadin/tests/tb3/newelements/WindowElement.java
+++ b/uitest/src/com/vaadin/tests/tb3/newelements/WindowElement.java
@@ -14,6 +14,7 @@ public class WindowElement extends com.vaadin.testbench.elements.WindowElement {
private final String restoreBoxClass = "v-window-restorebox";
private final String maximizeBoxClass = "v-window-maximizebox";
+ private final String closeBoxClass = "v-window-closebox";
public void restore() {
if (isMaximized()) {
@@ -63,4 +64,13 @@ public class WindowElement extends com.vaadin.testbench.elements.WindowElement {
public String getCaption() {
return findElement(By.className("v-window-header")).getText();
}
+
+ private WebElement getCloseButton() {
+ return findElement(By.className(closeBoxClass));
+ }
+
+ public void close() {
+ getCloseButton().click();
+
+ }
}