aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/test/java/com/vaadin/tests/application/MissingHierarchyDetectionTest.java
blob: 6738c3a9a2bc2d072b176e10b929f4dea9185f08 (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
package com.vaadin.tests.application;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import org.junit.Test;
import org.openqa.selenium.By;

import com.vaadin.testbench.elements.ButtonElement;
import com.vaadin.testbench.elements.LabelElement;
import com.vaadin.tests.tb3.SingleBrowserTest;

public class MissingHierarchyDetectionTest extends SingleBrowserTest {
    @Test
    public void testMissingHierarchyDetection() {
        openTestURL();

        assertTrue(isElementPresent(By.id("label")));

        ButtonElement toggleProperly = $(ButtonElement.class)
                .caption("Toggle properly").first();

        toggleProperly.click();
        assertNoSystemNotifications();
        assertFalse(isElementPresent(By.id("label")));

        toggleProperly.click();
        assertNoSystemNotifications();
        assertTrue(isElementPresent(LabelElement.class));

        ButtonElement toggleImproperly = $(ButtonElement.class)
                .caption("Toggle improperly").first();
        toggleImproperly.click();
        assertSystemNotification();
    }
}