You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

RefreshStatePreserveTest.java 934B

123456789101112131415161718192021222324252627282930
  1. package com.vaadin.tests.application;
  2. import static org.junit.Assert.assertEquals;
  3. import org.junit.Test;
  4. import com.vaadin.testbench.By;
  5. import com.vaadin.testbench.elements.LabelElement;
  6. import com.vaadin.tests.tb3.MultiBrowserTest;
  7. public class RefreshStatePreserveTest extends MultiBrowserTest {
  8. private static String UI_ID_TEXT = "UI id: 0";
  9. @Test
  10. public void testPreserveState() throws Exception {
  11. openTestURL();
  12. assertCorrectState();
  13. // URL needs to be different or some browsers don't count it as history
  14. openTestURL("debug");
  15. assertCorrectState();
  16. executeScript("history.back()");
  17. assertCorrectState();
  18. }
  19. private void assertCorrectState() {
  20. waitForElementPresent(By.className("v-label"));
  21. LabelElement uiIdLabel = $(LabelElement.class).get(7);
  22. assertEquals("Incorrect UI id,", UI_ID_TEXT, uiIdLabel.getText());
  23. }
  24. }