aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/test/java/com/vaadin/tests/components/splitpanel/SplitPanelMoveComponentTest.java
blob: feeba35aeefdb70cc9af298395429f740b3264a7 (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
package com.vaadin.tests.components.splitpanel;

import static org.junit.Assert.assertEquals;

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

import com.vaadin.tests.tb3.MultiBrowserTest;

public class SplitPanelMoveComponentTest extends MultiBrowserTest {

    private static final String BUTTON_TEXT = "Button in splitpanel. Click to move to the other side";

    @Test
    public void moveComponent() {
        openTestURL();
        assertEquals(BUTTON_TEXT, getFirstChild().getText());
        getFirstChild().click();
        assertEquals(BUTTON_TEXT, getSecondChild().getText());
        getSecondChild().click();
        assertEquals(BUTTON_TEXT, getFirstChild().getText());
    }

    private WebElement getFirstChild() {
        WebElement container = getDriver().findElement(By.xpath(
                "//div[contains(@class,'v-splitpanel-first-container')]"));
        return container
                .findElement(By.xpath("//div[contains(@class, 'v-button')]"));
    }

    private WebElement getSecondChild() {
        WebElement container = getDriver().findElement(By.xpath(
                "//div[contains(@class,'v-splitpanel-second-container')]"));
        return container
                .findElement(By.xpath("//div[contains(@class, 'v-button')]"));
    }

}