Package com.vaadin.tests.actions

Source Code of com.vaadin.tests.actions.ActionsOnInvisibleComponentsTest

package com.vaadin.tests.actions;

import java.util.List;

import org.junit.Assert;
import org.junit.Test;
import org.openqa.selenium.interactions.Actions;
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();
        // Send Keys does not function correctly on these browsers.
        browsers.remove(Browser.CHROME.getDesiredCapabilities());
        browsers.remove(Browser.FIREFOX.getDesiredCapabilities());
        browsers.remove(Browser.IE8.getDesiredCapabilities());
        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) {
        new Actions(getDriver()).sendKeys(key).perform();
    }
}
TOP

Related Classes of com.vaadin.tests.actions.ActionsOnInvisibleComponentsTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.