aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/components/window/RepaintWindowContentsTest.java
blob: d097aa183c7279e26f0bf9efead0786bd86c7ca1 (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
package com.vaadin.tests.components.window;

import org.junit.Assert;
import org.junit.Test;

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

public class RepaintWindowContentsTest extends MultiBrowserTest {

    @Test
    public void testRepaintWindowContents() throws Exception {
        openTestURL();
        assertWindowContents("Button 1");
        toggleWindowContents();
        assertWindowContents("Button 2");
        toggleWindowContents();
        assertWindowContents("Button 1");
        toggleWindowContents();
        assertWindowContents("Button 2");
    }

    private void toggleWindowContents() {
        getWindowButton().click();
    }

    private void assertWindowContents(String expected) {
        Assert.assertEquals("Unexpected window contents,", expected,
                getWindowButton().getText());
    }

    private ButtonElement getWindowButton() {
        return $(WindowElement.class).$(ButtonElement.class).first();
    }
}