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

import static org.junit.Assert.assertEquals;

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

import com.vaadin.testbench.elements.TreeGridElement;
import com.vaadin.tests.tb3.SingleBrowserTest;

public class TreeGridCollapseToLastRowInCacheTest extends SingleBrowserTest {

    @Before
    public void open() {
        // need to remove more rows than what is in cache when collapsing
        openTestURL("?restartApplication&debug&"
                + TreeGridScrolling.NODES_PARAMETER + "=50");
    }

    @Override
    protected Class<?> getUIClass() {
        return TreeGridScrolling.class;
    }

    // #8840
    @Test
    public void testCollapsingNode_removesLastRowFromGridCache_noInternalError() {
        TreeGridElement grid = $(TreeGridElement.class).first();

        grid.expandWithClick(0);
        grid.expandWithClick(1);

        assertNoErrorNotifications();

        assertEquals("0 | 0", grid.getCell(0, 0).getText());
        assertEquals("1 | 0", grid.getCell(1, 0).getText());
        assertEquals("2 | 0", grid.getCell(2, 0).getText());

        grid.collapseWithClick(0);

        assertEquals("0 | 0", grid.getCell(0, 0).getText());
        assertEquals("0 | 1", grid.getCell(1, 0).getText());

        assertNoErrorNotifications();
    }

}