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.

DragAndDropRelativeWidthTest.java 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package com.vaadin.tests.components.draganddropwrapper;
  2. import static org.junit.Assert.assertEquals;
  3. import org.junit.Test;
  4. import org.openqa.selenium.By;
  5. import org.openqa.selenium.Dimension;
  6. import org.openqa.selenium.WebElement;
  7. import org.openqa.selenium.interactions.Actions;
  8. import com.vaadin.tests.tb3.MultiBrowserTest;
  9. /**
  10. * Test to check size of drag image element.
  11. *
  12. * @author Vaadin Ltd
  13. */
  14. public class DragAndDropRelativeWidthTest extends MultiBrowserTest {
  15. @Test
  16. public void testDragImageElementSize() {
  17. openTestURL();
  18. WebElement label = getDriver().findElement(By.className("drag-source"));
  19. Dimension size = label.getSize();
  20. int height = size.getHeight();
  21. int width = size.getWidth();
  22. Actions actions = new Actions(getDriver());
  23. actions.moveToElement(label);
  24. actions.clickAndHold();
  25. actions.moveByOffset(100, 100);
  26. actions.build().perform();
  27. WebElement dragImage = getDriver()
  28. .findElement(By.className("v-drag-element"));
  29. assertEquals("Drag image element height is unexpected", height,
  30. dragImage.getSize().getHeight());
  31. assertEquals("Drag image element width is unexpected", width,
  32. dragImage.getSize().getWidth());
  33. }
  34. }