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