diff options
Diffstat (limited to 'uitest/src/com/vaadin/tests/actions/ActionsOnInvisibleComponentsTest.java')
-rw-r--r-- | uitest/src/com/vaadin/tests/actions/ActionsOnInvisibleComponentsTest.java | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/actions/ActionsOnInvisibleComponentsTest.java b/uitest/src/com/vaadin/tests/actions/ActionsOnInvisibleComponentsTest.java new file mode 100644 index 0000000000..ca00c998a6 --- /dev/null +++ b/uitest/src/com/vaadin/tests/actions/ActionsOnInvisibleComponentsTest.java @@ -0,0 +1,46 @@ +package com.vaadin.tests.actions; + +import java.util.List; + +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.remote.DesiredCapabilities; + +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class ActionsOnInvisibleComponentsTest extends MultiBrowserTest { + + private static final String LAST_INIT_LOG = "3. 'C' triggers a click on a visible and enabled button"; + + // This method should be removed once #12785 is fixed + @Override + public List<DesiredCapabilities> getBrowsersToTest() { + List<DesiredCapabilities> browsers = super.getBrowsersToTest(); + // sendKeys does nothing on these browsers + browsers.remove(BrowserUtil.firefox(24)); + browsers.remove(BrowserUtil.ie(8)); + browsers.remove(BrowserUtil.opera(12)); + + // Causes 'cannot focus element' + browsers.remove(BrowserUtil.chrome(29)); + return browsers; + } + + @Test + public void testShortcutsOnInvisibleDisabledButtons() { + openTestURL(); + Assert.assertEquals(LAST_INIT_LOG, getLogRow(0)); + invokeShortcut("A"); + Assert.assertEquals(LAST_INIT_LOG, getLogRow(0)); + invokeShortcut("B"); + Assert.assertEquals(LAST_INIT_LOG, getLogRow(0)); + invokeShortcut("C"); + Assert.assertEquals("4. Click event for enabled button", getLogRow(0)); + } + + private void invokeShortcut(CharSequence key) { + WebElement shortcutTarget = vaadinElementById("test-root"); + shortcutTarget.sendKeys(key); + } +} |