aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksi Hietanen <aleksi@vaadin.com>2016-11-30 14:24:23 +0200
committerVaadin Code Review <review@vaadin.com>2016-12-01 09:36:06 +0000
commit68f19ab2b0ac13393c887817f063e2b918b86d57 (patch)
treef1e1bd668e18a895295f50a4aea9ad826b2e39b5
parent1bb04399f3b825203a2c6d62154750768d75003e (diff)
downloadvaadin-framework-68f19ab2b0ac13393c887817f063e2b918b86d57.tar.gz
vaadin-framework-68f19ab2b0ac13393c887817f063e2b918b86d57.zip
Fix focus and blur tests for CheckBoxGroup, NativeSelect and RatioButtonGroup
Change-Id: I8454ef0895708eaee0bb2771b28c0a0db2fc76a4
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupFocusBlurTest.java12
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/nativeselect/NativeSelectFocusBlurTest.java2
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/radiobuttongroup/RadioButtonGroupFocusBlurTest.java11
3 files changed, 14 insertions, 11 deletions
diff --git a/uitest/src/test/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupFocusBlurTest.java b/uitest/src/test/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupFocusBlurTest.java
index 0da1fa4a88..e0929eb478 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupFocusBlurTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupFocusBlurTest.java
@@ -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."));
diff --git a/uitest/src/test/java/com/vaadin/tests/components/nativeselect/NativeSelectFocusBlurTest.java b/uitest/src/test/java/com/vaadin/tests/components/nativeselect/NativeSelectFocusBlurTest.java
index 7b21465632..8e3c0e197f 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/nativeselect/NativeSelectFocusBlurTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/nativeselect/NativeSelectFocusBlurTest.java
@@ -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."));
}
diff --git a/uitest/src/test/java/com/vaadin/tests/components/radiobuttongroup/RadioButtonGroupFocusBlurTest.java b/uitest/src/test/java/com/vaadin/tests/components/radiobuttongroup/RadioButtonGroupFocusBlurTest.java
index 77fde84f54..30ebf6abd7 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/radiobuttongroup/RadioButtonGroupFocusBlurTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/radiobuttongroup/RadioButtonGroupFocusBlurTest.java
@@ -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."));