Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

RefreshFragmentChangeTest.java 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package com.vaadin.tests.application;
  2. import static org.junit.Assert.assertEquals;
  3. import java.util.concurrent.TimeUnit;
  4. import org.junit.Test;
  5. import org.openqa.selenium.TimeoutException;
  6. import com.vaadin.testbench.By;
  7. import com.vaadin.testbench.parallel.BrowserUtil;
  8. import com.vaadin.tests.tb3.MultiBrowserTest;
  9. public class RefreshFragmentChangeTest extends MultiBrowserTest {
  10. @Override
  11. protected Class<?> getUIClass() {
  12. return com.vaadin.tests.application.RefreshStatePreserve.class;
  13. }
  14. @Test
  15. public void testFragmentChange() throws Exception {
  16. getDriver().manage().timeouts().pageLoadTimeout(10, TimeUnit.SECONDS);
  17. openTestURL();
  18. assertLogText("1. Initial fragment: null");
  19. try {
  20. getDriver().get(getTestUrl() + "#asdf");
  21. } catch (TimeoutException e) {
  22. // Chrome throws timeout exception even when loading is successful
  23. if (!BrowserUtil.isChrome(getDesiredCapabilities())) {
  24. throw e;
  25. }
  26. }
  27. assertLogText("2. Fragment changed to asdf");
  28. openTestURL();
  29. assertLogText("3. Fragment changed to null");
  30. }
  31. private void assertLogText(String expected) {
  32. waitForElementPresent(By.className("v-label"));
  33. assertEquals("Incorrect log text,", expected, getLogRow(0));
  34. }
  35. }