From 4445eae397818196ba1818470c73ccf34e2033ce Mon Sep 17 00:00:00 2001 From: Henri Sara Date: Fri, 10 Feb 2017 13:42:08 +0200 Subject: [PATCH] Fix Firefox 45 tests (click issues, screenshots) (#8533) --- tests/screenshots | 2 +- .../java/com/vaadin/tests/tb3/AbstractTB3Test.java | 9 +++++++++ .../components/combobox/ComboBoxClickIconTest.java | 7 ++++--- .../combobox/ComboBoxLargeIconsTest.java | 6 +++--- .../ui/ComboboxSelectedItemTextTest.java | 14 ++++++++------ 5 files changed, 25 insertions(+), 13 deletions(-) diff --git a/tests/screenshots b/tests/screenshots index ce9907a1e9..c233d26d0a 160000 --- a/tests/screenshots +++ b/tests/screenshots @@ -1 +1 @@ -Subproject commit ce9907a1e9f05abceeb9be656b4d1d8d58f0d5bf +Subproject commit c233d26d0af136183eef3707461e2df0d026ff4e diff --git a/uitest-common/src/main/java/com/vaadin/tests/tb3/AbstractTB3Test.java b/uitest-common/src/main/java/com/vaadin/tests/tb3/AbstractTB3Test.java index 69762141d8..6a82492da5 100644 --- a/uitest-common/src/main/java/com/vaadin/tests/tb3/AbstractTB3Test.java +++ b/uitest-common/src/main/java/com/vaadin/tests/tb3/AbstractTB3Test.java @@ -1003,6 +1003,15 @@ public abstract class AbstractTB3Test extends ParallelTest { } } + protected void clickElement(WebElement element) { + if (BrowserUtil.isFirefox(getDesiredCapabilities())) { + // Workaround for Selenium/TB and Firefox 45 issue + ((TestBenchElement) (element)).clickHiddenElement(); + } else { + element.click(); + } + } + protected boolean isLoadingIndicatorVisible() { WebElement loadingIndicator = findElement( By.className("v-loading-indicator")); diff --git a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxClickIconTest.java b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxClickIconTest.java index f60e3b5f67..a20968986c 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxClickIconTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxClickIconTest.java @@ -35,10 +35,11 @@ public class ComboBoxClickIconTest extends MultiBrowserTest { $(ComboBoxElement.class).first().openPopup(); - getDriver().findElements(By.className("gwt-MenuItem")).get(1).click(); + clickElement( + getDriver().findElements(By.className("gwt-MenuItem")).get(1)); - getDriver().findElement(By.className("v-filterselect")) - .findElement(By.className("v-icon")).click(); + clickElement(getDriver().findElement(By.className("v-filterselect")) + .findElement(By.className("v-icon"))); Assert.assertTrue("Unable to find menu items in combobox popup", isElementPresent(By.className("gwt-MenuItem"))); diff --git a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxLargeIconsTest.java b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxLargeIconsTest.java index e2dcd8ca10..656dea1ed0 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxLargeIconsTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxLargeIconsTest.java @@ -27,7 +27,7 @@ public class ComboBoxLargeIconsTest extends MultiBrowserTest { compareScreen("icons-16x16-page1"); cb.openNextPage(); compareScreen("icons-16x16-page2"); - cb.findElement(By.vaadin("#popup/item0")).click(); + clickElement(cb.findElement(By.vaadin("#popup/item0"))); compareScreen("icons-16x16-selected-1-3-5-9"); iconSelect.selectByText("32x32"); @@ -42,12 +42,12 @@ public class ComboBoxLargeIconsTest extends MultiBrowserTest { ComboBoxElement pageLength0cb = $(ComboBoxElement.class) .caption("Pagelength 0").first(); pageLength0cb.openPopup(); - pageLength0cb.findElement(By.vaadin("#popup/item1")).click(); + clickElement(pageLength0cb.findElement(By.vaadin("#popup/item1"))); ComboBoxElement cb200px = $(ComboBoxElement.class) .caption("200px wide select with 50 items").first(); cb200px.openPopup(); - cb200px.findElement(By.vaadin("#popup/item1")).click(); + clickElement(cb200px.findElement(By.vaadin("#popup/item1"))); ComboBoxElement cb150px = $(ComboBoxElement.class) .caption("150px wide select with 5 items").first(); diff --git a/uitest/src/test/java/com/vaadin/tests/components/ui/ComboboxSelectedItemTextTest.java b/uitest/src/test/java/com/vaadin/tests/components/ui/ComboboxSelectedItemTextTest.java index 41632ea080..ac62ffe6d6 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/ui/ComboboxSelectedItemTextTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/ui/ComboboxSelectedItemTextTest.java @@ -75,28 +75,30 @@ public class ComboboxSelectedItemTextTest extends MultiBrowserTest { // Select an element from the first (to test) combobox. - comboBox.findElement(By.className("v-filterselect-button")).click(); + clickElement( + comboBox.findElement(By.className("v-filterselect-button"))); waitForPopup(comboBox); WebElement comboBoxPopup = vaadinElement( "/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[" + indexToTest + "]/VComboBox[0]#popup"); - comboBoxPopup.findElements(By.tagName("td")).get(2).click(); + clickElement(comboBoxPopup.findElements(By.tagName("td")).get(2)); // Select an element from the second (to focus) combobox to remove // focus from the first combobox - comboBoxFocus.findElement(By.className("v-filterselect-button")) - .click(); + clickElement(comboBoxFocus + .findElement(By.className("v-filterselect-button"))); waitForPopup(comboBoxFocus); comboBoxPopup = vaadinElement( "/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[" + indexToFocus + "]/VComboBox[0]#popup"); - comboBoxPopup.findElements(By.tagName("td")).get(2).click(); + clickElement(comboBoxPopup.findElements(By.tagName("td")).get(2)); // click the button of the first combobox. This would reveal the // unwanted behaviour. - comboBox.findElement(By.className("v-filterselect-button")).click(); + clickElement( + comboBox.findElement(By.className("v-filterselect-button"))); // sadly, screenshot comparison is the only reasonable way to test a // rendering issue. -- 2.39.5