]> source.dussan.org Git - vaadin-framework.git/commitdiff
Made grid testbench tests more stable on all browsers
authorJohn Ahlroos <john@vaadin.com>
Fri, 25 Apr 2014 11:24:56 +0000 (14:24 +0300)
committerVaadin Code Review <review@vaadin.com>
Tue, 29 Apr 2014 10:03:23 +0000 (10:03 +0000)
Testbench reports different things for the css width depending on
the browser so changed the tests to use the WebElement.Size property
instead to get consistant results.

Also removed the data change test as in its current state it does
not serve any purpose. A similar test could be added at some point
when we actually can test this. The test had never succeeded.

Change-Id: I8d762b1c662afb5e9b09d384b8100200fbfaba33

uitest/src/com/vaadin/tests/components/grid/GridBasicFeaturesTest.java

index b260cdd3a1d1d7ad3429dae10f6b9d18c1157f1d..7163fbea75ed92ef2a18ad80454c1cbb894ad5cd 100644 (file)
@@ -184,58 +184,43 @@ public class GridBasicFeaturesTest extends MultiBrowserTest {
     public void testInitialColumnWidths() throws Exception {
         openTestURL();
 
-        // Default borders and margins implemented by escalator
-        int cellBorder = 1 + 1;
-        int cellMargin = 2 + 2;
-
         WebElement cell = getBodyCellByRowAndColumn(1, 1);
-        assertEquals((100 - cellBorder - cellMargin) + "px",
-                cell.getCssValue("width"));
+        assertEquals(100, cell.getSize().getWidth());
 
         cell = getBodyCellByRowAndColumn(1, 2);
-        assertEquals((150 - cellBorder - cellMargin) + "px",
-                cell.getCssValue("width"));
+        assertEquals(150, cell.getSize().getWidth());
 
         cell = getBodyCellByRowAndColumn(1, 3);
-        assertEquals((200 - cellBorder - cellMargin) + "px",
-                cell.getCssValue("width"));
+        assertEquals(200, cell.getSize().getWidth());
     }
 
     @Test
     public void testColumnWidths() throws Exception {
         openTestURL();
 
-        // Default borders and margins implemented by escalator
-        int cellBorder = 1 + 1;
-        int cellMargin = 2 + 2;
-
         // Default column width is 100px
         WebElement cell = getBodyCellByRowAndColumn(1, 1);
-        assertEquals((100 - cellBorder - cellMargin) + "px",
-                cell.getCssValue("width"));
+        assertEquals(100, cell.getSize().getWidth());
 
         // Set first column to be 200px wide
         selectMenuPath("Component", "Columns", "Column0", "Column0 Width",
                 "200px");
 
         cell = getBodyCellByRowAndColumn(1, 1);
-        assertEquals((200 - cellBorder - cellMargin) + "px",
-                cell.getCssValue("width"));
+        assertEquals(200, cell.getSize().getWidth());
 
         // Set second column to be 150px wide
         selectMenuPath("Component", "Columns", "Column1", "Column1 Width",
                 "150px");
         cell = getBodyCellByRowAndColumn(1, 2);
-        assertEquals((150 - cellBorder - cellMargin) + "px",
-                cell.getCssValue("width"));
+        assertEquals(150, cell.getSize().getWidth());
 
         // Set first column to be auto sized (defaults to 100px currently)
         selectMenuPath("Component", "Columns", "Column0", "Column0 Width",
                 "Auto");
 
         cell = getBodyCellByRowAndColumn(1, 1);
-        assertEquals((100 - cellBorder - cellMargin) + "px",
-                cell.getCssValue("width"));
+        assertEquals(100, cell.getSize().getWidth());
     }
 
     @Test
@@ -297,29 +282,6 @@ public class GridBasicFeaturesTest extends MultiBrowserTest {
                 "modified: Column0", getBodyCellByRowAndColumn(1, 1).getText());
     }
 
-    @Test
-    public void testDataFetchingWorks() throws Exception {
-        openTestURL();
-
-        scrollGridVerticallyTo(200);
-
-        /*
-         * Give time for the data to be fetched.
-         * 
-         * TODO TestBench currently doesn't know when Grid's DOM structure is
-         * stable. There are some plans regarding implementing support for this,
-         * so this test case can (should) be modified once that's implemented.
-         */
-        sleep(1000);
-
-        /*
-         * TODO this screenshot comparison could be done on the DOM level, if
-         * the DOM would be always in order. This could be amended once DOM
-         * reordering is merged into the Grid branch.
-         */
-        compareScreen("dataHasBeenLoaded");
-    }
-
     private boolean elementIsFound(By locator) {
         try {
             return driver.findElement(locator) != null;