Browse Source

Created constants for tested browser versions (#12786)

Change-Id: I8f349bb3c338bb7e9073944891436edac5ee1bb1
tags/7.1.8
Artur Signell 10 years ago
parent
commit
ce89a75620

+ 7
- 8
uitest/src/com/vaadin/tests/VerifyBrowserVersionTest.java View File

import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.remote.DesiredCapabilities;


import com.vaadin.tests.tb3.MultiBrowserTest; import com.vaadin.tests.tb3.MultiBrowserTest;
import com.vaadin.tests.tb3.AbstractTB3Test.BrowserUtil;


public class VerifyBrowserVersionTest extends MultiBrowserTest { public class VerifyBrowserVersionTest extends MultiBrowserTest {




{ {
expectedUserAgent expectedUserAgent
.put(BrowserUtil.firefox(24),
.put(BrowserUtil
.firefox(MultiBrowserTest.TESTED_FIREFOX_VERSION),
"Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Firefox/24.0"); "Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Firefox/24.0");
expectedUserAgent expectedUserAgent
.put(BrowserUtil.ie(8), .put(BrowserUtil.ie(8),
.put(BrowserUtil.ie(11), .put(BrowserUtil.ie(11),
"Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko"); "Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko");
expectedUserAgent expectedUserAgent
.put(BrowserUtil.chrome(29),
.put(BrowserUtil.chrome(MultiBrowserTest.TESTED_CHROME_VERSION),
"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.76 Safari/537.36"); "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.76 Safari/537.36");
expectedUserAgent
.put(BrowserUtil.opera(12),
"Opera/9.80 (Windows NT 5.1) Presto/2.12.388 Version/12.15");
expectedUserAgent.put(
BrowserUtil.opera(MultiBrowserTest.TESTED_OPERA_VERSION),
"Opera/9.80 (Windows NT 5.1) Presto/2.12.388 Version/12.15");


} }


@Test @Test
public void verifyUserAgent() { public void verifyUserAgent() {
openTestURL(); openTestURL();
Assert.assertEquals(
expectedUserAgent.get(getDesiredCapabilities()),
Assert.assertEquals(expectedUserAgent.get(getDesiredCapabilities()),
vaadinElementById("userAgent").getText()); vaadinElementById("userAgent").getText());
Assert.assertEquals("Touch device? No", Assert.assertEquals("Touch device? No",
vaadinElementById("touchDevice").getText()); vaadinElementById("touchDevice").getText());

+ 4
- 3
uitest/src/com/vaadin/tests/integration/AbstractIntegrationTest.java View File

import org.junit.runners.Parameterized.Parameters; import org.junit.runners.Parameterized.Parameters;
import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.remote.DesiredCapabilities;


import com.vaadin.tests.tb3.MultiBrowserTest;
import com.vaadin.tests.tb3.PrivateTB3Configuration; import com.vaadin.tests.tb3.PrivateTB3Configuration;


/** /**
* @author Vaadin Ltd * @author Vaadin Ltd
*/ */
@RunWith(IntegrationTestRunner.class) @RunWith(IntegrationTestRunner.class)
public abstract class AbstractIntegrationTest extends
PrivateTB3Configuration {
public abstract class AbstractIntegrationTest extends PrivateTB3Configuration {
@Override @Override
protected String getBaseURL() { protected String getBaseURL() {
String deploymentUrl = System.getProperty("deployment.url"); String deploymentUrl = System.getProperty("deployment.url");


@Parameters @Parameters
public static Collection<DesiredCapabilities> getBrowsersForTest() { public static Collection<DesiredCapabilities> getBrowsersForTest() {
return Collections.singleton(BrowserUtil.firefox(17));
return Collections.singleton(BrowserUtil
.firefox(MultiBrowserTest.TESTED_FIREFOX_VERSION));
} }


} }

+ 4
- 2
uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java View File

private boolean push = false; private boolean push = false;
{ {
// Default browser to run on unless setDesiredCapabilities is called // Default browser to run on unless setDesiredCapabilities is called
desiredCapabilities = BrowserUtil.firefox(24);
desiredCapabilities = BrowserUtil
.firefox(MultiBrowserTest.TESTED_FIREFOX_VERSION);
} }


/** /**
* @return The browsers to run the test on * @return The browsers to run the test on
*/ */
public Collection<DesiredCapabilities> getBrowsersToTest() { public Collection<DesiredCapabilities> getBrowsersToTest() {
return Collections.singleton(BrowserUtil.firefox(17));
return Collections.singleton(BrowserUtil
.firefox(MultiBrowserTest.TESTED_FIREFOX_VERSION));


} }



+ 9
- 4
uitest/src/com/vaadin/tests/tb3/MultiBrowserTest.java View File

*/ */
public abstract class MultiBrowserTest extends PrivateTB3Configuration { public abstract class MultiBrowserTest extends PrivateTB3Configuration {


public static final int TESTED_SAFARI_VERSION = 6;
public static final int TESTED_CHROME_VERSION = 29;
public static final int TESTED_FIREFOX_VERSION = 24;
public static final int TESTED_OPERA_VERSION = 12;

static List<DesiredCapabilities> allBrowsers = new ArrayList<DesiredCapabilities>(); static List<DesiredCapabilities> allBrowsers = new ArrayList<DesiredCapabilities>();
static { static {
allBrowsers.add(BrowserUtil.ie(8)); allBrowsers.add(BrowserUtil.ie(8));
allBrowsers.add(BrowserUtil.ie(9)); allBrowsers.add(BrowserUtil.ie(9));
allBrowsers.add(BrowserUtil.ie(10)); allBrowsers.add(BrowserUtil.ie(10));
allBrowsers.add(BrowserUtil.ie(11)); allBrowsers.add(BrowserUtil.ie(11));
allBrowsers.add(BrowserUtil.firefox(24));
allBrowsers.add(BrowserUtil.firefox(TESTED_FIREFOX_VERSION));
// Uncomment once we have the capability to run on Safari 6 // Uncomment once we have the capability to run on Safari 6
// allBrowsers.add(safari(6));
allBrowsers.add(BrowserUtil.chrome(29));
allBrowsers.add(BrowserUtil.opera(12));
// allBrowsers.add(safari(TESTED_SAFARI_VERSION));
allBrowsers.add(BrowserUtil.chrome(TESTED_CHROME_VERSION));
allBrowsers.add(BrowserUtil.opera(TESTED_OPERA_VERSION));


} }



Loading…
Cancel
Save