aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/themes/base/DisabledMenuBarItemTest.java
blob: bec28d7929b87dfb4ed7c765b838d880ce9d9871 (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
37
38
39
package com.vaadin.tests.themes.base;

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

import java.io.IOException;

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() throws IOException {
        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)"));
        }

        compareScreen("transparent");
    }

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