summaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/extensions/IframeIsOpenedInNonIOSTest.java
blob: c544b495ab6a91da5b89904766a88d668b5c4859 (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
package com.vaadin.tests.extensions;

import com.vaadin.testbench.By;
import com.vaadin.testbench.elements.ButtonElement;
import com.vaadin.tests.tb3.MultiBrowserTest;
import org.junit.Assert;
import org.junit.Test;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;

import java.util.List;

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);
        }

        Assert.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();
    }
}