aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/test/java/com/vaadin/tests/layouts/UpdateComponentWithinExpandRatioTest.java
blob: c1b0bbd311e59213c0a0ce7eeace3ac506f059e4 (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
package com.vaadin.tests.layouts;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

import com.vaadin.testbench.elements.ButtonElement;
import com.vaadin.testbench.elements.ProgressBarElement;
import com.vaadin.tests.tb3.MultiBrowserTest;

public class UpdateComponentWithinExpandRatioTest extends MultiBrowserTest {

    @Test
    public void updateProgressShouldNotMoveButton() {
        openTestURL();
        waitUntilLoadingIndicatorNotVisible();
        ProgressBarElement pb = $(ProgressBarElement.class).first();
        ButtonElement button = $(ButtonElement.class).first();

        int initialX = button.getLocation().getX();
        int initialWidth = pb.getSize().getWidth();

        button.click();
        waitUntilLoadingIndicatorNotVisible();

        // allow small discrepancies
        assertEquals("Button's position changed unexpectedly", initialX,
                button.getLocation().getX(), 5);
        assertEquals("ProgressBar's width changed unexpectedly", initialWidth,
                pb.getSize().getWidth(), 5);
    }
}