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
|
package com.vaadin.tests.components.grid;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.WebElement;
import com.vaadin.testbench.By;
import com.vaadin.tests.tb3.MultiBrowserTest;
public class GridWithFullWidthComponentsTest extends MultiBrowserTest {
@Test
public void testResizeUpAndDown() {
openTestURL();
WebElement hScrollBar = findElement(
By.className("v-grid-scroller-horizontal"));
assertEquals("Unexpected horizontal scrollbar visibility", "none",
hScrollBar.getCssValue("display"));
// increase the browser size
getDriver().manage().window().setSize(new Dimension(2000, 850));
sleep(300);
assertEquals("Unexpected horizontal scrollbar visibility", "none",
hScrollBar.getCssValue("display"));
// scale back again
getDriver().manage().window().setSize(new Dimension(1500, 850));
sleep(300);
assertEquals("Unexpected horizontal scrollbar visibility", "none",
hScrollBar.getCssValue("display"));
}
@Test
public void testResizeDownAndUp() {
openTestURL();
WebElement hScrollBar = findElement(
By.className("v-grid-scroller-horizontal"));
assertEquals("Unexpected horizontal scrollbar visibility", "none",
hScrollBar.getCssValue("display"));
// decrease the browser size far enough that scrollbars are needed
getDriver().manage().window().setSize(new Dimension(800, 850));
sleep(300);
assertEquals("Unexpected horizontal scrollbar visibility", "block",
hScrollBar.getCssValue("display"));
// scale back again
getDriver().manage().window().setSize(new Dimension(1500, 850));
sleep(300);
assertEquals("Unexpected horizontal scrollbar visibility", "none",
hScrollBar.getCssValue("display"));
}
}
|