aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/test/java/com/vaadin/tests/elements/table/TableElementContextMenuTest.java
blob: e2975564e5685dc223ebc4bc37e62dfa560b35e8 (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.elements.table;

import static org.junit.Assert.assertNotNull;

import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.NoSuchElementException;

import com.vaadin.testbench.elements.TableElement;
import com.vaadin.tests.tb3.MultiBrowserTest;

public class TableElementContextMenuTest extends MultiBrowserTest {

    private TableElement tableElement;

    @Before
    public void init() {
        openTestURL();
        tableElement = $(TableElement.class).first();
    }

    @Test
    public void tableContextMenu_menuOpenFetchMenu_contextMenuFetchedCorrectly() {
        tableElement.contextClick();
        TableElement.ContextMenuElement contextMenu = tableElement
                .getContextMenu();
        assertNotNull(
                "There is no context menu open by tableElement.contextClick()",
                contextMenu);
    }

    @Test(expected = NoSuchElementException.class)
    public void tableContextMenu_menuClosedfetchContextMenu_exceptionThrown() {
        tableElement.getContextMenu();
    }
}