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.

ComboBoxHeightTest.java 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. package com.vaadin.tests.components.combobox;
  2. import org.junit.Test;
  3. import org.openqa.selenium.WebElement;
  4. import com.vaadin.testbench.elements.ComboBoxElement;
  5. import com.vaadin.tests.tb3.SingleBrowserTest;
  6. public class ComboBoxHeightTest extends SingleBrowserTest {
  7. @Test
  8. public void testPopupHeight() {
  9. openTestURL();
  10. assertPopupHeight();
  11. }
  12. @Test
  13. public void testPopupHeightCustomTheme() {
  14. openTestURL("theme=tests-valo-combobox-height");
  15. assertPopupHeight();
  16. }
  17. private void assertPopupHeight() {
  18. ComboBoxElement comboBox = $(ComboBoxElement.class).first();
  19. comboBox.openPopup();
  20. WebElement suggestionPopup = comboBox.getSuggestionPopup();
  21. int suggestionPopupBottom =
  22. suggestionPopup.getLocation().getY() + suggestionPopup.getSize()
  23. .getHeight();
  24. assertGreaterOrEqual(
  25. "Combo box suggestion popup should not exceed the browser's viewport",
  26. driver.manage().window().getSize().getHeight(),
  27. suggestionPopupBottom);
  28. }
  29. }