]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fix focus and blur tests for CheckBoxGroup, NativeSelect and RatioButtonGroup
authorAleksi Hietanen <aleksi@vaadin.com>
Wed, 30 Nov 2016 12:24:23 +0000 (14:24 +0200)
committerVaadin Code Review <review@vaadin.com>
Thu, 1 Dec 2016 09:36:06 +0000 (09:36 +0000)
Change-Id: I8454ef0895708eaee0bb2771b28c0a0db2fc76a4

uitest/src/test/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupFocusBlurTest.java
uitest/src/test/java/com/vaadin/tests/components/nativeselect/NativeSelectFocusBlurTest.java
uitest/src/test/java/com/vaadin/tests/components/radiobuttongroup/RadioButtonGroupFocusBlurTest.java

index 0da1fa4a882fdcaf2c719b2fabba5f8b23eef4bb..e0929eb478b87a802a13521aa54a32a9eb5c8f29 100644 (file)
@@ -49,12 +49,14 @@ public class CheckBoxGroupFocusBlurTest extends MultiBrowserTest {
         // click on the second checkbox doesn't fire anything
         Assert.assertFalse(logContainsText("2."));
 
-        // click in the middle between the first and the second (inside group).
-        WebElement first = checkBoxes.get(0);
-        int middle = (first.getLocation().y + first.getSize().height
-                + checkBoxes.get(1).getLocation().y) / 2;
-        new Actions(getDriver()).moveByOffset(first.getLocation().x, middle)
+        // move the cursor to the middle of the first element,
+        // offset to the middle of the two and perform click
+        new Actions(getDriver()).moveToElement(checkBoxes.get(0))
+                .moveByOffset(0,
+                        (checkBoxes.get(1).getLocation().y
+                                - checkBoxes.get(0).getLocation().y) / 2)
                 .click().build().perform();
+
         // no new events
         Assert.assertFalse(logContainsText("2."));
 
index 7b21465632abe592ff6c806c755385fbb65850ac..8e3c0e197f5e614a54b46cda3166dde1386c138c 100644 (file)
@@ -56,7 +56,7 @@ public class NativeSelectFocusBlurTest extends MultiBrowserTest {
         // Focus event is fired
         Assert.assertTrue(logContainsText("3. Focus Event"));
 
-        options.get(1).sendKeys(Keys.ARROW_UP, Keys.ENTER);
+        nativeSelect.sendKeys(Keys.ARROW_UP, Keys.ENTER);
         // No any new event
         Assert.assertFalse(logContainsText("4."));
     }
index 77fde84f54a44d337c6189339084f80090908a19..30ebf6abd7064577de6bb744740eac9625bf6cc4 100644 (file)
@@ -49,11 +49,12 @@ public class RadioButtonGroupFocusBlurTest extends MultiBrowserTest {
         // click on the second radio button doesn't fire anything
         Assert.assertFalse(logContainsText("2."));
 
-        // click in the middle between the first and the second (inside group).
-        WebElement first = radioButtons.get(0);
-        int middle = (first.getLocation().y + first.getSize().height
-                + radioButtons.get(1).getLocation().y) / 2;
-        new Actions(getDriver()).moveByOffset(first.getLocation().x, middle)
+        // move the cursor to the middle of the first element,
+        // offset to the middle of the two and perform click
+        new Actions(getDriver()).moveToElement(radioButtons.get(0))
+                .moveByOffset(0,
+                        (radioButtons.get(1).getLocation().y
+                                - radioButtons.get(0).getLocation().y) / 2)
                 .click().build().perform();
         // no new events
         Assert.assertFalse(logContainsText("2."));