summaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/application/WebBrowserTimeZoneTest.java
blob: 10b6dfb7a9fa89f9fa0efdfde9b7c4ea43a90890 (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
package com.vaadin.tests.application;

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

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

public class WebBrowserTimeZoneTest extends MultiBrowserTest {
    @Test
    public void testBrowserTimeZoneInfo() throws Exception {
        openTestURL();
        $(ButtonElement.class).first().click();
        assertLabelText("Browser raw offset", "7200000");
        assertLabelText("Browser to Europe/Helsinki offset difference", "0");
        assertLabelText("Browser could be in Helsinki", "Yes");
    }

    private void assertLabelText(String caption, String expected) {
        String actual = $(LabelElement.class).caption(caption).first()
                .getText();
        Assert.assertEquals(
                String.format("Unexpected text in label '%s',", caption),
                expected, actual);
    }
}