aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/test/java/com/vaadin/tests/components/window/WindowTwinColSelectTest.java
blob: 47d42e7941257f616fe11af70a6b13c50590b7b7 (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
41
42
43
44
45
46
47
48
49
package com.vaadin.tests.components.window;

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

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

import com.vaadin.testbench.By;
import com.vaadin.testbench.elements.TwinColSelectElement;
import com.vaadin.tests.tb3.MultiBrowserTest;

public class WindowTwinColSelectTest extends MultiBrowserTest {

    @Test
    public void testBothVisibleInitially() {
        openTestURL();
        waitUntilLoadingIndicatorNotVisible();
        TwinColSelectElement twinColSelect = $(TwinColSelectElement.class)
                .first();
        WebElement optionsElement = twinColSelect.getOptionsElement();
        WebElement selectionsElement = twinColSelect.getSelectionsElement();
        assertTrue(optionsElement.isDisplayed());
        assertTrue(selectionsElement.isDisplayed());
        assertEquals("Coordinate is not matching within the tolerance",
                optionsElement.getLocation().getY(),
                selectionsElement.getLocation().getY(), 3);
    }

    @Test
    public void testBothVisibleAfterResize() {
        openTestURL();
        waitForElementPresent(By.className("v-window-resizebox"));
        TwinColSelectElement twinColSelect = $(TwinColSelectElement.class)
                .first();
        new Actions(getDriver())
                .moveToElement(findElement(By.className("v-window-resizebox")))
                .clickAndHold().moveByOffset(-30, -30).release().build()
                .perform();
        WebElement optionsElement = twinColSelect.getOptionsElement();
        WebElement selectionsElement = twinColSelect.getSelectionsElement();
        assertTrue(optionsElement.isDisplayed());
        assertTrue(selectionsElement.isDisplayed());
        assertEquals("Coordinate is not matching within the tolerance.",
                optionsElement.getLocation().getY(),
                selectionsElement.getLocation().getY(), 3);
    }
}