aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/test/java/com/vaadin/tests/extensions/IframeIsOpenedInNonIOSTest.java
blob: 821d95a8a9b2926ccb3237bd60d5030c0ccd3d92 (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
44
package com.vaadin.tests.extensions;

import static org.junit.Assert.assertTrue;

import java.util.List;

import org.junit.Test;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;

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

public class IframeIsOpenedInNonIOSTest extends MultiBrowserTest {

    @Test
    public void fileOpenedInNewTab() {
        openTestURL();

        $(ButtonElement.class).caption("Download").first().click();

        List<WebElement> iframes = driver.findElements(By.tagName("iframe"));
        boolean containsFileIframe = false;
        for (WebElement iframe : iframes) {
            containsFileIframe = containsFileIframe | iframe.getAttribute("src")
                    .contains(IframeIsOpenedInNonIOS.FILE_NAME);
        }

        assertTrue("page doesn't contain iframe with the file",
                containsFileIframe);
    }

    @Override
    public List<DesiredCapabilities> getBrowsersToTest() {
        // once running ios is possible, this test should be fixed to exclude it
        // from the browsers list

        // The test is failing in all IEs for some reason even though the iframe
        // is in place.
        // Probably related to some IE driver issue
        return getBrowsersExcludingIE();
    }
}