blob: 8a0e597dd485f29197f8b3e4c98326b0808b470e (
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
package com.vaadin.tests.push;
import static org.junit.Assert.assertEquals;
import org.openqa.selenium.WebElement;
import com.vaadin.testbench.elements.NativeSelectElement;
import com.vaadin.testbench.parallel.TestCategory;
import com.vaadin.tests.tb3.MultiBrowserTest;
@TestCategory("push")
abstract class PushConfigurationTest extends MultiBrowserTest {
@Override
protected Class<?> getUIClass() {
return PushConfiguration.class;
}
@Override
public void setup() throws Exception {
super.setup();
setDebug(true);
openTestURL("restartApplication");
disablePush();
}
protected String getStatusText() {
WebElement statusLabel = vaadinElementById("status");
return statusLabel.getText();
}
protected void disablePush() throws InterruptedException {
getPushModeSelect().selectByText("Disabled");
int counter = getServerCounter();
sleep(2000);
assertEquals("Server count changed without push enabled", counter,
getServerCounter());
}
protected NativeSelectElement getPushModeSelect() {
return $(NativeSelectElement.class).caption("Push mode").first();
}
protected NativeSelectElement getTransportSelect() {
return $(NativeSelectElement.class).caption("Transport").first();
}
protected int getServerCounter() {
return Integer.parseInt(getServerCounterElement().getText());
}
protected WebElement getServerCounterElement() {
return vaadinElement(
"/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[5]/VLabel[0]");
}
protected void waitForServerCounterToUpdate() {
int counter = getServerCounter();
final int waitCounter = counter + 2;
waitUntil(input -> getServerCounter() >= waitCounter);
}
}
|