aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/test/java/com/vaadin/tests/components/table/TableReadOnlyTextFieldTest.java
blob: 956d272c707f6dbb851eee71aa2d46afccfcbaba (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
package com.vaadin.tests.components.table;

import com.vaadin.testbench.elements.TableElement;
import com.vaadin.testbench.elements.TableRowElement;
import com.vaadin.tests.tb3.MultiBrowserTest;
import org.junit.Test;
import org.openqa.selenium.By;

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

public class TableReadOnlyTextFieldTest extends MultiBrowserTest {

    @Test
    public void selectRowOnTextFieldClick() {
        openTestURL();
        TableElement table = $(TableElement.class).first();
        assertFalse(isSelected(table.getRow(0)));
        findElement(By.className("v-textfield-readonly")).click();
        assertTrue(
                "The row should be selected, if read-only TextField is clicked",
                isSelected(table.getRow(0)));

    }

    private boolean isSelected(TableRowElement row) {
        return hasCssClass(row, "v-selected");
    }
}