blob: a28e56fd3195d9976fe2a1b2c64b79a55e462832 (
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
|
package com.vaadin.tests.components.abstractfield;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import com.vaadin.testbench.elements.ButtonElement;
import com.vaadin.tests.tb3.SingleBrowserTest;
public class ShortcutWhenBodyFocusedTest extends SingleBrowserTest {
@Test
public void triggerShortcutOnBody() {
openTestURL();
ButtonElement b = $(ButtonElement.class).caption("Hello").first();
b.click();
assertEquals("1. Hello clicked", getLogRow(0));
b.sendKeys("a");
assertEquals("2. Hello clicked", getLogRow(0));
WebElement body = findElement(By.xpath("//body"));
body.sendKeys("a");
assertEquals("3. Hello clicked", getLogRow(0));
}
}
|