blob: 01c83d6d982e9f36d8baf6b7c4707ae9cdfa9cc7 (
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.components.table;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import java.util.List;
import org.junit.Test;
import org.openqa.selenium.Keys;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.remote.DesiredCapabilities;
import com.vaadin.testbench.elements.TableElement;
import com.vaadin.testbench.elements.ButtonElement;
import com.vaadin.tests.tb3.MultiBrowserTest;
public class LongMultiselectTest extends MultiBrowserTest {
private int ROWCOUNT = 100;
private int FIRSTSELECTEDROW = 4;
private int LASTSELECTEDROW = 97;
@Override
public List<DesiredCapabilities> getBrowsersToTest() {
return getBrowsersSupportingShiftClick();
}
@Override
protected boolean requireWindowFocusForIE() {
return true;
}
@Test
public void selectedRowsAreUpdated() throws InterruptedException {
openTestURL();
selectRows();
$(ButtonElement.class).first().click();
TableElement table = getTable();
assertThat(table.getCell(LASTSELECTEDROW, 1).getText(), is("updated"));
assertThat(table.getCell(LASTSELECTEDROW - 1, 1).getText(),
is("updated"));
}
private void selectRows() {
TableElement table = getTable();
table.getCell(FIRSTSELECTEDROW, 0).click();
scrollToBottom();
new Actions(getDriver()).keyDown(Keys.SHIFT)
.click(getTable().getCell(LASTSELECTEDROW, 0)).keyUp(Keys.SHIFT)
.build().perform();
}
private TableElement getTable() {
return $(TableElement.class).first();
}
private void scrollToBottom() {
scrollTable(getTable(), ROWCOUNT, LASTSELECTEDROW);
}
}
|