aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/test/java/com/vaadin/tests/applicationcontext/ChangeSessionIdTest.java
blob: e7563fa5b63aadc43175aeaf0f89be1cb0527005 (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
package com.vaadin.tests.applicationcontext;

import static org.junit.Assert.assertTrue;

import org.junit.Test;

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

public class ChangeSessionIdTest extends MultiBrowserTest {

    @Test
    public void testSessionIdChange() throws Exception {
        openTestURL();
        checkLogMatches("1. Session id: .*");
        $(ButtonElement.class).first().click();
        checkLogMatches("2. Session id changed successfully from .* to .*");
        $(ButtonElement.class).get(1).click();
        checkLogMatches("3. Session id: .*");
    }

    private void checkLogMatches(String expected) {
        String actual = getLogRow(0);
        assertTrue(String.format(
                "Unexpected log row.\n expected format: '%s'\n was: '%s'",
                expected, actual), actual.matches(expected));
    }
}