aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/test/java/com/vaadin/tests/tooltip/NestedOverlayTooltipTest.java
blob: c8c5bc1eac99a371a9246a842c8b72cbb4c528da (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package com.vaadin.tests.tooltip;

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

import com.vaadin.testbench.By;
import com.vaadin.testbench.elements.ButtonElement;
import com.vaadin.testbench.elements.PopupViewElement;
import com.vaadin.testbench.elements.UIElement;
import com.vaadin.testbench.elements.WindowElement;
import com.vaadin.tests.tb3.TooltipTest;

public class NestedOverlayTooltipTest extends TooltipTest {

    @Override
    public void setup() throws Exception {
        super.setup();
        openTestURL();
    }

    private void openDropDownAndTestTooltip(WebElement base, String firstItem,
            String tooltip) throws Exception {
        WebElement menuBar = base.findElement(By.className("v-menubar"));
        menuBar.findElement(By.vaadin("#" + firstItem)).click();
        WebElement popup = findElement(By.className("v-menubar-popup"));
        WebElement item = popup.findElement(By.className("v-menubar-menuitem"));
        checkTooltip(item, tooltip);
    }

    @Test
    public void testMenuItemTooltip() throws Exception {
        UIElement ui = $(UIElement.class).first();
        openDropDownAndTestTooltip(ui, "First item", "Dropdown Item tooltip");
    }

    @Test
    public void testMenuItemTooltipWithinWindow() throws Exception {
        $(ButtonElement.class).first().click();
        WindowElement window = $(WindowElement.class).first();
        openDropDownAndTestTooltip(window, "First item in window",
                "Window dropdown item tooltip");
    }

    @Test
    public void testMenuItemTooltipWithinNestedWindow() throws Exception {
        $(ButtonElement.class).first().click();
        WindowElement window = $(WindowElement.class).first();
        window.$(ButtonElement.class).first().click();
        WindowElement subWindow = $(WindowElement.class).get(1);
        openDropDownAndTestTooltip(subWindow, "First item in inner window",
                "Inner window dropdown item tooltip");
    }

    @Test
    public void testMenuItemTooltipWithinPopupView() throws Exception {
        $(PopupViewElement.class).first().click();
        WebElement popup = findElement(By.className("v-popupview-popup"));
        openDropDownAndTestTooltip(popup, "First item in popupView",
                "PopupView dropdown item tooltip");
    }

    @Test
    public void testMenuItemTooltipWithinNestedPopupView() throws Exception {
        $(PopupViewElement.class).first().click();
        WebElement popup = findElement(By.className("v-popupview-popup"));
        popup.findElement(By.className("v-popupview")).click();
        WebElement innerPopup = findElements(By.className("v-popupview-popup"))
                .get(1);
        openDropDownAndTestTooltip(innerPopup, "First item in inner popupView",
                "Inner popupView dropdown item tooltip");
    }

}