blob: af5fe632c8967dff1be7d1035639c6a46a3a52dc (
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
|
package com.vaadin.tests.application;
import static org.junit.Assert.fail;
import java.util.Collections;
import java.util.List;
import org.junit.Assume;
import org.junit.Test;
import org.openqa.selenium.StaleElementReferenceException;
import org.openqa.selenium.remote.DesiredCapabilities;
import com.vaadin.testbench.elements.ButtonElement;
import com.vaadin.testbench.parallel.Browser;
import com.vaadin.testbench.parallel.BrowserUtil;
import com.vaadin.tests.tb3.SingleBrowserTest;
public class ResynchronizeUITest extends SingleBrowserTest {
@Test
public void ensureResynchronizeRecreatesDOM() {
Assume.assumeFalse("PhantomJS does not send onload events for styles",
BrowserUtil.isPhantomJS(getDesiredCapabilities()));
openTestURL();
ButtonElement button = $(ButtonElement.class).first();
button.click();
// Click causes repaint, after this the old button element should no
// longer be available
// Ensure that the theme has changed
waitForThemeToChange("runo");
try {
button.click();
fail("The old button element should have been removed by the click and replaced by a new one.");
} catch (StaleElementReferenceException e) {
// This is what should happen
}
}
}
|