blob: 07dfffb6dc94bb9646c94810557d811578ea6db6 (
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
|
package com.vaadin.tests;
import com.vaadin.testbench.elements.TextFieldElement;
import com.vaadin.testbench.elements.WindowElement;
import com.vaadin.tests.tb3.MultiBrowserTest;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import static org.junit.Assert.assertEquals;
public class FocusOutsideWindowTest extends MultiBrowserTest {
@Test
public void verifyTextFieldFocused() throws Exception {
openTestURL();
WebElement openW = findElement(By.id("buttonOp"));
WebElement focusBut = findElement(By.id("focusBut"));
// Closing window should focus TexField
openW.click();
TextFieldElement textField = $(TextFieldElement.class).first();
WindowElement window = $(WindowElement.class).first();
window.close();
assertEquals(textField.getWrappedElement(), getFocusedElement());
// Closing window should focus button back(default behaviour)
focusBut.click();
openW.click();
$(WindowElement.class).first().close();
Thread.sleep(150);
assertEquals(openW, getFocusedElement());
}
}
|