diff options
author | Juho Nurminen <juho@vaadin.com> | 2014-06-10 15:15:30 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2014-06-30 10:16:51 +0000 |
commit | 1ebf4a4576ed6037fb306935f441089f7aac985e (patch) | |
tree | 41bfa7ed26122828565eb854abb0bbf267f77b1c /uitest/src/com | |
parent | 9ceac5b2a8e9541c012b90f72d5f222ec508556e (diff) | |
download | vaadin-framework-1ebf4a4576ed6037fb306935f441089f7aac985e.tar.gz vaadin-framework-1ebf4a4576ed6037fb306935f441089f7aac985e.zip |
Add a missing check for user-initiated column resizing in VScrollTable (#13432)
Change-Id: Ie70214898cca5bfd2e5a5b0e287427fd9acb8ce3
Diffstat (limited to 'uitest/src/com')
-rw-r--r-- | uitest/src/com/vaadin/tests/components/table/TableWithPollingTest.java | 58 |
1 files changed, 44 insertions, 14 deletions
diff --git a/uitest/src/com/vaadin/tests/components/table/TableWithPollingTest.java b/uitest/src/com/vaadin/tests/components/table/TableWithPollingTest.java index 6aae1e27fc..3e12333a6d 100644 --- a/uitest/src/com/vaadin/tests/components/table/TableWithPollingTest.java +++ b/uitest/src/com/vaadin/tests/components/table/TableWithPollingTest.java @@ -24,6 +24,7 @@ import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.remote.DesiredCapabilities; +import com.vaadin.testbench.elements.TableElement; import com.vaadin.tests.tb3.MultiBrowserTest; public class TableWithPollingTest extends MultiBrowserTest { @@ -32,25 +33,54 @@ public class TableWithPollingTest extends MultiBrowserTest { public void testColumnResizing() throws Exception { openTestURL(); - WebElement headerCell = driver.findElement(By - .xpath("(//td[contains(@class, 'v-table-header-cell')])[1]")); - WebElement bodyCell = driver.findElement(By - .xpath("(//td[contains(@class, 'v-table-cell-content')])[1]")); - WebElement resizer = driver.findElement(By - .xpath("(//div[contains(@class, 'v-table-resizer')])[1]")); + int offset = -20; + int headerCellWidth = getHeaderCell(0).getSize().width; + int bodyCellWidth = getBodyCell(0).getSize().width; - final int offset = 50; - final int headerCellWidth = headerCell.getSize().width; - final int bodyCellWidth = bodyCell.getSize().width; + resizeColumn(0, offset); - new Actions(driver).clickAndHold(resizer).moveByOffset(offset, 0) - .perform(); + assertHeaderCellWidth(0, headerCellWidth + offset); + assertBodyCellWidth(0, bodyCellWidth + offset); + + offset = 50; + headerCellWidth = getHeaderCell(1).getSize().width; + bodyCellWidth = getBodyCell(1).getSize().width; + + resizeColumn(1, offset); + + assertHeaderCellWidth(1, headerCellWidth + offset); + assertBodyCellWidth(1, bodyCellWidth + offset); + + } + + private WebElement getHeaderCell(int column) { + return $(TableElement.class).get(0).getHeaderCell(column); + } + + private WebElement getBodyCell(int column) { + return $(TableElement.class).get(0).getCell(0, column); + } + + private WebElement getColumnResizer(int column) { + return getHeaderCell(column).findElement( + By.className("v-table-resizer")); + } + + private void resizeColumn(int column, int by) throws InterruptedException { + new Actions(driver).clickAndHold(getColumnResizer(column)) + .moveByOffset(by, 0).perform(); sleep(2000); new Actions(driver).release().perform(); + } + + private void assertHeaderCellWidth(int column, int width) + throws AssertionError { + Assert.assertEquals(width, getHeaderCell(column).getSize().width); + } - Assert.assertEquals(headerCellWidth + offset, - headerCell.getSize().width); - Assert.assertEquals(bodyCellWidth + offset, bodyCell.getSize().width); + private void assertBodyCellWidth(int column, int width) + throws AssertionError { + Assert.assertEquals(width, getBodyCell(column).getSize().width); } @Override |