aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/components/grid
diff options
context:
space:
mode:
authorJohannes Dahlström <johannesd@vaadin.com>2015-07-15 12:59:35 +0300
committerJohannes Dahlström <johannesd@vaadin.com>2015-07-15 12:59:35 +0300
commit20f6053dc199d5dd7dde071dfdd9b37ea8f85e36 (patch)
treecef44905e38c849057f102cd26cd6b89251bc7e2 /uitest/src/com/vaadin/tests/components/grid
parent80058d9429940c376c63c086b1cf79848fe1a699 (diff)
parent9734bc5dfa5d919e3214dc17581d3da3ad1a3ebd (diff)
downloadvaadin-framework-20f6053dc199d5dd7dde071dfdd9b37ea8f85e36.tar.gz
vaadin-framework-20f6053dc199d5dd7dde071dfdd9b37ea8f85e36.zip
Merge branch 'master' into grid-unbuffered-editor7.6.0.alpha3
Conflicts: uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorTest.java Change-Id: I5ed68bc73d38be4e1f6816108a5246d0c98a258f
Diffstat (limited to 'uitest/src/com/vaadin/tests/components/grid')
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/GridEditorFrozenColumnsUI.java43
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/GridEditorFrozenColumnsUITest.java78
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/GridEditorUI.java6
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/GridEditorUITest.java2
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/GridScrollToLineWhileResizing.java73
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/GridScrollToLineWhileResizingTest.java49
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/basicfeatures/client/GridEditorClientTest.java6
-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/GridSidebarThemeTest.java12
9 files changed, 260 insertions, 11 deletions
diff --git a/uitest/src/com/vaadin/tests/components/grid/GridEditorFrozenColumnsUI.java b/uitest/src/com/vaadin/tests/components/grid/GridEditorFrozenColumnsUI.java
new file mode 100644
index 0000000000..d2414a8c40
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/grid/GridEditorFrozenColumnsUI.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.tests.util.PersonContainer;
+import com.vaadin.ui.Grid;
+
+public class GridEditorFrozenColumnsUI extends GridEditorUI {
+
+ @Override
+ protected Grid createGrid(PersonContainer container) {
+ Grid grid = super.createGrid(container);
+
+ grid.setFrozenColumnCount(2);
+
+ grid.setWidth("600px");
+
+ return grid;
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 16727;
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Frozen columns should also freeze cells in editor.";
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/grid/GridEditorFrozenColumnsUITest.java b/uitest/src/com/vaadin/tests/components/grid/GridEditorFrozenColumnsUITest.java
new file mode 100644
index 0000000000..75d71a3c40
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/grid/GridEditorFrozenColumnsUITest.java
@@ -0,0 +1,78 @@
+/*
+ * 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 java.io.IOException;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.JavascriptExecutor;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
+
+import com.vaadin.testbench.elements.GridElement;
+import com.vaadin.testbench.elements.GridElement.GridCellElement;
+import com.vaadin.testbench.parallel.TestCategory;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+@TestCategory("grid")
+public class GridEditorFrozenColumnsUITest extends MultiBrowserTest {
+
+ @Test
+ public void testEditorWithFrozenColumns() throws IOException {
+ openTestURL();
+
+ openEditor(10);
+
+ compareScreen("noscroll");
+
+ scrollGridHorizontallyTo(100);
+
+ compareScreen("scrolled");
+ }
+
+ private void openEditor(int rowIndex) {
+ GridElement grid = $(GridElement.class).first();
+
+ GridCellElement cell = grid.getCell(rowIndex, 1);
+
+ new Actions(driver).moveToElement(cell).doubleClick().build().perform();
+ }
+
+ private void scrollGridHorizontallyTo(double px) {
+ executeScript("arguments[0].scrollLeft = " + px,
+ getGridHorizontalScrollbar());
+ }
+
+ private Object executeScript(String script, WebElement element) {
+ final WebDriver driver = getDriver();
+ if (driver instanceof JavascriptExecutor) {
+ final JavascriptExecutor je = (JavascriptExecutor) driver;
+ return je.executeScript(script, element);
+ } else {
+ throw new IllegalStateException("current driver "
+ + getDriver().getClass().getName() + " is not a "
+ + JavascriptExecutor.class.getSimpleName());
+ }
+ }
+
+ private WebElement getGridHorizontalScrollbar() {
+ return getDriver()
+ .findElement(
+ By.xpath("//div[contains(@class, \"v-grid-scroller-horizontal\")]"));
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/grid/GridEditorUI.java b/uitest/src/com/vaadin/tests/components/grid/GridEditorUI.java
index 60e241bae3..0a302967e8 100644
--- a/uitest/src/com/vaadin/tests/components/grid/GridEditorUI.java
+++ b/uitest/src/com/vaadin/tests/components/grid/GridEditorUI.java
@@ -28,6 +28,10 @@ public class GridEditorUI extends AbstractTestUI {
protected void setup(VaadinRequest request) {
PersonContainer container = PersonContainer.createWithTestData();
+ addComponent(createGrid(container));
+ }
+
+ protected Grid createGrid(PersonContainer container) {
Grid grid = new Grid(container);
// Don't use address since there's no converter
@@ -43,7 +47,7 @@ public class GridEditorUI extends AbstractTestUI {
grid.getColumn("phoneNumber").getEditorField().setReadOnly(true);
- addComponent(grid);
+ return grid;
}
}
diff --git a/uitest/src/com/vaadin/tests/components/grid/GridEditorUITest.java b/uitest/src/com/vaadin/tests/components/grid/GridEditorUITest.java
index 47dc90e33a..3d0b3bb071 100644
--- a/uitest/src/com/vaadin/tests/components/grid/GridEditorUITest.java
+++ b/uitest/src/com/vaadin/tests/components/grid/GridEditorUITest.java
@@ -45,7 +45,7 @@ public class GridEditorUITest extends MultiBrowserTest {
openEditor(10);
- assertTrue("Edtor should be opened with a password field",
+ assertTrue("Editor should be opened with a password field",
isElementPresent(PasswordFieldElement.class));
assertFalse("Notification was present",
diff --git a/uitest/src/com/vaadin/tests/components/grid/GridScrollToLineWhileResizing.java b/uitest/src/com/vaadin/tests/components/grid/GridScrollToLineWhileResizing.java
new file mode 100644
index 0000000000..194a9a3acc
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/grid/GridScrollToLineWhileResizing.java
@@ -0,0 +1,73 @@
+/*
+ * 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.data.Item;
+import com.vaadin.data.util.IndexedContainer;
+import com.vaadin.event.SelectionEvent;
+import com.vaadin.event.SelectionEvent.SelectionListener;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Grid;
+import com.vaadin.ui.Grid.SelectionMode;
+import com.vaadin.ui.VerticalSplitPanel;
+
+public class GridScrollToLineWhileResizing extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+
+ final VerticalSplitPanel vsp = new VerticalSplitPanel();
+ vsp.setWidth(500, Unit.PIXELS);
+ vsp.setHeight(500, Unit.PIXELS);
+ vsp.setSplitPosition(100, Unit.PERCENTAGE);
+ addComponent(vsp);
+
+ IndexedContainer indexedContainer = new IndexedContainer();
+ indexedContainer.addContainerProperty("column1", String.class, "");
+
+ for (int i = 0; i < 100; i++) {
+ Item addItem = indexedContainer.addItem(i);
+ addItem.getItemProperty("column1").setValue("cell" + i);
+ }
+
+ final Grid grid = new Grid(indexedContainer);
+ grid.setSizeFull();
+
+ grid.setSelectionMode(SelectionMode.SINGLE);
+ grid.addSelectionListener(new SelectionListener() {
+
+ @Override
+ public void select(SelectionEvent event) {
+ vsp.setSplitPosition(50, Unit.PERCENTAGE);
+ grid.scrollTo(event.getSelected().iterator().next());
+ }
+ });
+
+ vsp.setFirstComponent(grid);
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Tests scrollToLine while moving SplitPanel split position to resize the Grid on the same round-trip.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return null;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/grid/GridScrollToLineWhileResizingTest.java b/uitest/src/com/vaadin/tests/components/grid/GridScrollToLineWhileResizingTest.java
new file mode 100644
index 0000000000..aee1db7a85
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/grid/GridScrollToLineWhileResizingTest.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.grid;
+
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.elements.GridElement;
+import com.vaadin.testbench.parallel.TestCategory;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+@TestCategory("grid")
+public class GridScrollToLineWhileResizingTest extends MultiBrowserTest {
+
+ @Test
+ public void testScrollToLineWorksWhileMovingSplitProgrammatically() {
+ openTestURL();
+
+ $(GridElement.class).first().getCell(21, 0).click();
+
+ List<WebElement> cells = findElements(By.className("v-grid-cell"));
+ boolean foundCell21 = false;
+ for (WebElement cell : cells) {
+ if ("cell21".equals(cell.getText())) {
+ foundCell21 = true;
+ }
+ }
+
+ assertTrue(foundCell21);
+ }
+} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/client/GridEditorClientTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/client/GridEditorClientTest.java
index f437589a39..43fe29bc02 100644
--- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/client/GridEditorClientTest.java
+++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/client/GridEditorClientTest.java
@@ -134,10 +134,12 @@ public class GridEditorClientTest extends GridBasicClientFeaturesTest {
@Test
public void testWithSelectionColumn() throws Exception {
selectMenuPath("Component", "State", "Selection mode", "multi");
+ selectMenuPath("Component", "State", "Frozen column count",
+ "-1 columns");
selectMenuPath(EDIT_ROW_5);
- WebElement editorCells = findElement(By
- .className("v-grid-editor-cells"));
+ WebElement editorCells = findElements(
+ By.className("v-grid-editor-cells")).get(1);
List<WebElement> selectorDivs = editorCells.findElements(By
.cssSelector("div"));
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 e7eb78c35e..f7592ce922 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
@@ -200,7 +200,7 @@ public abstract class GridEditorTest extends GridBasicFeaturesTest {
assertEquals(
"Not editable cell did not contain correct classname",
"not-editable",
- editor.findElement(By.className("v-grid-editor-cells"))
+ editor.findElements(By.className("v-grid-editor-cells")).get(1)
.findElements(By.xpath("./div")).get(3)
.getAttribute("class"));
diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSidebarThemeTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSidebarThemeTest.java
index 0e5dd32989..238b470feb 100644
--- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSidebarThemeTest.java
+++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridSidebarThemeTest.java
@@ -45,15 +45,15 @@ public class GridSidebarThemeTest extends GridBasicFeaturesTest {
private void runTestSequence(String theme) throws IOException {
openTestURL("theme=" + theme);
- compareScreen(theme + "_SidebarClosed");
+ compareScreen(theme + "-SidebarClosed");
getSidebarOpenButton().click();
- compareScreen(theme + "_SidebarOpen");
+ compareScreen(theme + "-SidebarOpen");
new Actions(getDriver()).moveToElement(getColumnHidingToggle(2), 5, 5)
.perform();
- compareScreen(theme + "_OnMouseOverNotHiddenToggle");
+ compareScreen(theme + "-OnMouseOverNotHiddenToggle");
getColumnHidingToggle(2).click();
getColumnHidingToggle(3).click();
@@ -63,17 +63,17 @@ public class GridSidebarThemeTest extends GridBasicFeaturesTest {
.perform();
;
- compareScreen(theme + "_TogglesTriggered");
+ compareScreen(theme + "-TogglesTriggered");
new Actions(getDriver()).moveToElement(getColumnHidingToggle(2))
.perform();
;
- compareScreen(theme + "_OnMouseOverHiddenToggle");
+ compareScreen(theme + "-OnMouseOverHiddenToggle");
getSidebarOpenButton().click();
- compareScreen(theme + "_SidebarClosed2");
+ compareScreen(theme + "-SidebarClosed2");
}
@Override