aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/test/java/com/vaadin/tests/components/treegrid/TreeGridDoubleClickTest.java
blob: 052bfb02524af8551e2673054e7049f9a6bbeefa (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.components.treegrid;

import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;

import com.vaadin.testbench.ElementQuery;
import com.vaadin.testbench.elements.NotificationElement;
import com.vaadin.testbench.elements.TreeGridElement;
import com.vaadin.tests.tb3.SingleBrowserTest;

import static org.junit.Assert.assertTrue;

public class TreeGridDoubleClickTest extends SingleBrowserTest {

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

        TreeGridElement grid = $(TreeGridElement.class).first();
        WebElement hierarchyCell = grid
                .findElement(By.className("v-treegrid-node"));
        new Actions(getDriver()).doubleClick(hierarchyCell).perform();

        assertTrue("Double click is not handled",
                isDoubleClickNotificationPresent());
    }

    private boolean isDoubleClickNotificationPresent() {
        ElementQuery<NotificationElement> notification = $(
                NotificationElement.class);
        return notification.exists()
                && "Double click".equals(notification.first().getCaption());
    }
}