aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/test/java/com/vaadin/tests/application/WebBrowserTimeZoneTest.java
blob: bc74927ee142e341cc3847d5a5ecb81d122eb269 (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 static org.junit.Assert.assertEquals;

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();
        assertEquals(String.format("Unexpected text in label '%s',", caption),
                expected, actual);
    }
}