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.

ContextClickUITest.java 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package com.vaadin.tests.components.abstractcomponent;
  2. import static org.junit.Assert.assertEquals;
  3. import static org.junit.Assert.assertTrue;
  4. import org.junit.Test;
  5. import org.openqa.selenium.interactions.Actions;
  6. import com.vaadin.testbench.elements.ButtonElement;
  7. import com.vaadin.testbench.elements.UIElement;
  8. import com.vaadin.tests.tb3.MultiBrowserTest;
  9. public class ContextClickUITest extends MultiBrowserTest {
  10. @Test
  11. public void testContextClick() {
  12. openTestURL();
  13. new Actions(getDriver())
  14. .moveToElement($(UIElement.class).first(), 10, 10)
  15. .contextClick().perform();
  16. assertEquals("Context click not received correctly",
  17. "1. Received context click at (10, 10)", getLogRow(0));
  18. }
  19. @Test
  20. public void testRemoveListener() {
  21. openTestURL();
  22. $(ButtonElement.class).first().click();
  23. new Actions(getDriver())
  24. .moveToElement($(UIElement.class).first(), 50, 50)
  25. .contextClick().perform();
  26. new Actions(getDriver())
  27. .moveToElement($(UIElement.class).first(), 10, 10).click()
  28. .perform();
  29. assertTrue("Context click should not be handled.",
  30. getLogRow(0).trim().isEmpty());
  31. }
  32. }