aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/test/java/com/vaadin/tests/elements/link/LinkUITest.java
blob: a3ab7346b6a5d6e8386a7a7cbd2e882f0293c4f2 (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
package com.vaadin.tests.elements.link;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import org.junit.Before;
import org.junit.Test;

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

public class LinkUITest extends MultiBrowserTest {
    LinkElement link;

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

    @Test
    public void testLinkClick() {
        String currentUrl = getDriver().getCurrentUrl();
        assertTrue("Current URL " + currentUrl + " should end with LinkUI?",
                currentUrl.endsWith("LinkUI"));
        link.click();
        currentUrl = getDriver().getCurrentUrl();
        assertFalse(
                "Current URL " + currentUrl + " should not end with LinkUI?",
                currentUrl.endsWith("LinkUI"));

    }

    @Test
    public void getLinkCaption() {
        assertEquals("server root", link.getCaption());
    }

}