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.

WindowTwinColSelectTest.java 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package com.vaadin.tests.components.window;
  2. import org.junit.Test;
  3. import org.openqa.selenium.WebElement;
  4. import org.openqa.selenium.interactions.Actions;
  5. import com.vaadin.testbench.By;
  6. import com.vaadin.testbench.elements.TwinColSelectElement;
  7. import com.vaadin.tests.tb3.MultiBrowserTest;
  8. import static org.junit.Assert.assertEquals;
  9. import static org.junit.Assert.assertTrue;
  10. public class WindowTwinColSelectTest extends MultiBrowserTest {
  11. @Test
  12. public void testBothVisibleInitially() {
  13. openTestURL();
  14. TwinColSelectElement twinColSelect = $(TwinColSelectElement.class)
  15. .first();
  16. WebElement optionsElement = twinColSelect.getOptionsElement();
  17. WebElement selectionsElement = twinColSelect.getSelectionsElement();
  18. assertTrue(optionsElement.isDisplayed());
  19. assertTrue(selectionsElement.isDisplayed());
  20. assertEquals("Coordinate is not matching within the tolerance",
  21. optionsElement.getLocation().getY(), selectionsElement.getLocation().getY(), 3);
  22. }
  23. @Test
  24. public void testBothVisibleAfterResize() {
  25. openTestURL();
  26. waitForElementPresent(By.className("v-window-resizebox"));
  27. TwinColSelectElement twinColSelect = $(TwinColSelectElement.class)
  28. .first();
  29. new Actions(getDriver())
  30. .moveToElement(findElement(By.className("v-window-resizebox")))
  31. .clickAndHold().moveByOffset(-30, -30).release().build()
  32. .perform();
  33. WebElement optionsElement = twinColSelect.getOptionsElement();
  34. WebElement selectionsElement = twinColSelect.getSelectionsElement();
  35. assertTrue(optionsElement.isDisplayed());
  36. assertTrue(selectionsElement.isDisplayed());
  37. assertEquals("Coordinate is not matching within the tolerance.",
  38. optionsElement.getLocation().getY(), selectionsElement.getLocation().getY(), 3);
  39. }
  40. }