diff options
author | Pekka Hyvönen <pekka@vaadin.com> | 2016-12-13 16:13:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-13 16:13:05 +0200 |
commit | 12793c9667cb2708ddfbcfe0d94364dd0dc607e3 (patch) | |
tree | 4edaedc078689ff26a91bab3357efe625047ffcd /uitest | |
parent | a43fd9003a77f253a78b807d4ecadcd828b936a4 (diff) | |
download | vaadin-framework-12793c9667cb2708ddfbcfe0d94364dd0dc607e3.tar.gz vaadin-framework-12793c9667cb2708ddfbcfe0d94364dd0dc607e3.zip |
Fix broken test for RadioButtonGroup and CheckBoxGroup (#7970)
Selection by clicking options was broken on Chrome 40 on Windows.
Switched the custom element to extend corresponding elements from TestBench API.
Diffstat (limited to 'uitest')
2 files changed, 10 insertions, 9 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 e0929eb478..734a80eb2a 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 @@ -40,12 +40,12 @@ public class CheckBoxGroupFocusBlurTest extends MultiBrowserTest { List<WebElement> checkBoxes = $(CheckBoxGroupElement.class).first() .findElements(By.tagName("input")); - checkBoxes.get(0).click(); + $(CheckBoxGroupElement.class).first().selectByText("1"); // Focus event is fired Assert.assertTrue(logContainsText("1. Focus Event")); - checkBoxes.get(1).click(); + $(CheckBoxGroupElement.class).first().selectByText("2"); // click on the second checkbox doesn't fire anything Assert.assertFalse(logContainsText("2.")); @@ -71,7 +71,7 @@ public class CheckBoxGroupFocusBlurTest extends MultiBrowserTest { // blur event is fired Assert.assertTrue(logContainsText("2. Blur Event")); - checkBoxes.get(3).click(); + $(CheckBoxGroupElement.class).first().selectByText("4"); // Focus event is fired Assert.assertTrue(logContainsText("3. Focus Event")); 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 30ebf6abd7..16889cfbf0 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 @@ -38,14 +38,16 @@ public class RadioButtonGroupFocusBlurTest extends MultiBrowserTest { public void focusBlurEvents() { openTestURL(); - List<WebElement> radioButtons = $(RadioButtonGroupElement.class).first() + RadioButtonGroupElement radioButtonGroup = $( + RadioButtonGroupElement.class).first(); + List<WebElement> radioButtons = radioButtonGroup .findElements(By.tagName("input")); - radioButtons.get(0).click(); + radioButtonGroup.selectByText("1"); // Focus event is fired Assert.assertTrue(logContainsText("1. Focus Event")); - radioButtons.get(1).click(); + radioButtonGroup.selectByText("2"); // click on the second radio button doesn't fire anything Assert.assertFalse(logContainsText("2.")); @@ -60,8 +62,7 @@ public class RadioButtonGroupFocusBlurTest extends MultiBrowserTest { Assert.assertFalse(logContainsText("2.")); // click to label of a radio button - $(RadioButtonGroupElement.class).first() - .findElements(By.tagName("label")).get(2).click(); + radioButtonGroup.findElements(By.tagName("label")).get(2).click(); // no new events Assert.assertFalse(logContainsText("2.")); @@ -70,7 +71,7 @@ public class RadioButtonGroupFocusBlurTest extends MultiBrowserTest { // blur event is fired Assert.assertTrue(logContainsText("2. Blur Event")); - radioButtons.get(3).click(); + radioButtonGroup.selectByText("4"); // Focus event is fired Assert.assertTrue(logContainsText("3. Focus Event")); |