blob: f485ae8ecf85ffe35f6d188a1cd6b90f921a0928 (
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
|
package com.vaadin.tests.components.table;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.fail;
import org.junit.Ignore;
import org.junit.Test;
import org.openqa.selenium.NoSuchElementException;
import com.vaadin.testbench.TestBenchElement;
import com.vaadin.testbench.elements.ButtonElement;
import com.vaadin.testbench.elements.TableElement;
import com.vaadin.tests.tb3.MultiBrowserTest;
@Ignore
// Enable after #15286 is fixed.
public class SetCurrentPageFirstItemIndexTest extends MultiBrowserTest {
@Test
public void currentPageIndexChangesTwice() {
openTestURL();
ButtonElement button = $(ButtonElement.class).first();
button.click(); // change to 20
button.click(); // change to 5
// When failing, the index stays on 20.
assertThatRowIsVisible(5);
}
private void assertThatRowIsVisible(int index) {
try {
TableElement table = $(TableElement.class).first();
TestBenchElement cell = table.getCell(index, 0);
assertThat(cell.getText(), is(Integer.toString(index + 1)));
} catch (NoSuchElementException e) {
fail(String.format("Can't locate row for index: %s", index));
}
}
}
|