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.

GridWithFullWidthComponentsTest.java 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. package com.vaadin.tests.components.grid;
  2. import static org.junit.Assert.assertEquals;
  3. import org.junit.Test;
  4. import org.openqa.selenium.Dimension;
  5. import org.openqa.selenium.WebElement;
  6. import com.vaadin.testbench.By;
  7. import com.vaadin.tests.tb3.MultiBrowserTest;
  8. public class GridWithFullWidthComponentsTest extends MultiBrowserTest {
  9. @Test
  10. public void testResizeUpAndDown() {
  11. openTestURL();
  12. WebElement hScrollBar = findElement(
  13. By.className("v-grid-scroller-horizontal"));
  14. assertEquals("Unexpected horizontal scrollbar visibility", "none",
  15. hScrollBar.getCssValue("display"));
  16. // increase the browser size
  17. getDriver().manage().window().setSize(new Dimension(2000, 850));
  18. sleep(300);
  19. assertEquals("Unexpected horizontal scrollbar visibility", "none",
  20. hScrollBar.getCssValue("display"));
  21. // scale back again
  22. getDriver().manage().window().setSize(new Dimension(1500, 850));
  23. sleep(300);
  24. assertEquals("Unexpected horizontal scrollbar visibility", "none",
  25. hScrollBar.getCssValue("display"));
  26. }
  27. @Test
  28. public void testResizeDownAndUp() {
  29. openTestURL();
  30. WebElement hScrollBar = findElement(
  31. By.className("v-grid-scroller-horizontal"));
  32. assertEquals("Unexpected horizontal scrollbar visibility", "none",
  33. hScrollBar.getCssValue("display"));
  34. // decrease the browser size far enough that scrollbars are needed
  35. getDriver().manage().window().setSize(new Dimension(800, 850));
  36. sleep(300);
  37. assertEquals("Unexpected horizontal scrollbar visibility", "block",
  38. hScrollBar.getCssValue("display"));
  39. // scale back again
  40. getDriver().manage().window().setSize(new Dimension(1500, 850));
  41. sleep(300);
  42. assertEquals("Unexpected horizontal scrollbar visibility", "none",
  43. hScrollBar.getCssValue("display"));
  44. }
  45. }