aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/test/java/com/vaadin/tests/components/radiobuttongroup/RadioButtonGroupInGridLayoutTest.java
blob: a10e858377c608f8a6d2498f4f7e34ef981a8c94 (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
package com.vaadin.tests.components.radiobuttongroup;

import static org.junit.Assert.assertTrue;

import org.junit.Test;

import com.vaadin.testbench.elements.GridLayoutElement;
import com.vaadin.testbench.elements.RadioButtonGroupElement;
import com.vaadin.testbench.parallel.BrowserUtil;
import com.vaadin.tests.tb3.MultiBrowserTest;

public class RadioButtonGroupInGridLayoutTest extends MultiBrowserTest {

    @Test
    public void slotSizeRemainsUnchangedAfterSelectingItem() {
        openTestURL();
        GridLayoutElement gridLayout = $(GridLayoutElement.class).first();
        int before = gridLayout.getSize().getWidth();

        RadioButtonGroupElement radioButtonGroup = $(
                RadioButtonGroupElement.class).first();
        radioButtonGroup.setValue("A");
        int after = gridLayout.getSize().getWidth();

        boolean ok = (before == after);
        // also accept broken layout for unrelated bug #9921 until it is fixed
        if (!ok && BrowserUtil.isChrome(getDesiredCapabilities())) {
            ok = (before == after + 4);
        }

        assertTrue("GridLayout size changed when selecting a value", ok);
    }
}