package com.vaadin.tests.components.flash;

import java.util.List;

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

import com.vaadin.testbench.elements.ButtonElement;
import com.vaadin.testbench.elements.FlashElement;
import com.vaadin.testbench.parallel.Browser;
import com.vaadin.tests.tb3.MultiBrowserTest;

public class FlashExpansionTest extends MultiBrowserTest {

    @Override
    public List<DesiredCapabilities> getBrowsersToTest() {
        return getBrowsersSupportingFlash();
    }

    private final By locator = By.tagName("embed");

    @Test
    public void testFlashIsExpanded() throws Exception {
        openTestURL();
        /* Allow the flash plugin to load */
        waitForElementPresent(locator);
        WebElement embed = $(FlashElement.class).first().findElement(locator);
        String width = embed.getAttribute("width");
        Assert.assertTrue("Width is not 400.0px initially",
                "400.0px".equals(width));
        $(ButtonElement.class).first().click();
        String widthAfterExpansion = embed.getAttribute("width");
        Assert.assertFalse("Width is still 400.0px after expansion",
                "400.0px".equals(widthAfterExpansion));
    }

    private List<DesiredCapabilities> getBrowsersSupportingFlash() {
        // No Flash support in Chrome, FF, PhantomJS
        return getBrowserCapabilities(Browser.IE8, Browser.IE9, Browser.IE10,
                Browser.IE11);
    }
}

@@ -1000,12 +1000,14 @@
 sert
-True
+Equals
 (%22Wi
@@ -1040,49 +1040,22 @@
 ly%22,
-%0A                %22400.0px%22.equals(
+ %22400%22, 
 width)
-)
 ;%0A  
@@ -1096,24 +1096,92 @@
 ().click();%0A
+        embed = $(FlashElement.class).first().findElement(locator);%0A
         Stri
@@ -1259,13 +1259,17 @@
 sert
-F
+NotEqu
 als
-e
 (%22Wi
@@ -1306,16 +1306,23 @@
 ansion%22,
+ %22400%22,
 %0A       
@@ -1334,25 +1334,8 @@
     
-%22400.0px%22.equals(
 widt
@@ -1350,17 +1350,16 @@
 pansion)
-)
 ;%0A    %7D%0A
@@ -1523,64 +1523,8 @@
 ies(
-Browser.IE8, Browser.IE9, Browser.IE10,%0A                
 Brow

Fix FlashExpansionTest (#8919)