aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/themes/base/DisabledMenuBarItemTest.java
blob: 0a10a7f38bd2ba723b547105dd53c7fb8cdad8e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package com.vaadin.tests.themes.base;

import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;

import org.junit.Test;
import org.openqa.selenium.WebElement;

import com.vaadin.testbench.By;
import com.vaadin.testbench.parallel.Browser;
import com.vaadin.tests.tb3.MultiBrowserTest;

public class DisabledMenuBarItemTest extends MultiBrowserTest {

    @Test
    public void disabledMenuItemShouldHaveOpacity() {
        openTestURL();

        WebElement element = driver.findElement(By
                .className("v-menubar-menuitem-disabled"));

        assertThat(element.getCssValue("opacity"), is("0.5"));

        if (browserIsIE8or9()) {
            assertThat(element.getCssValue("filter"), is("alpha(opacity=50)"));

        }
    }

    private boolean browserIsIE8or9() {
        return Browser.IE8.getDesiredCapabilities().equals(
                getDesiredCapabilities())
                || Browser.IE9.getDesiredCapabilities().equals(
                        getDesiredCapabilities());
    }
}