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.

UpdateTableWhenUnfocusedTest.java 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. package com.vaadin.tests.components.table;
  2. import static org.hamcrest.CoreMatchers.is;
  3. import static org.hamcrest.MatcherAssert.assertThat;
  4. import java.io.IOException;
  5. import org.junit.Test;
  6. import com.vaadin.testbench.TestBenchElement;
  7. import com.vaadin.testbench.elements.TableElement;
  8. import com.vaadin.testbench.elements.ButtonElement;
  9. import com.vaadin.tests.tb3.MultiBrowserTest;
  10. public class UpdateTableWhenUnfocusedTest extends MultiBrowserTest {
  11. @Test
  12. public void testWindowIsNotScrolled() throws IOException {
  13. openTestURL();
  14. TestBenchElement cell = $(TableElement.class).first().getCell(3, 0);
  15. cell.click();
  16. TestBenchElement button = $(ButtonElement.class).first();
  17. button.focus();
  18. int buttonLocation = button.getLocation().getY();
  19. button.click();
  20. int newButtonLocation = button.getLocation().getY();
  21. assertThat(
  22. "Button location has changed after table refresh, window has scrolled and it shouldn't have",
  23. newButtonLocation, is(buttonLocation));
  24. }
  25. }