Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

NavigatorListenerModifiesListenersTest.java 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package com.vaadin.tests.navigator;
  2. import static org.junit.Assert.assertEquals;
  3. import org.junit.Test;
  4. import org.openqa.selenium.By;
  5. import org.openqa.selenium.WebElement;
  6. import com.vaadin.testbench.elements.ButtonElement;
  7. import com.vaadin.tests.tb3.SingleBrowserTest;
  8. public class NavigatorListenerModifiesListenersTest extends SingleBrowserTest {
  9. @Test
  10. public void testIfConfirmBack() {
  11. openTestURL();
  12. // keep URL of main view
  13. final String initialUrl = driver.getCurrentUrl();
  14. // do it 2 times to verify that this is not broken after first time
  15. for (int i = 0; i < 2; i++) {
  16. // go to prompted view
  17. WebElement button = $(ButtonElement.class).first();
  18. button.click();
  19. // verify we are in another view and url is correct
  20. waitForElementPresent(By.id(
  21. NavigatorListenerModifiesListeners.LABEL_ANOTHERVIEW_ID));
  22. String currentUrl = driver.getCurrentUrl();
  23. assertEquals("Current URL should be equal to another view URL",
  24. initialUrl.replace(
  25. NavigatorListenerModifiesListeners.MainView.NAME,
  26. NavigatorListenerModifiesListeners.AnotherView.NAME),
  27. currentUrl);
  28. // click back button
  29. driver.navigate().back();
  30. // verify we are in main view and url is correct
  31. // without the fix for #17477, we get
  32. // ConcurrentModificationException
  33. waitForElementPresent(By
  34. .id(NavigatorListenerModifiesListeners.LABEL_MAINVIEW_ID));
  35. currentUrl = driver.getCurrentUrl();
  36. assertEquals("Current URL should be equal to the initial view URL",
  37. initialUrl, currentUrl);
  38. }
  39. }
  40. }