blob: 3211c1563311cb0ab5ffca5d128228bfe478c5e9 (
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
|
package com.vaadin.tests.application;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import com.vaadin.testbench.By;
import com.vaadin.testbench.elements.LabelElement;
import com.vaadin.tests.tb3.MultiBrowserTest;
public class RefreshStatePreserveTest extends MultiBrowserTest {
private static String UI_ID_TEXT = "UI id: 0";
@Test
public void testPreserveState() throws Exception {
openTestURL();
assertCorrectState();
// URL needs to be different or some browsers don't count it as history
openTestURL("debug");
assertCorrectState();
executeScript("history.back()");
assertCorrectState();
}
private void assertCorrectState() {
waitForElementPresent(By.className("v-label"));
LabelElement uiIdLabel = $(LabelElement.class).get(7);
assertEquals("Incorrect UI id,", UI_ID_TEXT, uiIdLabel.getText());
}
}
|