aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/test/java/com/vaadin/tests/elements/tabsheet/TabSheetElementExceptionTest.java
blob: 6c950692909243cb2b7596ea5b69598b8b0299d1 (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
package com.vaadin.tests.elements.tabsheet;

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

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

/**
 * Tests that an exception is thrown when attempting to select a tab that does
 * not exist in the tab sheet.
 */
public class TabSheetElementExceptionTest extends MultiBrowserTest {

    @Test
    public void testNoExceptionWhenFound() {
        openTestURL();
        TabSheetElement tse = $(TabSheetElement.class).first();
        for (int i = 1; i <= 5; i++) {
            tse.openTab("Tab " + i);
        }
    }

    @Test(expected = NoSuchElementException.class)
    public void testExceptionWhenNotFound() {
        openTestURL();
        TabSheetElement tse = $(TabSheetElement.class).first();
        tse.openTab("Tab 6");
    }
}