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.

UIPollingTest.java 970B

12345678910111213141516171819202122232425262728293031
  1. package com.vaadin.tests.components.ui;
  2. import static org.junit.Assert.assertFalse;
  3. import static org.junit.Assert.assertTrue;
  4. import org.junit.Test;
  5. import com.vaadin.testbench.elements.TextFieldElement;
  6. import com.vaadin.tests.tb3.MultiBrowserTest;
  7. public class UIPollingTest extends MultiBrowserTest {
  8. @Test
  9. public void testPolling() throws Exception {
  10. openTestURL();
  11. getTextField().setValue("500");
  12. sleep(2000);
  13. /* Ensure polling has taken place */
  14. assertTrue("Page does not contain the given text",
  15. driver.getPageSource().contains("2. 1000ms has passed"));
  16. getTextField().setValue("-1");
  17. sleep(2000);
  18. /* Ensure polling has stopped */
  19. assertFalse("Page contains the given text",
  20. driver.getPageSource().contains("20. 10000ms has passed"));
  21. }
  22. public TextFieldElement getTextField() {
  23. return $(TextFieldElement.class).first();
  24. }
  25. }