aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java
diff options
context:
space:
mode:
authorPekka Hyvönen <pekka@vaadin.com>2015-03-30 14:15:52 +0300
committerPekka Hyvönen <pekka@vaadin.com>2015-03-31 07:34:34 +0000
commit3eb8110f13d51a859d40da9dfcb9ae2edb890f8c (patch)
tree35f2a1e7de61ea386a25ee51a37be8d98e207544 /uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java
parenteeb5e8c89df6e043d20c4e0ac6b094334970b2b4 (diff)
downloadvaadin-framework-3eb8110f13d51a859d40da9dfcb9ae2edb890f8c.tar.gz
vaadin-framework-3eb8110f13d51a859d40da9dfcb9ae2edb890f8c.zip
Refactored fragile column reorder tests for Grid
Change-Id: I72fd2b09269d5dfc689d8b1f213f46989adf8bfe
Diffstat (limited to 'uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java')
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java43
1 files changed, 37 insertions, 6 deletions
diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java
index 7fae3bf8cf..ca8ea9fd75 100644
--- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java
+++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java
@@ -36,6 +36,10 @@ import com.vaadin.tests.tb3.MultiBrowserTest;
@TestCategory("grid")
public abstract class GridBasicFeaturesTest extends MultiBrowserTest {
+ public enum CellSide {
+ LEFT, RIGHT;
+ }
+
@Override
protected boolean requireWindowFocusForIE() {
return true;
@@ -172,25 +176,52 @@ public abstract class GridBasicFeaturesTest extends MultiBrowserTest {
}
protected void dragAndDropDefaultColumnHeader(int draggedColumnHeaderIndex,
- int onTopOfColumnHeaderIndex, int xOffsetFromColumnTopLeftCorner) {
+ int onTopOfColumnHeaderIndex, CellSide cellSide) {
+ GridCellElement columnHeader = getDefaultColumnHeader(onTopOfColumnHeaderIndex);
new Actions(getDriver())
.clickAndHold(getDefaultColumnHeader(draggedColumnHeaderIndex))
.moveToElement(
- getDefaultColumnHeader(onTopOfColumnHeaderIndex),
- xOffsetFromColumnTopLeftCorner, 0).release().perform();
+ columnHeader,
+ getHorizontalOffsetForDragAndDrop(columnHeader,
+ cellSide), 0).release().perform();
+ }
+
+ private int getHorizontalOffsetForDragAndDrop(GridCellElement columnHeader,
+ CellSide cellSide) {
+ if (cellSide == CellSide.LEFT) {
+ return 5;
+ } else {
+ int half = columnHeader.getSize().getWidth() / 2;
+ return half + (half / 2);
+ }
}
protected void dragAndDropColumnHeader(int headerRow,
int draggedColumnHeaderIndex, int onTopOfColumnHeaderIndex,
- int xOffsetFromColumnTopLeftCorner) {
+ CellSide cellSide) {
+ GridCellElement headerCell = getGridElement().getHeaderCell(headerRow,
+ onTopOfColumnHeaderIndex);
new Actions(getDriver())
.clickAndHold(
getGridElement().getHeaderCell(headerRow,
draggedColumnHeaderIndex))
.moveToElement(
+ headerCell,
+ getHorizontalOffsetForDragAndDrop(headerCell, cellSide),
+ 0).release().perform();
+ }
+
+ protected void dragAndDropColumnHeader(int headerRow,
+ int draggedColumnHeaderIndex, int onTopOfColumnHeaderIndex,
+ int horizontalOffset) {
+ GridCellElement headerCell = getGridElement().getHeaderCell(headerRow,
+ onTopOfColumnHeaderIndex);
+ new Actions(getDriver())
+ .clickAndHold(
getGridElement().getHeaderCell(headerRow,
- onTopOfColumnHeaderIndex),
- xOffsetFromColumnTopLeftCorner, 0).release().perform();
+ draggedColumnHeaderIndex))
+ .moveToElement(headerCell, horizontalOffset, 0).release()
+ .perform();
}
protected void assertColumnIsSorted(int index) {