aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/test/java/com/vaadin/tests/components/grid/GridOpenDetailsAddRowTest.java
blob: 939815b181752c9de7d66a3162f4186693c37c85 (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.components.grid;

import static org.junit.Assert.assertEquals;

import java.util.List;

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

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

public class GridOpenDetailsAddRowTest extends MultiBrowserTest {

    @Test
    public void addRow() {
        openTestURL();
        waitUntilLoadingIndicatorNotVisible();

        // confirm initial state
        List<WebElement> spacers = findElements(By.className("v-grid-spacer"));
        assertEquals("Unexpected initial amount of spacers", 3, spacers.size());

        // add a row
        $(ButtonElement.class).first().click();
        waitUntilLoadingIndicatorNotVisible();

        // ensure all existing spacers are still visible, as well as the new one
        spacers = findElements(By.className("v-grid-spacer"));
        assertEquals("Unexpected amount of spacers after adding a row", 4,
                spacers.size());

        assertEquals("Unexpected spacer contents for new row", "details - row4",
                spacers.get(3).getText());

        assertEquals("Unexpected spacer contents for first row",
                "details - row1", spacers.get(0).getText());
    }
}