aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/components/ui/UISerializationTest.java
blob: 649f48c9ce301beb4946b5f6e7df0bf7f39c9d93 (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
package com.vaadin.tests.components.ui;

import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.endsWith;
import static org.hamcrest.Matchers.startsWith;
import static org.junit.Assert.assertThat;

import org.junit.Test;

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

public class UISerializationTest extends SingleBrowserTest {

    @Test
    public void uiIsSerialized() throws Exception {
        openTestURL();

        serialize();

        assertThat(getLogRow(0), startsWith("3. Diff states match, size: "));
        assertThat(getLogRow(1), startsWith("2. Deserialized UI in "));
        assertThat(
                getLogRow(2),
                allOf(startsWith("1. Serialized UI in"),
                        containsString(" into "), endsWith(" bytes")));
    }

    private void serialize() {
        $(ButtonElement.class).first().click();
    }
}