- Based on TB4 Parallel testing. - Browser setup no longer uses static capabilities. - Some code cleanup here and there. Change-Id: I5c419316cd36f4f5041eaa8da8fda3d8b46596c4tags/7.5.0.alpha1
@@ -27,6 +27,10 @@ | |||
<modules> | |||
<module organisation="com.vaadin" name="vaadin-testbench" | |||
resolver="vaadin-addons" /> | |||
<module organisation="com.vaadin" name="vaadin-testbench-core" | |||
resolver="vaadin-addons" /> | |||
<module organisation="com.vaadin" name="vaadin-testbench-api" | |||
resolver="vaadin-addons" /> | |||
<module organisation="com.vaadin" name="vaadin-buildhelpers" | |||
resolver="build-temp" /> | |||
<module organisation="com.vaadin" name="vaadin-shared" |
@@ -27,6 +27,8 @@ | |||
<!-- Base url where the testable application is deployed --> | |||
<property name="deployment.url" value="http://${test.integration.server}:8080" /> | |||
<!-- TestBench license parameter --> | |||
<property name="vaadin.testbench.developer.license" value="" /> | |||
<property name="report.dir" location="${integration_test.dir}/result/reports-integration" /> | |||
@@ -124,6 +126,7 @@ | |||
<jvmarg value="-Dserver-name=${server-name}" /> | |||
<jvmarg value="-Djava.awt.headless=true" /> | |||
<jvmarg value="-Ddemo.war=${demo.war}" /> | |||
<jvmarg value="-Dvaadin.testbench.developer.license=${vaadin.testbench.developer.license}" /> | |||
<test name="${junit.test.suite}" todir="${server.report.dir}" /> | |||
</junit> | |||
</target> |
@@ -1,6 +1,6 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE ivy-module [ | |||
<!ENTITY jetty.version "8.1.9.v20130131"> | |||
<!ENTITY jetty.version "8.1.12.v20130726"> | |||
]> | |||
<ivy-module version="2.0" | |||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
@@ -28,7 +28,7 @@ | |||
<dependency org="javax.validation" name="validation-api" | |||
rev="1.0.0.GA" conf="build,ide -> default,sources" /> | |||
<dependency org="org.hibernate" name="hibernate-validator" | |||
rev="4.2.0.Final" conf="build,ide -> default" /> | |||
rev="4.2.0.Final" conf="build,ide -> default" /> | |||
<!-- Google App Engine --> | |||
<dependency org="com.google.appengine" name="appengine-api-1.0-sdk" | |||
rev="1.2.1" conf="build-provided,ide -> default" /> | |||
@@ -74,11 +74,17 @@ | |||
</dependency> | |||
<!-- jetty-servlets needed by ProxyTest, but not by jetty-runner --> | |||
<dependency org="org.eclipse.jetty" name="jetty-servlets" | |||
rev="&jetty.version;" conf="ide, build-provided, jetty-run->default" /> | |||
rev="&jetty.version;" conf="ide, build-provided, jetty-run->default"> | |||
<exclude org="org.eclipse.jetty.orbit"></exclude> | |||
</dependency> | |||
<dependency org="org.eclipse.jetty" name="jetty-websocket" | |||
rev="&jetty.version;" conf="ide, jetty-run->default" /> | |||
rev="&jetty.version;" conf="ide, jetty-run->default"> | |||
<exclude org="org.eclipse.jetty.orbit"></exclude> | |||
</dependency> | |||
<dependency org="org.eclipse.jetty" name="jetty-webapp" | |||
rev="&jetty.version;" conf="ide, build-provided, jetty-run->default" /> | |||
rev="&jetty.version;" conf="ide, build-provided, jetty-run->default"> | |||
<exclude org="org.eclipse.jetty.orbit"></exclude> | |||
</dependency> | |||
<dependency org="org.mortbay.jetty" name="jetty-runner" | |||
rev="&jetty.version;" conf="ide, jetty-run->default"> | |||
<exclude org="org.eclipse.jetty.orbit"></exclude> | |||
@@ -86,31 +92,33 @@ | |||
<dependency org="junit" name="junit" rev="4.11" | |||
conf="build,ide -> default" /> | |||
<dependency org="org.hamcrest" name="hamcrest-all" rev="1.3" | |||
conf="build,ide->default" /> | |||
<dependency org="org.hamcrest" name="hamcrest-all" | |||
rev="1.3" conf="build,ide->default" /> | |||
<dependency org="com.jcraft" name="jsch" rev="0.1.50" | |||
conf="ide, build->default" /> | |||
<dependency org="commons-codec" name="commons-codec" | |||
rev="1.5" conf="build,ide->default" /> | |||
<dependency org="commons-io" name="commons-io" rev="${commons-io.version}" | |||
conf="build,ide->default" /> | |||
<dependency org="commons-io" name="commons-io" | |||
rev="${commons-io.version}" conf="build,ide->default" /> | |||
<!-- Mainly for SQLContainer tests --> | |||
<dependency org="org.hsqldb" name="hsqldb" rev="2.2.6" | |||
conf="build,ide -> default" /> | |||
<dependency org="com.vaadin" name="vaadin-testbench" | |||
rev="4.0.0.alpha1" conf="build-provided,ide -> default" /> | |||
rev="4.0.2" conf="build-provided,ide -> default" /> | |||
<!-- This should be removed once tests have been updated to use lang3 --> | |||
<dependency org="commons-lang" name="commons-lang" | |||
rev="2.6" conf="build,ide -> default" /> | |||
<dependency org="com.vaadin" name="vaadin-sass-compiler" | |||
<dependency org="com.vaadin" name="vaadin-sass-compiler" | |||
rev="${vaadin.sass.version}" conf="compile-theme->default" /> | |||
<dependency org="com.vaadin" name="vaadin-buildhelpers" | |||
rev="${vaadin.version}" conf="compile-theme->build" /> | |||
rev="${vaadin.version}" conf="compile-theme->build" /> | |||
<dependency org="org.eclipse.jgit" name="org.eclipse.jgit" | |||
rev="3.5.1.201410131835-r" conf="ide,build->default" /> | |||
<dependency org="org.eclipse.jgit" name="org.eclipse.jgit" | |||
rev="3.5.1.201410131835-r" conf="ide,build->default"> | |||
<exclude org="org.apache.httpcomponents"></exclude> | |||
</dependency> | |||
</dependencies> | |||
@@ -23,6 +23,8 @@ import org.openqa.selenium.WebElement; | |||
import com.vaadin.testbench.By; | |||
import com.vaadin.testbench.TestBenchElement; | |||
import com.vaadin.testbench.elementsbase.AbstractElement; | |||
import com.vaadin.testbench.elementsbase.ServerClass; | |||
/** | |||
* TestBench Element API for Grid |
@@ -19,28 +19,14 @@ import static org.hamcrest.CoreMatchers.containsString; | |||
import static org.hamcrest.CoreMatchers.is; | |||
import static org.hamcrest.MatcherAssert.assertThat; | |||
import java.util.HashMap; | |||
import java.util.Map; | |||
import org.junit.Test; | |||
import org.openqa.selenium.remote.DesiredCapabilities; | |||
import com.vaadin.testbench.parallel.BrowserUtil; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
public class VerifyBrowserVersionTest extends MultiBrowserTest { | |||
private Map<DesiredCapabilities, String> expectedUserAgent = new HashMap<DesiredCapabilities, String>(); | |||
{ | |||
expectedUserAgent.put(Browser.FIREFOX.getDesiredCapabilities(), "Firefox/"); | |||
expectedUserAgent.put(Browser.IE8.getDesiredCapabilities(), "MSIE "); | |||
expectedUserAgent.put(Browser.IE9.getDesiredCapabilities(), "MSIE "); | |||
expectedUserAgent.put(Browser.IE10.getDesiredCapabilities(), "MSIE "); | |||
expectedUserAgent.put(Browser.IE11.getDesiredCapabilities(), "Trident/7.0; rv:"); | |||
expectedUserAgent.put(Browser.CHROME.getDesiredCapabilities(), "Chrome/"); | |||
expectedUserAgent.put(Browser.PHANTOMJS.getDesiredCapabilities(), "PhantomJS/"); | |||
} | |||
@Test | |||
public void verifyUserAgent() { | |||
openTestURL(); | |||
@@ -48,11 +34,31 @@ public class VerifyBrowserVersionTest extends MultiBrowserTest { | |||
DesiredCapabilities desiredCapabilities = getDesiredCapabilities(); | |||
assertThat(vaadinElementById("userAgent").getText(), | |||
containsString(expectedUserAgent.get(desiredCapabilities) | |||
+ desiredCapabilities.getVersion())); | |||
containsString(getExpectedUserAgentString(desiredCapabilities) | |||
+ desiredCapabilities.getVersion())); | |||
assertThat(vaadinElementById("touchDevice").getText(), | |||
is("Touch device? No")); | |||
is("Touch device? No")); | |||
} | |||
private String getExpectedUserAgentString(DesiredCapabilities dCap) { | |||
if (BrowserUtil.isIE(dCap)) { | |||
if (!BrowserUtil.isIE(dCap, 11)) { | |||
// IE8-10 | |||
return "MSIE "; | |||
} else { | |||
// IE11 | |||
return "Trident/7.0; rv:"; | |||
} | |||
} else if (BrowserUtil.isFirefox(dCap)) { | |||
return "Firefox/"; | |||
} else if (BrowserUtil.isChrome(dCap)) { | |||
return "Chrome/"; | |||
} else if (BrowserUtil.isPhantomJS(dCap)) { | |||
return "PhantomJS/"; | |||
} | |||
throw new UnsupportedOperationException( | |||
"Test is being run on unknown browser."); | |||
} | |||
} |
@@ -7,6 +7,7 @@ import org.junit.Test; | |||
import org.openqa.selenium.interactions.Actions; | |||
import org.openqa.selenium.remote.DesiredCapabilities; | |||
import com.vaadin.testbench.parallel.Browser; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
public class ActionsOnInvisibleComponentsTest extends MultiBrowserTest { | |||
@@ -15,12 +16,8 @@ public class ActionsOnInvisibleComponentsTest extends MultiBrowserTest { | |||
// This method should be removed once #12785 is fixed | |||
@Override | |||
public List<DesiredCapabilities> getBrowsersToTest() { | |||
List<DesiredCapabilities> browsers = super.getBrowsersToTest(); | |||
// Send Keys does not function correctly on these browsers. | |||
browsers.remove(Browser.CHROME.getDesiredCapabilities()); | |||
browsers.remove(Browser.FIREFOX.getDesiredCapabilities()); | |||
browsers.remove(Browser.IE8.getDesiredCapabilities()); | |||
return browsers; | |||
return getBrowserCapabilities(Browser.IE9, Browser.IE10, Browser.IE11, | |||
Browser.PHANTOMJS); | |||
} | |||
@Test |
@@ -1,31 +0,0 @@ | |||
/* | |||
* Copyright 2000-2014 Vaadin Ltd. | |||
* | |||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | |||
* use this file except in compliance with the License. You may obtain a copy of | |||
* the License at | |||
* | |||
* http://www.apache.org/licenses/LICENSE-2.0 | |||
* | |||
* Unless required by applicable law or agreed to in writing, software | |||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | |||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | |||
* License for the specific language governing permissions and limitations under | |||
* the License. | |||
*/ | |||
package com.vaadin.tests.annotations; | |||
import java.lang.annotation.ElementType; | |||
import java.lang.annotation.Inherited; | |||
import java.lang.annotation.Retention; | |||
import java.lang.annotation.RetentionPolicy; | |||
import java.lang.annotation.Target; | |||
@Retention(RetentionPolicy.RUNTIME) | |||
@Target(ElementType.TYPE) | |||
@Inherited | |||
public @interface TestCategory { | |||
String value(); | |||
} |
@@ -15,7 +15,6 @@ | |||
*/ | |||
package com.vaadin.tests.applicationservlet; | |||
import java.util.Collections; | |||
import java.util.List; | |||
import org.junit.Assert; | |||
@@ -23,6 +22,7 @@ import org.junit.Test; | |||
import org.openqa.selenium.By; | |||
import org.openqa.selenium.remote.DesiredCapabilities; | |||
import com.vaadin.testbench.parallel.Browser; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
public class NoApplicationClassTest extends MultiBrowserTest { | |||
@@ -38,8 +38,7 @@ public class NoApplicationClassTest extends MultiBrowserTest { | |||
@Override | |||
public List<DesiredCapabilities> getBrowsersToTest() { | |||
return Collections.singletonList(Browser.CHROME | |||
.getDesiredCapabilities()); | |||
return getBrowserCapabilities(Browser.CHROME); | |||
} | |||
@Override |
@@ -25,6 +25,7 @@ import org.junit.Test; | |||
import org.openqa.selenium.WebElement; | |||
import com.vaadin.testbench.By; | |||
import com.vaadin.testbench.parallel.BrowserUtil; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
/** |
@@ -15,7 +15,6 @@ | |||
*/ | |||
package com.vaadin.tests.components; | |||
import java.util.Collections; | |||
import java.util.List; | |||
import org.junit.Assert; | |||
@@ -24,6 +23,7 @@ import org.openqa.selenium.By; | |||
import org.openqa.selenium.WebElement; | |||
import org.openqa.selenium.remote.DesiredCapabilities; | |||
import com.vaadin.testbench.parallel.Browser; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
public class SaneErrorsTest extends MultiBrowserTest { | |||
@@ -35,7 +35,7 @@ public class SaneErrorsTest extends MultiBrowserTest { | |||
*/ | |||
@Override | |||
public List<DesiredCapabilities> getBrowsersToTest() { | |||
return Collections.singletonList(DesiredCapabilities.firefox()); | |||
return getBrowserCapabilities(Browser.FIREFOX); | |||
} | |||
@Test |
@@ -23,6 +23,7 @@ import org.openqa.selenium.By; | |||
import org.openqa.selenium.StaleElementReferenceException; | |||
import org.openqa.selenium.WebElement; | |||
import com.vaadin.testbench.parallel.BrowserUtil; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
/** |
@@ -25,6 +25,7 @@ import org.openqa.selenium.interactions.Actions; | |||
import com.vaadin.testbench.By; | |||
import com.vaadin.testbench.commands.TestBenchElementCommands; | |||
import com.vaadin.testbench.elements.ComboBoxElement; | |||
import com.vaadin.testbench.parallel.BrowserUtil; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
/** |
@@ -15,7 +15,6 @@ | |||
*/ | |||
package com.vaadin.tests.components.combobox; | |||
import java.util.Collections; | |||
import java.util.List; | |||
import org.junit.Assert; | |||
@@ -26,6 +25,7 @@ import org.openqa.selenium.WebElement; | |||
import org.openqa.selenium.interactions.Actions; | |||
import org.openqa.selenium.remote.DesiredCapabilities; | |||
import com.vaadin.testbench.parallel.Browser; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
/** | |||
@@ -67,6 +67,6 @@ public class ComboboxPageLengthZeroScrollTest extends MultiBrowserTest { | |||
@Override | |||
public List<DesiredCapabilities> getBrowsersToTest() { | |||
return Collections.singletonList(Browser.IE8.getDesiredCapabilities()); | |||
return getBrowserCapabilities(Browser.IE8); | |||
} | |||
} |
@@ -16,7 +16,6 @@ | |||
package com.vaadin.tests.components.datefield; | |||
import java.io.IOException; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import org.junit.Assert; | |||
@@ -33,13 +32,7 @@ public class DisabledDateFieldPopupTest extends MultiBrowserTest { | |||
@Override | |||
public List<DesiredCapabilities> getBrowsersToTest() { | |||
List<DesiredCapabilities> browsers = new ArrayList<DesiredCapabilities>(); | |||
for (DesiredCapabilities browser : super.getBrowsersToTest()) { | |||
if (BrowserUtil.isIE(browser)) { | |||
browsers.add(browser); | |||
} | |||
} | |||
return browsers; | |||
return getIEBrowsersOnly(); | |||
} | |||
@Test |
@@ -20,6 +20,7 @@ import static org.junit.Assert.assertEquals; | |||
import org.junit.Test; | |||
import org.openqa.selenium.By; | |||
import com.vaadin.testbench.parallel.BrowserUtil; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
public class LocaleChangeTest extends MultiBrowserTest { |
@@ -31,6 +31,7 @@ import org.openqa.selenium.interactions.Actions; | |||
import com.vaadin.testbench.By; | |||
import com.vaadin.testbench.elements.ButtonElement; | |||
import com.vaadin.testbench.elements.DateFieldElement; | |||
import com.vaadin.testbench.parallel.BrowserUtil; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
/** | |||
@@ -405,9 +406,8 @@ public class PopupDateFieldExtendedRangeTest extends MultiBrowserTest { | |||
new Actions(driver).keyUp(Keys.SHIFT).perform(); | |||
// TODO: remove this once #14406 has been fixed | |||
if (!getBrowsersExcludingIE().contains(getDesiredCapabilities()) | |||
&& !Browser.IE8.getDesiredCapabilities().equals( | |||
getDesiredCapabilities())) { | |||
if (BrowserUtil.isIE(getDesiredCapabilities()) | |||
&& !BrowserUtil.isIE8(getDesiredCapabilities())) { | |||
popup.findElement( | |||
By.className("v-datefield-calendarpanel-prevmonth")) | |||
.findElement(By.tagName("button")).click(); | |||
@@ -435,9 +435,8 @@ public class PopupDateFieldExtendedRangeTest extends MultiBrowserTest { | |||
.size()); | |||
// TODO: remove this check once #14406 has been fixed -- clicking the | |||
// button instead of navigating with arrow keys steals the focus | |||
if (getBrowsersExcludingIE().contains(getDesiredCapabilities()) | |||
|| Browser.IE8.getDesiredCapabilities().equals( | |||
getDesiredCapabilities())) { | |||
if (!BrowserUtil.isIE(getDesiredCapabilities()) | |||
|| BrowserUtil.isIE8(getDesiredCapabilities())) { | |||
assertEquals( | |||
"unexpected focus", | |||
"16", |
@@ -20,7 +20,7 @@ import static org.hamcrest.Matchers.is; | |||
import static org.junit.Assert.assertFalse; | |||
import static org.junit.Assert.assertTrue; | |||
import java.util.Arrays; | |||
import java.util.Collections; | |||
import java.util.List; | |||
import org.junit.Before; | |||
@@ -33,9 +33,10 @@ import org.openqa.selenium.support.ui.ExpectedCondition; | |||
import com.vaadin.testbench.elements.ButtonElement; | |||
import com.vaadin.testbench.elements.EmbeddedElement; | |||
import com.vaadin.testbench.elements.ImageElement; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
import com.vaadin.testbench.parallel.Browser; | |||
import com.vaadin.tests.tb3.SingleBrowserTest; | |||
import com.vaadin.ui.Embedded; | |||
import com.vaadin.ui.Image; | |||
/** | |||
* Tests that {@link Embedded} uses correct theme when the theme is set with | |||
@@ -50,7 +51,7 @@ public class EmbeddedThemeResourceTest extends SingleBrowserTest { | |||
public List<DesiredCapabilities> getBrowsersToTest() { | |||
// Seems like stylesheet onload is not fired on PhantomJS | |||
// https://github.com/ariya/phantomjs/issues/12332 | |||
return Arrays.asList(MultiBrowserTest.Browser.FIREFOX | |||
return Collections.singletonList(Browser.FIREFOX | |||
.getDesiredCapabilities()); | |||
} | |||
@@ -24,7 +24,8 @@ import org.junit.Test; | |||
import org.openqa.selenium.By; | |||
import org.openqa.selenium.WebElement; | |||
import com.vaadin.tests.annotations.TestCategory; | |||
import com.vaadin.testbench.parallel.BrowserUtil; | |||
import com.vaadin.testbench.parallel.TestCategory; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
@SuppressWarnings("boxing") |
@@ -23,7 +23,7 @@ import org.junit.Test; | |||
import com.vaadin.testbench.elements.GridElement; | |||
import com.vaadin.testbench.elements.LabelElement; | |||
import com.vaadin.tests.annotations.TestCategory; | |||
import com.vaadin.testbench.parallel.TestCategory; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
@TestCategory("grid") |
@@ -20,7 +20,7 @@ import org.junit.Test; | |||
import com.vaadin.testbench.By; | |||
import com.vaadin.testbench.elements.GridElement; | |||
import com.vaadin.tests.annotations.TestCategory; | |||
import com.vaadin.testbench.parallel.TestCategory; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
@TestCategory("grid") |
@@ -20,7 +20,7 @@ import org.junit.Test; | |||
import com.vaadin.testbench.elements.ButtonElement; | |||
import com.vaadin.testbench.elements.GridElement; | |||
import com.vaadin.tests.annotations.TestCategory; | |||
import com.vaadin.testbench.parallel.TestCategory; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
@TestCategory("grid") |
@@ -33,8 +33,9 @@ import com.vaadin.testbench.elements.GridElement.GridCellElement; | |||
import com.vaadin.testbench.elements.LabelElement; | |||
import com.vaadin.testbench.elements.NativeButtonElement; | |||
import com.vaadin.testbench.elements.NativeSelectElement; | |||
import com.vaadin.testbench.elements.ServerClass; | |||
import com.vaadin.tests.annotations.TestCategory; | |||
import com.vaadin.testbench.elementsbase.ServerClass; | |||
import com.vaadin.testbench.parallel.BrowserUtil; | |||
import com.vaadin.testbench.parallel.TestCategory; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
import com.vaadin.tests.widgetset.client.grid.GridClientColumnRendererConnector.Renderers; | |||
import com.vaadin.tests.widgetset.server.grid.GridClientColumnRenderers; |
@@ -25,7 +25,7 @@ import org.openqa.selenium.By; | |||
import com.vaadin.testbench.elements.ButtonElement; | |||
import com.vaadin.testbench.elements.GridElement; | |||
import com.vaadin.testbench.elements.GridElement.GridCellElement; | |||
import com.vaadin.tests.annotations.TestCategory; | |||
import com.vaadin.testbench.parallel.TestCategory; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
@TestCategory("grid") |
@@ -15,7 +15,7 @@ | |||
*/ | |||
package com.vaadin.tests.components.grid; | |||
import com.vaadin.tests.annotations.TestCategory; | |||
import com.vaadin.testbench.parallel.TestCategory; | |||
@TestCategory("grid") | |||
public class GridColumnAutoWidthClientTest extends |
@@ -15,7 +15,7 @@ | |||
*/ | |||
package com.vaadin.tests.components.grid; | |||
import com.vaadin.tests.annotations.TestCategory; | |||
import com.vaadin.testbench.parallel.TestCategory; | |||
@TestCategory("grid") | |||
public class GridColumnAutoWidthServerTest extends |
@@ -26,7 +26,7 @@ import com.vaadin.testbench.elements.GridElement; | |||
import com.vaadin.testbench.elements.GridElement.GridCellElement; | |||
import com.vaadin.testbench.elements.NotificationElement; | |||
import com.vaadin.testbench.elements.PasswordFieldElement; | |||
import com.vaadin.tests.annotations.TestCategory; | |||
import com.vaadin.testbench.parallel.TestCategory; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
@TestCategory("grid") |
@@ -24,7 +24,7 @@ import org.junit.Test; | |||
import com.vaadin.testbench.elements.GridElement; | |||
import com.vaadin.testbench.elements.GridElement.GridCellElement; | |||
import com.vaadin.testbench.elements.NotificationElement; | |||
import com.vaadin.tests.annotations.TestCategory; | |||
import com.vaadin.testbench.parallel.TestCategory; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
@TestCategory("grid") |
@@ -23,7 +23,7 @@ import org.openqa.selenium.WebElement; | |||
import com.vaadin.testbench.elements.ButtonElement; | |||
import com.vaadin.testbench.elements.GridElement; | |||
import com.vaadin.testbench.elements.GridElement.GridCellElement; | |||
import com.vaadin.tests.annotations.TestCategory; | |||
import com.vaadin.testbench.parallel.TestCategory; | |||
import com.vaadin.tests.tb3.SingleBrowserTest; | |||
@TestCategory("grid") |
@@ -24,7 +24,7 @@ import com.vaadin.testbench.elements.ButtonElement; | |||
import com.vaadin.testbench.elements.GridElement; | |||
import com.vaadin.testbench.elements.NotificationElement; | |||
import com.vaadin.testbench.elements.TabSheetElement; | |||
import com.vaadin.tests.annotations.TestCategory; | |||
import com.vaadin.testbench.parallel.TestCategory; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
@TestCategory("grid") |
@@ -21,7 +21,7 @@ import org.junit.Test; | |||
import com.vaadin.testbench.elements.GridElement; | |||
import com.vaadin.testbench.elements.GridElement.GridCellElement; | |||
import com.vaadin.testbench.elements.NotificationElement; | |||
import com.vaadin.tests.annotations.TestCategory; | |||
import com.vaadin.testbench.parallel.TestCategory; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
@TestCategory("grid") |
@@ -22,7 +22,7 @@ import org.junit.Test; | |||
import org.openqa.selenium.By; | |||
import org.openqa.selenium.WebElement; | |||
import com.vaadin.tests.annotations.TestCategory; | |||
import com.vaadin.testbench.parallel.TestCategory; | |||
import com.vaadin.tests.tb3.SingleBrowserTest; | |||
@TestCategory("grid") |
@@ -23,7 +23,7 @@ import org.openqa.selenium.WebElement; | |||
import com.vaadin.testbench.elements.GridElement; | |||
import com.vaadin.testbench.elements.NotificationElement; | |||
import com.vaadin.tests.annotations.TestCategory; | |||
import com.vaadin.testbench.parallel.TestCategory; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
@TestCategory("grid") |
@@ -15,22 +15,23 @@ | |||
*/ | |||
package com.vaadin.tests.components.grid; | |||
import com.vaadin.testbench.By; | |||
import com.vaadin.testbench.elements.ButtonElement; | |||
import com.vaadin.testbench.elements.GridElement; | |||
import com.vaadin.testbench.elements.GridElement.GridCellElement; | |||
import com.vaadin.testbench.elements.NotificationElement; | |||
import com.vaadin.tests.annotations.TestCategory; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
import static org.junit.Assert.assertFalse; | |||
import static org.junit.Assert.assertNotEquals; | |||
import static org.junit.Assert.assertTrue; | |||
import org.junit.Test; | |||
import org.openqa.selenium.WebDriver; | |||
import org.openqa.selenium.WebElement; | |||
import org.openqa.selenium.interactions.Actions; | |||
import org.openqa.selenium.support.ui.ExpectedCondition; | |||
import static org.junit.Assert.assertFalse; | |||
import static org.junit.Assert.assertNotEquals; | |||
import static org.junit.Assert.assertTrue; | |||
import com.vaadin.testbench.By; | |||
import com.vaadin.testbench.elements.ButtonElement; | |||
import com.vaadin.testbench.elements.GridElement; | |||
import com.vaadin.testbench.elements.GridElement.GridCellElement; | |||
import com.vaadin.testbench.elements.NotificationElement; | |||
import com.vaadin.testbench.parallel.TestCategory; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
/** | |||
* TB tests for the various builtin widget-based renderers. | |||
@@ -97,7 +98,8 @@ public class WidgetRenderersTest extends MultiBrowserTest { | |||
waitUntilmageSrcEndsWith(image, "window/img/maximize.png"); | |||
} | |||
private void waitUntilmageSrcEndsWith(final WebElement image, final String expectedText) { | |||
private void waitUntilmageSrcEndsWith(final WebElement image, | |||
final String expectedText) { | |||
waitUntil(new ExpectedCondition<Boolean>() { | |||
@Override | |||
@@ -108,8 +110,9 @@ public class WidgetRenderersTest extends MultiBrowserTest { | |||
@Override | |||
public String toString() { | |||
// Timed out after 10 seconds waiting for ... | |||
return String.format("image source to update. Supposed to end with '%s' (was: '%s').", | |||
expectedText, image.getAttribute("src")); | |||
return String | |||
.format("image source to update. Supposed to end with '%s' (was: '%s').", | |||
expectedText, image.getAttribute("src")); | |||
} | |||
}); | |||
} |
@@ -26,7 +26,7 @@ import org.openqa.selenium.WebElement; | |||
import org.openqa.selenium.interactions.Actions; | |||
import com.vaadin.testbench.TestBenchElement; | |||
import com.vaadin.tests.annotations.TestCategory; | |||
import com.vaadin.testbench.parallel.TestCategory; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
@TestCategory("escalator") |
@@ -24,7 +24,7 @@ import com.vaadin.testbench.TestBenchElement; | |||
import com.vaadin.testbench.elements.GridElement; | |||
/** | |||
* Variant of GridBasicFeaturesTest to be used with GridBasicClientFeatures. | |||
* GridBasicClientFeatures. | |||
* | |||
* @since | |||
* @author Vaadin Ltd | |||
@@ -83,8 +83,7 @@ public abstract class GridBasicClientFeaturesTest extends GridBasicFeaturesTest | |||
if (composite) { | |||
// Composite requires the basic client features widget for subparts | |||
return ((TestBenchElement) findElement(By | |||
.vaadin("//TestWidgetComponent"))) | |||
.wrap(GridElement.class); | |||
.vaadin("//TestWidgetComponent"))).wrap(GridElement.class); | |||
} else { | |||
return super.getGridElement(); | |||
} |
@@ -23,23 +23,18 @@ import org.openqa.selenium.JavascriptExecutor; | |||
import org.openqa.selenium.WebDriver; | |||
import org.openqa.selenium.WebElement; | |||
import org.openqa.selenium.interactions.Actions; | |||
import org.openqa.selenium.remote.DesiredCapabilities; | |||
import com.vaadin.testbench.TestBenchElement; | |||
import com.vaadin.testbench.elements.GridElement; | |||
import com.vaadin.tests.annotations.TestCategory; | |||
import com.vaadin.testbench.parallel.TestCategory; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
@TestCategory("grid") | |||
public abstract class GridBasicFeaturesTest extends MultiBrowserTest { | |||
@Override | |||
protected DesiredCapabilities getDesiredCapabilities() { | |||
DesiredCapabilities dCap = super.getDesiredCapabilities(); | |||
if (BrowserUtil.isIE(dCap)) { | |||
dCap.setCapability("requireWindowFocus", true); | |||
} | |||
return super.getDesiredCapabilities(); | |||
protected boolean requireWindowFocusForIE() { | |||
return true; | |||
} | |||
@Override |
@@ -27,7 +27,7 @@ import org.openqa.selenium.WebDriver; | |||
import org.openqa.selenium.WebElement; | |||
import org.openqa.selenium.interactions.Actions; | |||
import com.vaadin.tests.annotations.TestCategory; | |||
import com.vaadin.testbench.parallel.TestCategory; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
@TestCategory("grid") |
@@ -3,7 +3,7 @@ package com.vaadin.tests.components.grid.basicfeatures; | |||
import org.junit.Test; | |||
import org.openqa.selenium.By; | |||
import com.vaadin.tests.annotations.TestCategory; | |||
import com.vaadin.testbench.parallel.TestCategory; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
@SuppressWarnings("all") |
@@ -25,8 +25,8 @@ import org.junit.Test; | |||
import com.vaadin.testbench.By; | |||
import com.vaadin.testbench.elements.GridElement; | |||
import com.vaadin.testbench.elements.NotificationElement; | |||
import com.vaadin.testbench.elements.ServerClass; | |||
import com.vaadin.tests.annotations.TestCategory; | |||
import com.vaadin.testbench.elementsbase.ServerClass; | |||
import com.vaadin.testbench.parallel.TestCategory; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
@TestCategory("grid") |
@@ -3,7 +3,7 @@ package com.vaadin.tests.components.grid.basicfeatures; | |||
import org.junit.Test; | |||
import com.vaadin.testbench.elements.GridElement; | |||
import com.vaadin.tests.annotations.TestCategory; | |||
import com.vaadin.testbench.parallel.TestCategory; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
@SuppressWarnings("all") |
@@ -20,10 +20,8 @@ import java.io.IOException; | |||
import org.junit.Test; | |||
import com.vaadin.testbench.elements.ButtonElement; | |||
import com.vaadin.tests.annotations.TestCategory; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
@TestCategory("grid") | |||
public class GridSortingIndicatorsTest extends MultiBrowserTest { | |||
@Test | |||
@@ -35,5 +33,4 @@ public class GridSortingIndicatorsTest extends MultiBrowserTest { | |||
compareScreen("reversedSort"); | |||
} | |||
} |
@@ -32,11 +32,7 @@ public class GridMultiSortingTest extends GridBasicFeaturesTest { | |||
@Override | |||
public List<DesiredCapabilities> getBrowsersToTest() { | |||
List<DesiredCapabilities> browsersToTest = super.getBrowsersToTest(); | |||
/* FireFox and PhantomJS don't know how to press Shift key... */ | |||
browsersToTest.remove(Browser.FIREFOX.getDesiredCapabilities()); | |||
browsersToTest.remove(Browser.PHANTOMJS.getDesiredCapabilities()); | |||
return browsersToTest; | |||
return super.getBrowsersSupportingShiftClick(); | |||
} | |||
@Test |
@@ -33,11 +33,9 @@ import com.vaadin.shared.data.sort.SortDirection; | |||
import com.vaadin.testbench.By; | |||
import com.vaadin.testbench.elements.GridElement; | |||
import com.vaadin.testbench.elements.GridElement.GridCellElement; | |||
import com.vaadin.tests.annotations.TestCategory; | |||
import com.vaadin.tests.components.grid.basicfeatures.GridBasicFeatures; | |||
import com.vaadin.tests.components.grid.basicfeatures.GridBasicFeaturesTest; | |||
@TestCategory("grid") | |||
public class GridSortingTest extends GridBasicFeaturesTest { | |||
private static class SortInfo { |
@@ -25,6 +25,7 @@ import org.openqa.selenium.WebElement; | |||
import com.vaadin.testbench.elements.CheckBoxElement; | |||
import com.vaadin.testbench.elements.CssLayoutElement; | |||
import com.vaadin.testbench.elements.GridLayoutElement; | |||
import com.vaadin.testbench.parallel.BrowserUtil; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
public class GridLayoutExtraSpacingTest extends MultiBrowserTest { |
@@ -29,23 +29,11 @@ import org.openqa.selenium.support.ui.WebDriverWait; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
/** | |||
* | |||
* @since | |||
* @author Vaadin Ltd | |||
*/ | |||
public class JavaScriptPreloadingTest extends MultiBrowserTest { | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see com.vaadin.tests.tb3.MultiBrowserTest#getBrowsersToTest() | |||
*/ | |||
@Override | |||
public List<DesiredCapabilities> getBrowsersToTest() { | |||
List<DesiredCapabilities> browsers = super.getBrowsersToTest(); | |||
browsers.remove(Browser.PHANTOMJS.getDesiredCapabilities()); | |||
return browsers; | |||
return getBrowsersExcludingPhantomJS(); | |||
} | |||
@Test |
@@ -41,11 +41,8 @@ public class MenuBarTooltipsNearEdgeTest extends MultiBrowserTest { | |||
@Override | |||
public List<DesiredCapabilities> getBrowsersToTest() { | |||
// Tooltip tests work unreliably on IE due to an issue with the | |||
// WebDriver (see #13854) | |||
List<DesiredCapabilities> browsers = super.getBrowsersToTest(); | |||
browsers.remove(Browser.IE8.getDesiredCapabilities()); | |||
return browsers; | |||
// Tooltip test is unreliable on IE8 | |||
return getBrowsersExcludingIE8(); | |||
}; | |||
@Test | |||
@@ -59,6 +56,5 @@ public class MenuBarTooltipsNearEdgeTest extends MultiBrowserTest { | |||
WebElement tooltip = getTooltipElement(); | |||
assertThat(tooltip.getLocation().x, is(lessThan(menuLocation.onPage().x | |||
- tooltip.getSize().getWidth()))); | |||
} | |||
} |
@@ -15,7 +15,6 @@ | |||
*/ | |||
package com.vaadin.tests.components.nativeselect; | |||
import java.util.Collections; | |||
import java.util.List; | |||
import org.junit.Assert; | |||
@@ -26,25 +25,15 @@ import org.openqa.selenium.WebElement; | |||
import org.openqa.selenium.interactions.Actions; | |||
import org.openqa.selenium.remote.DesiredCapabilities; | |||
import com.vaadin.testbench.parallel.Browser; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
/** | |||
* | |||
* @since | |||
* @author Vaadin Ltd | |||
*/ | |||
public class NativeSelectsAndChromeKeyboardNavigationTest extends | |||
MultiBrowserTest { | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see com.vaadin.tests.tb3.MultiBrowserTest#getBrowsersToTest() | |||
*/ | |||
@Override | |||
public List<DesiredCapabilities> getBrowsersToTest() { | |||
return Collections.singletonList(Browser.CHROME | |||
.getDesiredCapabilities()); | |||
return getBrowserCapabilities(Browser.CHROME); | |||
} | |||
@Test | |||
@@ -72,30 +61,17 @@ public class NativeSelectsAndChromeKeyboardNavigationTest extends | |||
} | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see com.vaadin.tests.tb3.AbstractTB3Test#getUIClass() | |||
*/ | |||
@Override | |||
protected Class<?> getUIClass() { | |||
return NativeSelects.class; | |||
} | |||
/** | |||
* @since | |||
* @param string | |||
*/ | |||
private void menuSub(String string) { | |||
getDriver().findElement(By.xpath("//span[text() = '" + string + "']")) | |||
.click(); | |||
new Actions(getDriver()).moveByOffset(100, 0).build().perform(); | |||
} | |||
/** | |||
* @since | |||
* @param string | |||
*/ | |||
private void menu(String string) { | |||
getDriver().findElement(By.xpath("//span[text() = '" + string + "']")) | |||
.click(); |
@@ -21,6 +21,7 @@ import org.openqa.selenium.By; | |||
import org.openqa.selenium.interactions.Actions; | |||
import com.vaadin.testbench.elements.NativeSelectElement; | |||
import com.vaadin.testbench.parallel.BrowserUtil; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
public class NativeSelectsFocusAndBlurListenerTests extends MultiBrowserTest { |
@@ -31,7 +31,7 @@ import com.vaadin.tests.tb3.MultiBrowserTest; | |||
/** | |||
* Unit test class for Notification ARIA (Accessible Rich Internet Applications) | |||
* roles. | |||
* | |||
* | |||
* @since 7.2 | |||
* @author Vaadin Ltd | |||
*/ | |||
@@ -39,7 +39,7 @@ public class NotificationsWaiAriaTest extends MultiBrowserTest { | |||
/** | |||
* Checks if the ARIA roles are correctly applied to Notification. | |||
* | |||
* | |||
* @since 7.2 | |||
* @throws Exception | |||
*/ | |||
@@ -80,10 +80,7 @@ public class NotificationsWaiAriaTest extends MultiBrowserTest { | |||
Assert.assertTrue("Expected '- press ESC to close', found " + text, | |||
text.equals("- press ESC to close")); | |||
try { | |||
notification.closeNotification(); | |||
} catch (Exception e) { | |||
} | |||
notification.close(); | |||
type.selectByText(StringToEnumConverter.enumToString( | |||
NotificationRole.STATUS, null)); | |||
@@ -97,10 +94,7 @@ public class NotificationsWaiAriaTest extends MultiBrowserTest { | |||
Assert.assertTrue("Expected attribute 'role' to equal 'status', found " | |||
+ text, text.equals("status")); | |||
try { | |||
notification.closeNotification(); | |||
} catch (Exception e) { | |||
} | |||
notification.close(); | |||
prefix.clear(); | |||
postfix.clear(); |
@@ -19,6 +19,7 @@ import org.junit.Test; | |||
import org.openqa.selenium.By; | |||
import com.vaadin.testbench.elements.ButtonElement; | |||
import com.vaadin.testbench.parallel.BrowserUtil; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
public class CaptionLeakTest extends MultiBrowserTest { |
@@ -24,6 +24,7 @@ import org.openqa.selenium.interactions.Actions; | |||
import org.openqa.selenium.remote.DesiredCapabilities; | |||
import com.vaadin.testbench.By; | |||
import com.vaadin.testbench.parallel.BrowserUtil; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
public class VerticalLayoutFocusWithDOMChangesTest extends MultiBrowserTest { | |||
@@ -54,8 +55,8 @@ public class VerticalLayoutFocusWithDOMChangesTest extends MultiBrowserTest { | |||
Assert.assertEquals("Just a button", activeElement.getText()); | |||
DesiredCapabilities capabilities = getDesiredCapabilities(); | |||
if (capabilities.equals(BrowserUtil.ie(8)) | |||
|| capabilities.equals(BrowserUtil.ie(9))) { | |||
if (BrowserUtil.isIE8(capabilities) | |||
|| BrowserUtil.isIE(capabilities, 9)) { | |||
// IE8 and IE9 insert cursor in the start of input instead of end. | |||
Assert.assertEquals(incrementalText + initialText, | |||
tf1.getAttribute("value")); | |||
@@ -86,8 +87,8 @@ public class VerticalLayoutFocusWithDOMChangesTest extends MultiBrowserTest { | |||
new Actions(getDriver()).sendKeys(secondText).build().perform(); | |||
DesiredCapabilities capabilities = getDesiredCapabilities(); | |||
if (capabilities.equals(BrowserUtil.ie(8)) | |||
|| capabilities.equals(BrowserUtil.ie(9))) { | |||
if (BrowserUtil.isIE8(capabilities) | |||
|| BrowserUtil.isIE(capabilities, 9)) { | |||
// IE8 and IE9 insert cursor in the start of input instead of end. | |||
Assert.assertEquals(secondText + firstText, | |||
tf2.getAttribute("value")); | |||
@@ -96,5 +97,4 @@ public class VerticalLayoutFocusWithDOMChangesTest extends MultiBrowserTest { | |||
tf2.getAttribute("value")); | |||
} | |||
} | |||
} |
@@ -20,7 +20,6 @@ import static org.hamcrest.Matchers.greaterThan; | |||
import static org.hamcrest.Matchers.is; | |||
import static org.hamcrest.Matchers.lessThan; | |||
import java.util.Collections; | |||
import java.util.List; | |||
import org.junit.Test; | |||
@@ -32,6 +31,7 @@ import org.openqa.selenium.remote.DesiredCapabilities; | |||
import com.vaadin.testbench.elements.ButtonElement; | |||
import com.vaadin.testbench.elements.PopupViewElement; | |||
import com.vaadin.testbench.elements.VerticalLayoutElement; | |||
import com.vaadin.testbench.parallel.Browser; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
/** | |||
@@ -75,6 +75,6 @@ public class PopupViewResizeWhileOpenTest extends MultiBrowserTest { | |||
@Override | |||
public List<DesiredCapabilities> getBrowsersToTest() { | |||
return Collections.singletonList(Browser.IE8.getDesiredCapabilities()); | |||
return getBrowserCapabilities(Browser.IE8); | |||
} | |||
} |
@@ -16,8 +16,6 @@ | |||
package com.vaadin.tests.components.table; | |||
import java.io.IOException; | |||
import java.util.Arrays; | |||
import java.util.Collections; | |||
import java.util.List; | |||
import org.junit.Assert; | |||
@@ -29,22 +27,19 @@ import org.openqa.selenium.interactions.Actions; | |||
import org.openqa.selenium.remote.DesiredCapabilities; | |||
import com.vaadin.testbench.By; | |||
import com.vaadin.testbench.parallel.Browser; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
public class AddSelectionToRemovedRangeTest extends MultiBrowserTest { | |||
@Override | |||
public List<DesiredCapabilities> getBrowsersToTest() { | |||
return Collections.unmodifiableList(Arrays.asList(Browser.CHROME | |||
.getDesiredCapabilities())); | |||
protected boolean requireWindowFocusForIE() { | |||
return true; | |||
} | |||
@Override | |||
protected DesiredCapabilities getDesiredCapabilities() { | |||
DesiredCapabilities cap = new DesiredCapabilities( | |||
super.getDesiredCapabilities()); | |||
cap.setCapability("requireWindowFocus", true); | |||
return cap; | |||
public List<DesiredCapabilities> getBrowsersToTest() { | |||
return getBrowserCapabilities(Browser.CHROME); | |||
} | |||
@Test |
@@ -19,7 +19,6 @@ import static org.hamcrest.CoreMatchers.is; | |||
import static org.hamcrest.MatcherAssert.assertThat; | |||
import static org.hamcrest.Matchers.lessThan; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import org.junit.Test; | |||
@@ -28,25 +27,22 @@ import org.openqa.selenium.WebElement; | |||
import org.openqa.selenium.interactions.Actions; | |||
import org.openqa.selenium.remote.DesiredCapabilities; | |||
import com.vaadin.testbench.parallel.Browser; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
/** | |||
* Test for context menu position and size. | |||
* | |||
* | |||
* @author Vaadin Ltd | |||
*/ | |||
public class ContextMenuSizeTest extends MultiBrowserTest { | |||
@Override | |||
public List<DesiredCapabilities> getBrowsersToTest() { | |||
List<DesiredCapabilities> browsers = new ArrayList<DesiredCapabilities>( | |||
getAllBrowsers()); | |||
// context menu doesn't work in phantom JS and works weirdly with IE8 | |||
// and selenium. | |||
browsers.remove(Browser.PHANTOMJS.getDesiredCapabilities()); | |||
browsers.remove(Browser.IE8.getDesiredCapabilities()); | |||
return browsers; | |||
return getBrowserCapabilities(Browser.IE9, Browser.IE10, Browser.IE11, | |||
Browser.FIREFOX, Browser.CHROME); | |||
} | |||
@Override |
@@ -31,12 +31,7 @@ public class CtrlShiftMultiselectTest extends MultiBrowserTest { | |||
@Override | |||
public List<DesiredCapabilities> getBrowsersToTest() { | |||
List<DesiredCapabilities> browsers = super.getBrowsersToTest(); | |||
// Shift + click doesn't select all rows correctly on these browsers | |||
browsers.remove(Browser.FIREFOX.getDesiredCapabilities()); | |||
browsers.remove(Browser.PHANTOMJS.getDesiredCapabilities()); | |||
return browsers; | |||
return getBrowsersSupportingShiftClick(); | |||
} | |||
@Override |
@@ -14,14 +14,17 @@ import com.vaadin.tests.tb3.MultiBrowserTest; | |||
public class DisabledSortingTableTest extends MultiBrowserTest { | |||
Class<?> uiClass; | |||
@Override | |||
protected void closeApplication() { | |||
// need to close manually to use the correct ui class. | |||
} | |||
protected java.lang.Class<?> getUIClass() { | |||
return uiClass; | |||
}; | |||
@Test | |||
public void sortingByEmptyArrayShouldClearSortingIndicator() { | |||
openTestURL(DisabledSortingTable.class); | |||
uiClass = DisabledSortingTable.class; | |||
openTestURL(); | |||
assertThatFirstCellHasText("0"); | |||
@@ -32,13 +35,12 @@ public class DisabledSortingTableTest extends MultiBrowserTest { | |||
sortByEmptyArray(); | |||
assertThatFirstCellHasText("4"); | |||
openTestURL(DisabledSortingTable.class, "closeApplication"); | |||
} | |||
@Test | |||
public void emptySortingClearsIndicatorAndResetsSortingWithSQLContainer() { | |||
openTestURL(DisabledSortingTableSqlContainer.class); | |||
uiClass = DisabledSortingTableSqlContainer.class; | |||
openTestURL(); | |||
assertThatFirstCellHasText("1"); | |||
@@ -49,8 +51,6 @@ public class DisabledSortingTableTest extends MultiBrowserTest { | |||
sortByEmptyArray(); | |||
assertThatFirstCellHasText("1"); | |||
openTestURL(DisabledSortingTableSqlContainer.class, "closeApplication"); | |||
} | |||
private void sortFirstColumnAscending() { | |||
@@ -91,8 +91,8 @@ public class DisabledSortingTableTest extends MultiBrowserTest { | |||
@Override | |||
public String toString() { | |||
// Timed out after 10 seconds waiting for ... | |||
return String.format("header to get class name '%s'", | |||
className); | |||
return String | |||
.format("header to get class name '%s'", className); | |||
} | |||
}); | |||
} |
@@ -26,21 +26,18 @@ import org.openqa.selenium.WebElement; | |||
import com.vaadin.testbench.elements.ButtonElement; | |||
import com.vaadin.testbench.elements.TableElement; | |||
import com.vaadin.tests.tb3.AbstractTB3Test.RunLocally; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
import com.vaadin.tests.tb3.MultiBrowserTest.Browser; | |||
/** | |||
* Test case creating and deleting table component in a loop, testing memory | |||
* lead in Table component. This test should not be used in auto testing. | |||
* | |||
* | |||
* To test memory consuption. Run test in debug mode. Take memory snapshot in | |||
* Profiler in browser before and after the loop. Compare memory consuption. | |||
* | |||
* | |||
* @since | |||
* @author Vaadin Ltd | |||
*/ | |||
@RunLocally(Browser.CHROME) | |||
public class MemoryLeakTableTest extends MultiBrowserTest { | |||
/** |
@@ -18,7 +18,6 @@ package com.vaadin.tests.components.table; | |||
import static com.vaadin.tests.components.table.SelectAllRows.TOTAL_NUMBER_OF_ROWS; | |||
import static org.junit.Assert.assertEquals; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import org.junit.Test; | |||
@@ -51,12 +50,7 @@ public class SelectAllRowsTest extends MultiBrowserTest { | |||
@Override | |||
public List<DesiredCapabilities> getBrowsersToTest() { | |||
// Pressing Shift modifier key does not work with Firefox and PhantomJS | |||
ArrayList<DesiredCapabilities> browsers = new ArrayList<DesiredCapabilities>( | |||
super.getBrowsersToTest()); | |||
browsers.remove(Browser.FIREFOX.getDesiredCapabilities()); | |||
browsers.remove(Browser.PHANTOMJS.getDesiredCapabilities()); | |||
return browsers; | |||
return getBrowsersSupportingShiftClick(); | |||
} | |||
@Test |
@@ -1,26 +1,23 @@ | |||
package com.vaadin.tests.components.table; | |||
import com.vaadin.testbench.elements.ButtonElement; | |||
import com.vaadin.testbench.elements.TableElement; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
import static org.junit.Assert.assertEquals; | |||
import java.util.List; | |||
import org.junit.Test; | |||
import org.openqa.selenium.By; | |||
import org.openqa.selenium.WebElement; | |||
import org.openqa.selenium.remote.DesiredCapabilities; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import static org.junit.Assert.assertEquals; | |||
import com.vaadin.testbench.elements.ButtonElement; | |||
import com.vaadin.testbench.elements.TableElement; | |||
import com.vaadin.testbench.parallel.Browser; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
public class TableColumnResizeContentsWidthIE8Test extends MultiBrowserTest { | |||
@Override | |||
public List<DesiredCapabilities> getBrowsersToTest() { | |||
List<DesiredCapabilities> browsersToTest = new ArrayList<DesiredCapabilities>(); | |||
browsersToTest.add(Browser.IE8.getDesiredCapabilities()); | |||
return browsersToTest; | |||
return getBrowserCapabilities(Browser.IE8); | |||
} | |||
@Override |
@@ -15,9 +15,10 @@ | |||
*/ | |||
package com.vaadin.tests.components.table; | |||
import com.vaadin.testbench.elements.ButtonElement; | |||
import com.vaadin.testbench.elements.TableElement; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
import static org.junit.Assert.assertEquals; | |||
import java.util.List; | |||
import org.junit.Test; | |||
import org.openqa.selenium.By; | |||
import org.openqa.selenium.WebDriver; | |||
@@ -26,9 +27,9 @@ import org.openqa.selenium.interactions.Actions; | |||
import org.openqa.selenium.remote.DesiredCapabilities; | |||
import org.openqa.selenium.support.ui.ExpectedCondition; | |||
import java.util.List; | |||
import static org.junit.Assert.assertEquals; | |||
import com.vaadin.testbench.elements.ButtonElement; | |||
import com.vaadin.testbench.elements.TableElement; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
/** | |||
* Tests that components within table cells get resized when their column gets | |||
@@ -40,13 +41,7 @@ public class TableColumnResizeContentsWidthTest extends MultiBrowserTest { | |||
@Override | |||
public List<DesiredCapabilities> getBrowsersToTest() { | |||
List<DesiredCapabilities> browsersToTest = super.getBrowsersToTest(); | |||
// Can't get IE8 to hit the resizer, extracted IE8 to it's own test | |||
// class. | |||
browsersToTest.remove(Browser.IE8.getDesiredCapabilities()); | |||
return browsersToTest; | |||
return getBrowsersExcludingIE8(); | |||
} | |||
@Test |
@@ -18,7 +18,6 @@ package com.vaadin.tests.components.table; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.junit.Assert.fail; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import org.junit.Test; | |||
@@ -31,6 +30,7 @@ import org.openqa.selenium.remote.DesiredCapabilities; | |||
import org.openqa.selenium.support.ui.ExpectedCondition; | |||
import com.vaadin.testbench.elements.TableElement; | |||
import com.vaadin.testbench.parallel.Browser; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
/** | |||
@@ -47,15 +47,11 @@ public class TableNavigationPageDownTest extends MultiBrowserTest { | |||
private WebElement wrapper; | |||
@Override | |||
public List<DesiredCapabilities> getBrowsersToTest() { | |||
// Sending PageDown has no effect on PhantomJS. On IE focus | |||
// in Table is often lost, so default scrolling happens on PageDown. | |||
List<DesiredCapabilities> browsers = new ArrayList<DesiredCapabilities>( | |||
getBrowsersExcludingIE()); | |||
browsers.remove(Browser.PHANTOMJS.getDesiredCapabilities()); | |||
return browsers; | |||
return getBrowserCapabilities(Browser.FIREFOX, Browser.CHROME); | |||
} | |||
@Override | |||
@@ -73,7 +69,7 @@ public class TableNavigationPageDownTest extends MultiBrowserTest { | |||
} | |||
private void sendKeyUntilEndIsReached(Keys key) { | |||
while(true) { | |||
while (true) { | |||
int lastVisibleRowNumber = getLastVisibleRowNumber(); | |||
sendKey(key); | |||
@@ -116,7 +112,8 @@ public class TableNavigationPageDownTest extends MultiBrowserTest { | |||
@Test | |||
public void navigatePageDown() { | |||
// Scroll to a point where you can reach the bottom with a couple of page downs. | |||
// Scroll to a point where you can reach the bottom with a couple of | |||
// page downs. | |||
// Can't use v-table-body height because lower rows haven't been | |||
// fetched yet. | |||
testBenchElement(wrapper).scroll( | |||
@@ -132,7 +129,8 @@ public class TableNavigationPageDownTest extends MultiBrowserTest { | |||
@Test | |||
public void navigatePageUp() { | |||
// Scroll to a point where you can reach the top with a couple of page ups. | |||
// Scroll to a point where you can reach the top with a couple of page | |||
// ups. | |||
testBenchElement(wrapper).scroll((int) (2.8 * pageHeight)); | |||
waitForScrollToFinish(); | |||
@@ -31,10 +31,6 @@ import com.vaadin.testbench.screenshot.ImageComparison; | |||
import com.vaadin.testbench.screenshot.ReferenceNameGenerator; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
/** | |||
* | |||
* @author Vaadin Ltd | |||
*/ | |||
public class TableScrollAfterAddRowTest extends MultiBrowserTest { | |||
@Before | |||
@@ -45,6 +41,7 @@ public class TableScrollAfterAddRowTest extends MultiBrowserTest { | |||
@Test | |||
public void testJumpToFirstRow() throws InterruptedException { | |||
jumpToFifteenthRow(); | |||
sleep(300); | |||
jumpToFirstRow(); | |||
assertEquals("0", getCurrentPageFirstItemIndex()); | |||
} |
@@ -88,8 +88,6 @@ public class TableWithPollingTest extends MultiBrowserTest { | |||
// Selenium has issues with drag-and-drop on IE8 making it impossible to | |||
// drag a target as small as the table resizer. So we'll just have to | |||
// ignore IE8 completely. | |||
List<DesiredCapabilities> browsers = super.getBrowsersToTest(); | |||
browsers.remove(Browser.IE8.getDesiredCapabilities()); | |||
return browsers; | |||
return getBrowsersExcludingIE8(); | |||
} | |||
} |
@@ -34,6 +34,7 @@ import org.openqa.selenium.support.ui.WebDriverWait; | |||
import com.vaadin.testbench.By; | |||
import com.vaadin.testbench.commands.TestBenchCommandExecutor; | |||
import com.vaadin.testbench.parallel.BrowserUtil; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
public class UnnecessaryScrollbarWhenZoomingTest extends MultiBrowserTest { |
@@ -33,11 +33,9 @@ public class TabSheetFocusedTabTest extends MultiBrowserTest { | |||
@Override | |||
public List<DesiredCapabilities> getBrowsersToTest() { | |||
List<DesiredCapabilities> browsers = super.getBrowsersToTest(); | |||
// PhantomJS doesn't send Focus / Blur events when clicking or | |||
// navigating with keyboard | |||
browsers.remove(Browser.PHANTOMJS.getDesiredCapabilities()); | |||
return browsers; | |||
return getBrowsersExcludingPhantomJS(); | |||
} | |||
@Override |
@@ -15,7 +15,6 @@ | |||
*/ | |||
package com.vaadin.tests.components.ui; | |||
import java.util.Arrays; | |||
import java.util.List; | |||
import org.junit.Assert; | |||
@@ -24,6 +23,7 @@ import org.openqa.selenium.By; | |||
import org.openqa.selenium.WebElement; | |||
import org.openqa.selenium.remote.DesiredCapabilities; | |||
import com.vaadin.testbench.parallel.Browser; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
public class DynamicViewportEmptyTest extends MultiBrowserTest { | |||
@@ -35,7 +35,7 @@ public class DynamicViewportEmptyTest extends MultiBrowserTest { | |||
@Override | |||
public List<DesiredCapabilities> getBrowsersToTest() { | |||
return Arrays.asList(Browser.CHROME.getDesiredCapabilities()); | |||
return getBrowserCapabilities(Browser.CHROME); | |||
} | |||
@Test |
@@ -25,6 +25,7 @@ import org.openqa.selenium.interactions.Actions; | |||
import org.openqa.selenium.remote.DesiredCapabilities; | |||
import com.vaadin.testbench.elements.TextAreaElement; | |||
import com.vaadin.testbench.parallel.Browser; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
public class TextAreaEventPropagationModifierKeysTest extends MultiBrowserTest { | |||
@@ -67,17 +68,9 @@ public class TextAreaEventPropagationModifierKeysTest extends MultiBrowserTest { | |||
@Override | |||
public List<DesiredCapabilities> getBrowsersToTest() { | |||
List<DesiredCapabilities> browsers = super.getBrowsersToTest(); | |||
// Can't handle ctrl | |||
browsers.remove(Browser.IE8.getDesiredCapabilities()); | |||
browsers.remove(Browser.FIREFOX.getDesiredCapabilities()); | |||
// Can't handle shift or ctrl | |||
browsers.remove(Browser.IE9.getDesiredCapabilities()); | |||
browsers.remove(Browser.IE10.getDesiredCapabilities()); | |||
browsers.remove(Browser.IE11.getDesiredCapabilities()); | |||
return browsers; | |||
// IE8 and Firefox can't handle ctrl. | |||
// IE9-11 has issues with shift and ctrl | |||
return getBrowserCapabilities(Browser.CHROME, Browser.PHANTOMJS); | |||
} | |||
@Override |
@@ -22,7 +22,6 @@ import java.util.List; | |||
import org.junit.Test; | |||
import org.openqa.selenium.By; | |||
import org.openqa.selenium.StaleElementReferenceException; | |||
import org.openqa.selenium.WebElement; | |||
import com.vaadin.testbench.elements.ButtonElement; | |||
@@ -58,10 +57,7 @@ public class UIScrollingTest extends MultiBrowserTest { | |||
notification.findElement(By.tagName("h1")).getText()); | |||
// attempt to close the notification | |||
try { | |||
notification.closeNotification(); | |||
} catch (StaleElementReferenceException e) { | |||
} | |||
notification.close(); | |||
WebElement ui = findElement(By.className("v-ui")); | |||
testBenchElement(ui).scroll(1020); | |||
@@ -74,9 +70,7 @@ public class UIScrollingTest extends MultiBrowserTest { | |||
assertEquals("Scrolled to 1020 px", | |||
notification.findElement(By.tagName("h1")).getText()); | |||
try { | |||
notification.closeNotification(); | |||
} catch (StaleElementReferenceException e) { | |||
} | |||
notification.close(); | |||
} | |||
} |
@@ -41,9 +41,7 @@ public class TestFileUploadTest extends MultiBrowserTest { | |||
@Override | |||
public List<DesiredCapabilities> getBrowsersToTest() { | |||
// PhantomJS fails to upload files for unknown reasons | |||
List<DesiredCapabilities> b = super.getBrowsersToTest(); | |||
b.remove(Browser.PHANTOMJS.getDesiredCapabilities()); | |||
return b; | |||
return getBrowsersExcludingPhantomJS(); | |||
} | |||
@Test |
@@ -24,11 +24,13 @@ import org.openqa.selenium.By; | |||
import org.openqa.selenium.Keys; | |||
import org.openqa.selenium.WebDriver; | |||
import org.openqa.selenium.interactions.Actions; | |||
import org.openqa.selenium.remote.DesiredCapabilities; | |||
import org.openqa.selenium.support.ui.ExpectedCondition; | |||
import com.vaadin.testbench.elements.CheckBoxElement; | |||
import com.vaadin.testbench.elements.TextFieldElement; | |||
import com.vaadin.testbench.elements.WindowElement; | |||
import com.vaadin.testbench.parallel.BrowserUtil; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
/** | |||
@@ -101,12 +103,9 @@ public class CloseShortcutTest extends MultiBrowserTest { | |||
public void testOtherWithAll() { | |||
attemptOtherShortcut(); | |||
// TODO: remove this check once #14902 has been fixed | |||
if (!Browser.IE8.getDesiredCapabilities().equals( | |||
getDesiredCapabilities()) | |||
&& !Browser.FIREFOX.getDesiredCapabilities().equals( | |||
getDesiredCapabilities()) | |||
&& !Browser.CHROME.getDesiredCapabilities().equals( | |||
getDesiredCapabilities())) { | |||
DesiredCapabilities cap = getDesiredCapabilities(); | |||
if ((BrowserUtil.isIE(cap) && !BrowserUtil.isIE8(cap)) | |||
|| BrowserUtil.isPhantomJS(cap)) { | |||
ensureWindowClosed(); | |||
} | |||
} | |||
@@ -123,8 +122,7 @@ public class CloseShortcutTest extends MultiBrowserTest { | |||
public void testCtrlWithAll() { | |||
attemptCtrlShortcut(); | |||
// TODO: remove this check once #14902 has been fixed | |||
if (Browser.PHANTOMJS.getDesiredCapabilities().equals( | |||
getDesiredCapabilities())) { | |||
if (BrowserUtil.isPhantomJS(getDesiredCapabilities())) { | |||
ensureWindowClosed(); | |||
} | |||
} | |||
@@ -141,9 +139,8 @@ public class CloseShortcutTest extends MultiBrowserTest { | |||
public void testShiftWithAll() { | |||
attemptShiftShortcut(); | |||
// TODO: remove this check once #14902 has been fixed | |||
if (getBrowsersExcludingIE().contains(getDesiredCapabilities()) | |||
|| Browser.IE8.getDesiredCapabilities().equals( | |||
getDesiredCapabilities())) { | |||
DesiredCapabilities capabilities = getDesiredCapabilities(); | |||
if (!BrowserUtil.isIE(capabilities) || BrowserUtil.isIE8(capabilities)) { | |||
ensureWindowClosed(); | |||
} | |||
} |
@@ -15,7 +15,6 @@ | |||
*/ | |||
package com.vaadin.tests.components.window; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import org.junit.Assert; | |||
@@ -27,6 +26,7 @@ import org.openqa.selenium.WebElement; | |||
import org.openqa.selenium.interactions.Actions; | |||
import org.openqa.selenium.remote.DesiredCapabilities; | |||
import com.vaadin.testbench.parallel.Browser; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
/** | |||
@@ -48,18 +48,9 @@ public class SubWindowsTextSelectionTest extends MultiBrowserTest { | |||
return SubWindows.class; | |||
} | |||
/* | |||
* (non-Javadoc) | |||
* | |||
* @see com.vaadin.tests.tb3.MultiBrowserTest#getBrowsersToTest() | |||
*/ | |||
@Override | |||
public List<DesiredCapabilities> getBrowsersToTest() { | |||
ArrayList<DesiredCapabilities> list = new ArrayList<DesiredCapabilities>(); | |||
list.add(BrowserUtil.ie(9)); | |||
list.add(BrowserUtil.ie(10)); | |||
list.add(BrowserUtil.ie(11)); | |||
return list; | |||
return getBrowserCapabilities(Browser.IE9, Browser.IE10, Browser.IE11); | |||
} | |||
@Test |
@@ -7,7 +7,7 @@ import java.util.List; | |||
import org.junit.Test; | |||
import org.openqa.selenium.remote.DesiredCapabilities; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
import com.vaadin.testbench.parallel.Browser; | |||
import com.vaadin.tests.tb3.SingleBrowserTest; | |||
public class WindowBGColorChameleonIE8Test extends SingleBrowserTest { | |||
@@ -19,9 +19,7 @@ public class WindowBGColorChameleonIE8Test extends SingleBrowserTest { | |||
*/ | |||
@Override | |||
public List<DesiredCapabilities> getBrowsersToTest() { | |||
return Arrays.asList(MultiBrowserTest.Browser.IE8 | |||
.getDesiredCapabilities()); | |||
return Arrays.asList(Browser.IE8.getDesiredCapabilities()); | |||
} | |||
@Test |
@@ -17,7 +17,6 @@ package com.vaadin.tests.components.window; | |||
import java.awt.AWTException; | |||
import java.io.IOException; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import org.junit.Test; | |||
@@ -61,9 +60,6 @@ public class WindowShadowTest extends MultiBrowserTest { | |||
// ignore this browser in testing | |||
@Override | |||
public List<DesiredCapabilities> getBrowsersToTest() { | |||
List<DesiredCapabilities> browsers = new ArrayList<DesiredCapabilities>( | |||
getAllBrowsers()); | |||
browsers.remove(Browser.IE8.getDesiredCapabilities()); | |||
return browsers; | |||
return getBrowsersExcludingIE8(); | |||
} | |||
} |
@@ -24,7 +24,7 @@ import org.openqa.selenium.Keys; | |||
import org.openqa.selenium.WebElement; | |||
import org.openqa.selenium.interactions.Actions; | |||
import com.vaadin.tests.annotations.TestCategory; | |||
import com.vaadin.testbench.parallel.TestCategory; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
/** |
@@ -43,7 +43,7 @@ public class SetThemeAndResponsiveLayoutTest extends MultiBrowserTest { | |||
public List<DesiredCapabilities> getBrowsersToTest() { | |||
// Seems like stylesheet onload is not fired on PhantomJS | |||
// https://github.com/ariya/phantomjs/issues/12332 | |||
return super.getBrowsersExcludingPhantomJS(); | |||
return getBrowsersExcludingPhantomJS(); | |||
} | |||
@Test |
@@ -27,7 +27,7 @@ import com.vaadin.testbench.elements.DateFieldElement; | |||
import com.vaadin.testbench.elements.GridElement; | |||
import com.vaadin.testbench.elements.GridElement.GridCellElement; | |||
import com.vaadin.testbench.elements.GridElement.GridEditorElement; | |||
import com.vaadin.tests.annotations.TestCategory; | |||
import com.vaadin.testbench.parallel.TestCategory; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
@TestCategory("grid") |
@@ -15,8 +15,8 @@ | |||
*/ | |||
package com.vaadin.tests.integration; | |||
import com.vaadin.testbench.parallel.TestNameSuffix; | |||
import com.vaadin.tests.tb3.PrivateTB3Configuration; | |||
import com.vaadin.tests.tb3.TestNameSuffix; | |||
/** | |||
* Base class for integration tests. Integration tests use the |
@@ -15,7 +15,6 @@ | |||
*/ | |||
package com.vaadin.tests.layouts; | |||
import java.util.Collections; | |||
import java.util.List; | |||
import org.junit.Assert; | |||
@@ -23,6 +22,7 @@ import org.junit.Test; | |||
import org.openqa.selenium.JavascriptExecutor; | |||
import org.openqa.selenium.remote.DesiredCapabilities; | |||
import com.vaadin.testbench.parallel.Browser; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
public class IE8MeasuredSizeMemoryLeakTest extends MultiBrowserTest { | |||
@@ -49,6 +49,6 @@ public class IE8MeasuredSizeMemoryLeakTest extends MultiBrowserTest { | |||
@Override | |||
public List<DesiredCapabilities> getBrowsersToTest() { | |||
return Collections.singletonList(Browser.IE8.getDesiredCapabilities()); | |||
return getBrowserCapabilities(Browser.IE8); | |||
} | |||
} |
@@ -19,7 +19,7 @@ import org.junit.Assert; | |||
import org.junit.Test; | |||
import org.openqa.selenium.WebElement; | |||
import com.vaadin.tests.annotations.TestCategory; | |||
import com.vaadin.testbench.parallel.TestCategory; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
@TestCategory("push") |
@@ -20,7 +20,7 @@ import org.openqa.selenium.WebDriver; | |||
import org.openqa.selenium.WebElement; | |||
import org.openqa.selenium.support.ui.ExpectedCondition; | |||
import com.vaadin.tests.annotations.TestCategory; | |||
import com.vaadin.testbench.parallel.TestCategory; | |||
import com.vaadin.tests.tb3.AbstractTB3Test; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
@@ -20,7 +20,7 @@ import static org.junit.Assert.assertEquals; | |||
import org.junit.Test; | |||
import org.openqa.selenium.WebElement; | |||
import com.vaadin.tests.annotations.TestCategory; | |||
import com.vaadin.testbench.parallel.TestCategory; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
@TestCategory("push") |
@@ -18,7 +18,7 @@ package com.vaadin.tests.push; | |||
import org.junit.Assert; | |||
import org.junit.Test; | |||
import com.vaadin.tests.annotations.TestCategory; | |||
import com.vaadin.testbench.parallel.TestCategory; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
@TestCategory("push") |
@@ -22,7 +22,7 @@ import org.openqa.selenium.WebElement; | |||
import org.openqa.selenium.support.ui.ExpectedCondition; | |||
import com.vaadin.testbench.elements.NativeSelectElement; | |||
import com.vaadin.tests.annotations.TestCategory; | |||
import com.vaadin.testbench.parallel.TestCategory; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
@TestCategory("push") |
@@ -28,13 +28,7 @@ public class PushConfigurationWebSocketTest extends PushConfigurationTest { | |||
@Override | |||
public List<DesiredCapabilities> getBrowsersToTest() { | |||
List<DesiredCapabilities> browsers = super.getBrowsersToTest(); | |||
browsers.remove(Browser.IE8.getDesiredCapabilities()); | |||
browsers.remove(Browser.IE9.getDesiredCapabilities()); | |||
browsers.remove(Browser.PHANTOMJS.getDesiredCapabilities()); | |||
return browsers; | |||
return getBrowsersSupportingWebSocket(); | |||
} | |||
@Test |
@@ -21,7 +21,8 @@ import org.openqa.selenium.By; | |||
import org.openqa.selenium.WebElement; | |||
import com.vaadin.testbench.elements.LabelElement; | |||
import com.vaadin.tests.annotations.TestCategory; | |||
import com.vaadin.testbench.parallel.BrowserUtil; | |||
import com.vaadin.testbench.parallel.TestCategory; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
@TestCategory("push") |
@@ -19,7 +19,7 @@ import org.junit.Test; | |||
import org.openqa.selenium.WebDriver; | |||
import org.openqa.selenium.support.ui.ExpectedCondition; | |||
import com.vaadin.tests.annotations.TestCategory; | |||
import com.vaadin.testbench.parallel.TestCategory; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
@TestCategory("push") |
@@ -19,7 +19,7 @@ import org.junit.Test; | |||
import org.openqa.selenium.By; | |||
import org.openqa.selenium.support.ui.ExpectedConditions; | |||
import com.vaadin.tests.annotations.TestCategory; | |||
import com.vaadin.testbench.parallel.TestCategory; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
@TestCategory("push") |
@@ -19,7 +19,7 @@ import org.junit.Test; | |||
import org.openqa.selenium.By; | |||
import org.openqa.selenium.support.ui.ExpectedConditions; | |||
import com.vaadin.tests.annotations.TestCategory; | |||
import com.vaadin.testbench.parallel.TestCategory; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
@TestCategory("push") |
@@ -17,13 +17,12 @@ package com.vaadin.tests.push; | |||
import java.util.List; | |||
import com.vaadin.tests.annotations.TestCategory; | |||
import org.junit.Assert; | |||
import org.junit.Test; | |||
import org.openqa.selenium.remote.DesiredCapabilities; | |||
import com.vaadin.testbench.parallel.TestCategory; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
import com.vaadin.tests.tb3.WebsocketTest; | |||
@TestCategory("push") | |||
public class RefreshCloseConnectionTest extends MultiBrowserTest { |
@@ -1,10 +1,11 @@ | |||
package com.vaadin.tests.push; | |||
import org.junit.Test; | |||
import com.vaadin.testbench.By; | |||
import com.vaadin.testbench.elements.TextAreaElement; | |||
import com.vaadin.tests.annotations.TestCategory; | |||
import com.vaadin.testbench.parallel.TestCategory; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
import org.junit.Test; | |||
@TestCategory("push") | |||
public abstract class SendMultibyteCharactersTest extends MultiBrowserTest { |
@@ -19,7 +19,7 @@ import org.junit.Assert; | |||
import org.junit.Test; | |||
import org.openqa.selenium.WebElement; | |||
import com.vaadin.tests.annotations.TestCategory; | |||
import com.vaadin.testbench.parallel.TestCategory; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
@TestCategory("push") |
@@ -18,7 +18,7 @@ package com.vaadin.tests.push; | |||
import org.junit.Assert; | |||
import org.junit.Test; | |||
import com.vaadin.tests.annotations.TestCategory; | |||
import com.vaadin.testbench.parallel.TestCategory; | |||
import com.vaadin.tests.tb3.MultiBrowserTest; | |||
@TestCategory("push") |
@@ -16,15 +16,9 @@ | |||
package com.vaadin.tests.tb3; | |||
import static com.vaadin.tests.tb3.TB3Runner.localWebDriverIsUsed; | |||
import java.io.IOException; | |||
import java.io.InputStream; | |||
import java.io.StringWriter; | |||
import java.lang.annotation.ElementType; | |||
import java.lang.annotation.Retention; | |||
import java.lang.annotation.RetentionPolicy; | |||
import java.lang.annotation.Target; | |||
import java.lang.reflect.Field; | |||
import java.net.URL; | |||
import java.util.ArrayList; | |||
@@ -38,22 +32,17 @@ import org.apache.http.HttpHost; | |||
import org.apache.http.HttpResponse; | |||
import org.apache.http.impl.client.DefaultHttpClient; | |||
import org.apache.http.message.BasicHttpEntityEnclosingRequest; | |||
import org.junit.After; | |||
import org.junit.Before; | |||
import org.junit.Rule; | |||
import org.junit.runner.RunWith; | |||
import org.openqa.selenium.By; | |||
import org.openqa.selenium.JavascriptExecutor; | |||
import org.openqa.selenium.Platform; | |||
import org.openqa.selenium.WebDriver; | |||
import org.openqa.selenium.WebElement; | |||
import org.openqa.selenium.ie.InternetExplorerDriver; | |||
import org.openqa.selenium.interactions.HasInputDevices; | |||
import org.openqa.selenium.interactions.Keyboard; | |||
import org.openqa.selenium.interactions.Mouse; | |||
import org.openqa.selenium.interactions.internal.Coordinates; | |||
import org.openqa.selenium.internal.Locatable; | |||
import org.openqa.selenium.remote.BrowserType; | |||
import org.openqa.selenium.remote.DesiredCapabilities; | |||
import org.openqa.selenium.remote.HttpCommandExecutor; | |||
import org.openqa.selenium.remote.RemoteWebDriver; | |||
@@ -65,17 +54,17 @@ import com.google.gwt.thirdparty.guava.common.base.Joiner; | |||
import com.thoughtworks.selenium.webdriven.WebDriverBackedSelenium; | |||
import com.vaadin.server.LegacyApplication; | |||
import com.vaadin.server.UIProvider; | |||
import com.vaadin.testbench.TestBench; | |||
import com.vaadin.testbench.TestBenchDriverProxy; | |||
import com.vaadin.testbench.TestBenchElement; | |||
import com.vaadin.testbench.TestBenchTestCase; | |||
import com.vaadin.testbench.elements.AbstractElement; | |||
import com.vaadin.testbench.annotations.BrowserConfiguration; | |||
import com.vaadin.testbench.elements.CheckBoxElement; | |||
import com.vaadin.testbench.elements.LabelElement; | |||
import com.vaadin.testbench.elements.TableElement; | |||
import com.vaadin.testbench.elements.VerticalLayoutElement; | |||
import com.vaadin.testbench.parallel.Browser; | |||
import com.vaadin.testbench.parallel.BrowserUtil; | |||
import com.vaadin.testbench.parallel.ParallelTest; | |||
import com.vaadin.tests.components.AbstractTestUIWithLog; | |||
import com.vaadin.tests.tb3.MultiBrowserTest.Browser; | |||
import com.vaadin.ui.UI; | |||
import elemental.json.JsonObject; | |||
@@ -97,8 +86,8 @@ import elemental.json.impl.JsonUtil; | |||
* | |||
* @author Vaadin Ltd | |||
*/ | |||
@RunWith(value = TB3Runner.class) | |||
public abstract class AbstractTB3Test extends TestBenchTestCase { | |||
@RunWith(TB3Runner.class) | |||
public abstract class AbstractTB3Test extends ParallelTest { | |||
@Rule | |||
public RetryOnFail retry = new RetryOnFail(); | |||
@@ -118,17 +107,9 @@ public abstract class AbstractTB3Test extends TestBenchTestCase { | |||
*/ | |||
private static final int BROWSER_TIMEOUT_IN_MS = 30 * 1000; | |||
private static final int BROWSER_INIT_ATTEMPTS = 5; | |||
private DesiredCapabilities desiredCapabilities; | |||
private boolean debug = false; | |||
private boolean push = false; | |||
{ | |||
// Default browser to run on unless setDesiredCapabilities is called | |||
desiredCapabilities = Browser.FIREFOX.getDesiredCapabilities(); | |||
} | |||
static { | |||
com.vaadin.testbench.Parameters | |||
@@ -141,61 +122,14 @@ public abstract class AbstractTB3Test extends TestBenchTestCase { | |||
* | |||
* @throws Exception | |||
*/ | |||
@Before | |||
@Override | |||
public void setup() throws Exception { | |||
setupDriver(); | |||
} | |||
/** | |||
* Creates and configure the web driver to be used for the test. By default | |||
* creates a remote web driver which connects to {@link #getHubURL()} and | |||
* selects a browser based on {@link #getDesiredCapabilities()}. | |||
* | |||
* This method MUST call {@link #setDriver(WebDriver)} with the newly | |||
* generated driver. | |||
* | |||
* @throws Exception | |||
* If something goes wrong | |||
*/ | |||
protected void setupDriver() throws Exception { | |||
DesiredCapabilities capabilities; | |||
Browser runLocallyBrowser = getRunLocallyBrowser(); | |||
if (runLocallyBrowser != null) { | |||
if (System.getenv().containsKey("TEAMCITY_VERSION")) { | |||
throw new RuntimeException( | |||
"@RunLocally is not supported for tests run on the build server"); | |||
} | |||
capabilities = runLocallyBrowser.getDesiredCapabilities(); | |||
setupLocalDriver(capabilities); | |||
} else { | |||
capabilities = getDesiredCapabilities(); | |||
for (int i = 1; i <= BROWSER_INIT_ATTEMPTS; i++) { | |||
try { | |||
if (localWebDriverIsUsed()) { | |||
setupLocalDriver(capabilities); | |||
} else { | |||
setupRemoteDriver(capabilities); | |||
} | |||
break; | |||
} catch (Exception e) { | |||
System.err | |||
.println("Browser startup for " + capabilities | |||
+ " failed on attempt " + i + ": " | |||
+ e.getMessage()); | |||
if (i == BROWSER_INIT_ATTEMPTS) { | |||
throw e; | |||
} | |||
} | |||
} | |||
} | |||
super.setup(); | |||
int w = SCREENSHOT_WIDTH; | |||
int h = SCREENSHOT_HEIGHT; | |||
if (BrowserUtil.isIE8(capabilities)) { | |||
if (BrowserUtil.isIE8(super.getDesiredCapabilities())) { | |||
// IE8 gets size wrong, who would have guessed... | |||
w += 4; | |||
h += 4; | |||
@@ -208,12 +142,16 @@ public abstract class AbstractTB3Test extends TestBenchTestCase { | |||
} | |||
protected Browser getRunLocallyBrowser() { | |||
RunLocally runLocally = getClass().getAnnotation(RunLocally.class); | |||
if (runLocally != null) { | |||
return runLocally.value(); | |||
} else { | |||
return null; | |||
/** | |||
* Method for closing the tested application. | |||
*/ | |||
protected void closeApplication() { | |||
if (driver != null) { | |||
try { | |||
openTestURL("closeApplication"); | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
} | |||
} | |||
} | |||
@@ -276,47 +214,6 @@ public abstract class AbstractTB3Test extends TestBenchTestCase { | |||
waitUntilRowIsVisible(table, rowToWait); | |||
} | |||
@Retention(RetentionPolicy.RUNTIME) | |||
@Target(ElementType.TYPE) | |||
public @interface RunLocally { | |||
public Browser value() default Browser.FIREFOX; | |||
} | |||
/** | |||
* Creates a {@link WebDriver} instance used for running the test locally | |||
* for debug purposes. Used only when {@link #runLocally()} is overridden to | |||
* return true; | |||
*/ | |||
protected abstract void setupLocalDriver( | |||
DesiredCapabilities desiredCapabilities); | |||
/** | |||
* Creates a {@link WebDriver} instance used for running the test remotely. | |||
* | |||
* @since | |||
* @param capabilities | |||
* the type of browser needed | |||
* @throws Exception | |||
*/ | |||
private void setupRemoteDriver(DesiredCapabilities capabilities) | |||
throws Exception { | |||
if (BrowserUtil.isIE(capabilities)) { | |||
if (requireWindowFocusForIE()) { | |||
capabilities.setCapability( | |||
InternetExplorerDriver.REQUIRE_WINDOW_FOCUS, true); | |||
} | |||
if (!usePersistentHoverForIE()) { | |||
capabilities.setCapability( | |||
InternetExplorerDriver.ENABLE_PERSISTENT_HOVERING, | |||
false); | |||
} | |||
} | |||
WebDriver dr = TestBench.createDriver(new RemoteWebDriver(new URL( | |||
getHubURL()), capabilities)); | |||
setDriver(dr); | |||
} | |||
/** | |||
* Opens the given test (defined by {@link #getTestUrl()}, optionally with | |||
* debug window and/or push (depending on {@link #isDebug()} and | |||
@@ -334,7 +231,7 @@ public abstract class AbstractTB3Test extends TestBenchTestCase { | |||
protected void openTestURL(Class<?> uiClass, String... parameters) { | |||
String url = getTestURL(uiClass); | |||
if(parameters.length > 0) { | |||
if (parameters.length > 0) { | |||
url += "?" + Joiner.on("&").join(parameters); | |||
} | |||
@@ -352,28 +249,14 @@ public abstract class AbstractTB3Test extends TestBenchTestCase { | |||
/** | |||
* Returns the full URL to be used for the test for the provided UI class. | |||
* | |||
* | |||
* @return the full URL for the test | |||
*/ | |||
protected String getTestURL(Class<?> uiClass) { | |||
return StringUtils.strip(getBaseURL(), "/") + getDeploymentPath(uiClass); | |||
return StringUtils.strip(getBaseURL(), "/") | |||
+ getDeploymentPath(uiClass); | |||
} | |||
/** | |||
* | |||
* @return the location (URL) of the TB hub | |||
*/ | |||
protected String getHubURL() { | |||
return "http://" + getHubHostname() + ":4444/wd/hub"; | |||
} | |||
/** | |||
* Used for building the hub URL to use for the test | |||
* | |||
* @return the host name of the TestBench hub | |||
*/ | |||
protected abstract String getHubHostname(); | |||
/** | |||
* Used to determine what URL to initially open for the test | |||
* | |||
@@ -401,58 +284,12 @@ public abstract class AbstractTB3Test extends TestBenchTestCase { | |||
* | |||
* @return The browsers to run the test on | |||
*/ | |||
@BrowserConfiguration | |||
public List<DesiredCapabilities> getBrowsersToTest() { | |||
return Collections.singletonList(Browser.FIREFOX | |||
.getDesiredCapabilities()); | |||
} | |||
/** | |||
* Used to determine which capabilities should be used when setting up a | |||
* {@link WebDriver} for this test. Typically set by a test runner or left | |||
* at its default (Firefox 24). If you want to run a test on a single | |||
* browser other than Firefox 24 you can override this method. | |||
* | |||
* @return the requested browser capabilities | |||
*/ | |||
protected DesiredCapabilities getDesiredCapabilities() { | |||
return desiredCapabilities; | |||
} | |||
/** | |||
* Sets the requested browser capabilities (typically browser name and | |||
* version) | |||
* | |||
* @param desiredCapabilities | |||
*/ | |||
public void setDesiredCapabilities(DesiredCapabilities desiredCapabilities) { | |||
// Make a copy as the desired capabilities can come from a shared, | |||
// static resource. This will cause all kinds of problems if some test | |||
// modifies the capabilities | |||
this.desiredCapabilities = new DesiredCapabilities(desiredCapabilities); | |||
} | |||
/** | |||
* Shuts down the driver after the test has been completed | |||
* | |||
* @throws Exception | |||
*/ | |||
@After | |||
public void tearDown() throws Exception { | |||
if (driver != null) { | |||
try { | |||
closeApplication(); | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
} | |||
driver.quit(); | |||
} | |||
driver = null; | |||
} | |||
protected void closeApplication() { | |||
openTestURL("closeApplication"); | |||
} | |||
/** | |||
* Finds an element based on the part of a TB2 style locator following the | |||
* :: (e.g. vaadin=runLabelModes::PID_Scheckboxaction-Enabled/domChild[0] -> | |||
@@ -912,264 +749,6 @@ public abstract class AbstractTB3Test extends TestBenchTestCase { | |||
} | |||
} | |||
/** | |||
* Provides helper method for selecting the browser to run on | |||
* | |||
* @author Vaadin Ltd | |||
*/ | |||
public static class BrowserUtil { | |||
/** | |||
* Gets the capabilities for Safari of the given version | |||
* | |||
* @param version | |||
* the major version | |||
* @return an object describing the capabilities required for running a | |||
* test on the given Safari version | |||
*/ | |||
public static DesiredCapabilities safari(int version) { | |||
DesiredCapabilities c = DesiredCapabilities.safari(); | |||
c.setPlatform(Platform.MAC); | |||
c.setVersion("" + version); | |||
return c; | |||
} | |||
/** | |||
* Gets the capabilities for Chrome of the given version | |||
* | |||
* @param version | |||
* the major version | |||
* @return an object describing the capabilities required for running a | |||
* test on the given Chrome version | |||
*/ | |||
public static DesiredCapabilities chrome(int version) { | |||
DesiredCapabilities c = DesiredCapabilities.chrome(); | |||
c.setVersion("" + version); | |||
c.setPlatform(Platform.VISTA); | |||
return c; | |||
} | |||
/** | |||
* Gets the capabilities for Opera of the given version | |||
* | |||
* @param version | |||
* the major version | |||
* @return an object describing the capabilities required for running a | |||
* test on the given Opera version | |||
*/ | |||
public static DesiredCapabilities opera(int version) { | |||
DesiredCapabilities c = DesiredCapabilities.opera(); | |||
c.setVersion("" + version); | |||
c.setPlatform(Platform.XP); | |||
return c; | |||
} | |||
/** | |||
* Gets the capabilities for Firefox of the given version | |||
* | |||
* @param version | |||
* the major version | |||
* @return an object describing the capabilities required for running a | |||
* test on the given Firefox version | |||
*/ | |||
public static DesiredCapabilities firefox(int version) { | |||
DesiredCapabilities c = DesiredCapabilities.firefox(); | |||
c.setVersion("" + version); | |||
c.setPlatform(Platform.XP); | |||
return c; | |||
} | |||
/** | |||
* Gets the capabilities for Internet Explorer of the given version | |||
* | |||
* @param version | |||
* the major version | |||
* @return an object describing the capabilities required for running a | |||
* test on the given Internet Explorer version | |||
*/ | |||
public static DesiredCapabilities ie(int version) { | |||
DesiredCapabilities c = DesiredCapabilities.internetExplorer(); | |||
c.setVersion("" + version); | |||
c.setCapability(InternetExplorerDriver.IE_ENSURE_CLEAN_SESSION, | |||
true); | |||
return c; | |||
} | |||
/** | |||
* Gets the capabilities for PhantomJS of the given version | |||
* | |||
* @param version | |||
* the major version | |||
* @return an object describing the capabilities required for running a | |||
* test on the given PhantomJS version | |||
*/ | |||
public static DesiredCapabilities phantomJS(int version) { | |||
DesiredCapabilities c = DesiredCapabilities.phantomjs(); | |||
c.setPlatform(Platform.LINUX); | |||
c.setVersion("" + version); | |||
return c; | |||
} | |||
/** | |||
* Checks if the given capabilities refer to Internet Explorer 8 | |||
* | |||
* @param capabilities | |||
* @param version | |||
* @return true if the capabilities refer to IE8, false otherwise | |||
*/ | |||
public static boolean isIE8(DesiredCapabilities capabilities) { | |||
return isIE(8, capabilities); | |||
} | |||
/** | |||
* Checks if the given capabilities refer to Internet Explorer of the | |||
* given version | |||
* | |||
* @param capabilities | |||
* @param version | |||
* @return true if the capabilities refer to IE of the given version, | |||
* false otherwise | |||
*/ | |||
public static boolean isIE(int version, DesiredCapabilities capabilities) { | |||
return isIE(capabilities) | |||
&& ("" + version).equals(capabilities.getVersion()); | |||
} | |||
/** | |||
* @param capabilities | |||
* The capabilities to check | |||
* @return true if the capabilities refer to Internet Explorer, false | |||
* otherwise | |||
*/ | |||
public static boolean isIE(DesiredCapabilities capabilities) { | |||
return BrowserType.IE.equals(capabilities.getBrowserName()); | |||
} | |||
/** | |||
* @param capabilities | |||
* The capabilities to check | |||
* @return true if the capabilities refer to Chrome, false otherwise | |||
*/ | |||
public static boolean isChrome(DesiredCapabilities capabilities) { | |||
return BrowserType.CHROME.equals(capabilities.getBrowserName()); | |||
} | |||
/** | |||
* @param capabilities | |||
* The capabilities to check | |||
* @return true if the capabilities refer to Opera, false otherwise | |||
*/ | |||
public static boolean isOpera(DesiredCapabilities capabilities) { | |||
return BrowserType.OPERA.equals(capabilities.getBrowserName()); | |||
} | |||
/** | |||
* @param capabilities | |||
* The capabilities to check | |||
* @return true if the capabilities refer to Safari, false otherwise | |||
*/ | |||
public static boolean isSafari(DesiredCapabilities capabilities) { | |||
return BrowserType.SAFARI.equals(capabilities.getBrowserName()); | |||
} | |||
/** | |||
* @param capabilities | |||
* The capabilities to check | |||
* @return true if the capabilities refer to Firefox, false otherwise | |||
*/ | |||
public static boolean isFirefox(DesiredCapabilities capabilities) { | |||
return BrowserType.FIREFOX.equals(capabilities.getBrowserName()); | |||
} | |||
/** | |||
* @param capabilities | |||
* The capabilities to check | |||
* @return true if the capabilities refer to PhantomJS, false otherwise | |||
*/ | |||
public static boolean isPhantomJS(DesiredCapabilities capabilities) { | |||
return BrowserType.PHANTOMJS.equals(capabilities.getBrowserName()); | |||
} | |||
/** | |||
* Returns a human readable identifier of the given browser. Used for | |||
* test naming and screenshots | |||
* | |||
* @param capabilities | |||
* @return a human readable string describing the capabilities | |||
*/ | |||
public static String getBrowserIdentifier( | |||
DesiredCapabilities capabilities) { | |||
if (isIE(capabilities)) { | |||
return "InternetExplorer"; | |||
} else if (isFirefox(capabilities)) { | |||
return "Firefox"; | |||
} else if (isChrome(capabilities)) { | |||
return "Chrome"; | |||
} else if (isSafari(capabilities)) { | |||
return "Safari"; | |||
} else if (isOpera(capabilities)) { | |||
return "Opera"; | |||
} else if (isPhantomJS(capabilities)) { | |||
return "PhantomJS"; | |||
} | |||
return capabilities.getBrowserName(); | |||
} | |||
/** | |||
* Returns a human readable identifier of the platform described by the | |||
* given capabilities. Used mainly for screenshots | |||
* | |||
* @param capabilities | |||
* @return a human readable string describing the platform | |||
*/ | |||
public static String getPlatform(DesiredCapabilities capabilities) { | |||
if (capabilities.getPlatform() == Platform.WIN8 | |||
|| capabilities.getPlatform() == Platform.WINDOWS | |||
|| capabilities.getPlatform() == Platform.VISTA | |||
|| capabilities.getPlatform() == Platform.XP) { | |||
return "Windows"; | |||
} else if (capabilities.getPlatform() == Platform.MAC) { | |||
return "Mac"; | |||
} | |||
return capabilities.getPlatform().toString(); | |||
} | |||
/** | |||
* Returns a string which uniquely (enough) identifies this browser. | |||
* Used mainly in screenshot names. | |||
* | |||
* @param capabilities | |||
* | |||
* @return a unique string for each browser | |||
*/ | |||
public static String getUniqueIdentifier( | |||
DesiredCapabilities capabilities) { | |||
return getUniqueIdentifier(getPlatform(capabilities), | |||
getBrowserIdentifier(capabilities), | |||
capabilities.getVersion()); | |||
} | |||
/** | |||
* Returns a string which uniquely (enough) identifies this browser. | |||
* Used mainly in screenshot names. | |||
* | |||
* @param capabilities | |||
* | |||
* @return a unique string for each browser | |||
*/ | |||
public static String getUniqueIdentifier( | |||
DesiredCapabilities capabilities, String versionOverride) { | |||
return getUniqueIdentifier(getPlatform(capabilities), | |||
getBrowserIdentifier(capabilities), versionOverride); | |||
} | |||
private static String getUniqueIdentifier(String platform, | |||
String browser, String version) { | |||
return platform + "_" + browser + "_" + version; | |||
} | |||
} | |||
/** | |||
* Called by the test runner whenever there is an exception in the test that | |||
* will cause termination of the test | |||
@@ -1342,17 +921,4 @@ public abstract class AbstractTB3Test extends TestBenchTestCase { | |||
protected void click(CheckBoxElement checkbox) { | |||
checkbox.findElement(By.xpath("input")).click(); | |||
} | |||
@Override | |||
public boolean isElementPresent(Class<? extends AbstractElement> clazz) { | |||
// This is a bug in TB4 as isElementPresent(..) should just return true | |||
// or false but can also throw exceptions. The problem is possibly if | |||
// this is run when the Vaadin app is not initialized yet | |||
try { | |||
return super.isElementPresent(clazz); | |||
} catch (NoSuchElementException e) { | |||
return false; | |||
} | |||
} | |||
} |
@@ -1,5 +1,7 @@ | |||
package com.vaadin.tests.tb3; | |||
import java.io.IOException; | |||
import org.junit.runner.RunWith; | |||
import org.junit.runners.model.InitializationError; | |||
@@ -18,7 +20,8 @@ public class AffectedTB3Tests { | |||
public static class AffectedTB3TestSuite extends TB3TestSuite { | |||
public AffectedTB3TestSuite(Class<?> klass) throws InitializationError { | |||
public AffectedTB3TestSuite(Class<?> klass) throws InitializationError, | |||
IOException { | |||
super(klass, AbstractTB3Test.class, "com.vaadin.tests", | |||
new String[] { "com.vaadin.tests.integration" }, | |||
new AffectedTB3TestLocator()); |
@@ -16,6 +16,8 @@ | |||
package com.vaadin.tests.tb3; | |||
import java.io.IOException; | |||
import org.junit.runner.RunWith; | |||
import org.junit.runners.model.InitializationError; | |||
@@ -32,7 +34,8 @@ public class AllTB3Tests { | |||
public static class AllTB3TestsSuite extends TB3TestSuite { | |||
public AllTB3TestsSuite(Class<?> klass) throws InitializationError { | |||
public AllTB3TestsSuite(Class<?> klass) throws InitializationError, | |||
IOException { | |||
super(klass, AbstractTB3Test.class, "com.vaadin.tests", | |||
new String[] { "com.vaadin.tests.integration" }); | |||
} |
@@ -15,6 +15,8 @@ | |||
*/ | |||
package com.vaadin.tests.tb3; | |||
import java.io.IOException; | |||
import org.junit.runner.RunWith; | |||
import org.junit.runners.model.InitializationError; | |||
@@ -31,7 +33,8 @@ import com.vaadin.tests.tb3.ChangedTB3Tests.ChangedTB3TestsSuite; | |||
@RunWith(ChangedTB3TestsSuite.class) | |||
public class ChangedTB3Tests { | |||
public static class ChangedTB3TestsSuite extends TB3TestSuite { | |||
public ChangedTB3TestsSuite(Class<?> klass) throws InitializationError { | |||
public ChangedTB3TestsSuite(Class<?> klass) throws InitializationError, | |||
IOException { | |||
super(klass, AbstractTB3Test.class, "com.vaadin.tests", | |||
new String[] { "com.vaadin.tests.integration" }, | |||
new ChangedTB3TestLocator()); |
@@ -19,6 +19,8 @@ import org.junit.Ignore; | |||
import org.openqa.selenium.WebElement; | |||
import org.openqa.selenium.interactions.Actions; | |||
import com.vaadin.testbench.parallel.BrowserUtil; | |||
/** | |||
* Base class for TestBench 3+ tests that use DnD. This class contains utility | |||
* methods for DnD operations. |
@@ -17,11 +17,14 @@ | |||
package com.vaadin.tests.tb3; | |||
import java.util.ArrayList; | |||
import java.util.Collections; | |||
import java.util.List; | |||
import org.openqa.selenium.ie.InternetExplorerDriver; | |||
import org.openqa.selenium.remote.DesiredCapabilities; | |||
import com.vaadin.testbench.parallel.Browser; | |||
import com.vaadin.testbench.parallel.BrowserUtil; | |||
/** | |||
* Base class for tests which should be run on all supported browsers. The test | |||
* is automatically launched for multiple browsers in parallel by the test | |||
@@ -41,100 +44,67 @@ import org.openqa.selenium.remote.DesiredCapabilities; | |||
public abstract class MultiBrowserTest extends PrivateTB3Configuration { | |||
protected List<DesiredCapabilities> getBrowsersSupportingWebSocket() { | |||
List<DesiredCapabilities> browsers = new ArrayList<DesiredCapabilities>( | |||
getAllBrowsers()); | |||
browsers.remove(Browser.IE8.getDesiredCapabilities()); | |||
browsers.remove(Browser.IE9.getDesiredCapabilities()); | |||
browsers.remove(Browser.PHANTOMJS.getDesiredCapabilities()); | |||
return browsers; | |||
// No WebSocket support in IE8-9 and PhantomJS | |||
return getBrowserCapabilities(Browser.IE10, Browser.IE11, | |||
Browser.FIREFOX, Browser.CHROME); | |||
} | |||
protected List<DesiredCapabilities> getBrowsersExcludingPhantomJS() { | |||
List<DesiredCapabilities> browsers = new ArrayList<DesiredCapabilities>( | |||
getAllBrowsers()); | |||
browsers.remove(Browser.PHANTOMJS.getDesiredCapabilities()); | |||
return browsers; | |||
return getBrowserCapabilities(Browser.IE8, Browser.IE9, Browser.IE10, | |||
Browser.IE11, Browser.CHROME, Browser.FIREFOX); | |||
} | |||
protected List<DesiredCapabilities> getBrowsersExcludingIE() { | |||
List<DesiredCapabilities> browsers = new ArrayList<DesiredCapabilities>( | |||
getAllBrowsers()); | |||
browsers.remove(Browser.IE8.getDesiredCapabilities()); | |||
browsers.remove(Browser.IE9.getDesiredCapabilities()); | |||
browsers.remove(Browser.IE10.getDesiredCapabilities()); | |||
browsers.remove(Browser.IE11.getDesiredCapabilities()); | |||
return getBrowserCapabilities(Browser.FIREFOX, Browser.CHROME, | |||
Browser.PHANTOMJS); | |||
} | |||
return browsers; | |||
protected List<DesiredCapabilities> getBrowsersExcludingIE8() { | |||
return getBrowserCapabilities(Browser.IE9, Browser.IE10, Browser.IE11, | |||
Browser.FIREFOX, Browser.CHROME, Browser.PHANTOMJS); | |||
} | |||
protected List<DesiredCapabilities> getBrowsersSupportingShiftClick() { | |||
List<DesiredCapabilities> browsers = new ArrayList<DesiredCapabilities>( | |||
getAllBrowsers()); | |||
// IE supports shift click only when require window focus is true | |||
browsers.remove(Browser.FIREFOX.getDesiredCapabilities()); | |||
browsers.remove(Browser.PHANTOMJS.getDesiredCapabilities()); | |||
return browsers; | |||
return getBrowserCapabilities(Browser.IE8, Browser.IE9, Browser.IE10, | |||
Browser.IE11, Browser.CHROME); | |||
} | |||
protected List<DesiredCapabilities> getIEBrowsersOnly() { | |||
List<DesiredCapabilities> browsers = new ArrayList<DesiredCapabilities>(); | |||
browsers.add(Browser.IE8.getDesiredCapabilities()); | |||
browsers.add(Browser.IE9.getDesiredCapabilities()); | |||
browsers.add(Browser.IE10.getDesiredCapabilities()); | |||
browsers.add(Browser.IE11.getDesiredCapabilities()); | |||
return browsers; | |||
return getBrowserCapabilities(Browser.IE8, Browser.IE9, Browser.IE10, | |||
Browser.IE11); | |||
} | |||
public enum Browser { | |||
FIREFOX(BrowserUtil.firefox(24)), CHROME(BrowserUtil.chrome(40)), SAFARI( | |||
BrowserUtil.safari(7)), IE8(BrowserUtil.ie(8)), IE9(BrowserUtil | |||
.ie(9)), IE10(BrowserUtil.ie(10)), IE11(BrowserUtil.ie(11)), OPERA( | |||
BrowserUtil.opera(17)), PHANTOMJS(BrowserUtil.phantomJS(1)); | |||
private DesiredCapabilities desiredCapabilities; | |||
private Browser(DesiredCapabilities desiredCapabilities) { | |||
this.desiredCapabilities = desiredCapabilities; | |||
} | |||
public DesiredCapabilities getDesiredCapabilities() { | |||
return desiredCapabilities; | |||
@Override | |||
public void setDesiredCapabilities(DesiredCapabilities desiredCapabilities) { | |||
if (BrowserUtil.isIE(desiredCapabilities)) { | |||
if (requireWindowFocusForIE()) { | |||
desiredCapabilities.setCapability( | |||
InternetExplorerDriver.REQUIRE_WINDOW_FOCUS, true); | |||
} | |||
if (!usePersistentHoverForIE()) { | |||
desiredCapabilities.setCapability( | |||
InternetExplorerDriver.ENABLE_PERSISTENT_HOVERING, | |||
false); | |||
} | |||
} | |||
} | |||
static List<DesiredCapabilities> allBrowsers = new ArrayList<DesiredCapabilities>(); | |||
static { | |||
allBrowsers.add(Browser.IE8.getDesiredCapabilities()); | |||
allBrowsers.add(Browser.IE9.getDesiredCapabilities()); | |||
allBrowsers.add(Browser.IE10.getDesiredCapabilities()); | |||
allBrowsers.add(Browser.IE11.getDesiredCapabilities()); | |||
allBrowsers.add(Browser.FIREFOX.getDesiredCapabilities()); | |||
// Uncomment once we have the capability to run on Safari 6 | |||
// allBrowsers.add(SAFARI); | |||
allBrowsers.add(Browser.CHROME.getDesiredCapabilities()); | |||
allBrowsers.add(Browser.PHANTOMJS.getDesiredCapabilities()); | |||
// Re-enable this when it is possible to run on a modern Opera version | |||
// allBrowsers.add(Browser.OPERA.getDesiredCapabilities()); | |||
} | |||
/** | |||
* @return all supported browsers which are actively tested | |||
*/ | |||
public static List<DesiredCapabilities> getAllBrowsers() { | |||
return Collections.unmodifiableList(allBrowsers); | |||
super.setDesiredCapabilities(desiredCapabilities); | |||
} | |||
@Override | |||
public List<DesiredCapabilities> getBrowsersToTest() { | |||
// Return a copy so sub classes can do | |||
// super.getBrowseresToTest().remove(something) | |||
return new ArrayList<DesiredCapabilities>(getAllBrowsers()); | |||
// Uncomment Safari and Opera if those become tested browsers again. | |||
return getBrowserCapabilities(Browser.IE8, Browser.IE9, Browser.IE10, | |||
Browser.IE11, Browser.FIREFOX, Browser.CHROME, | |||
Browser.PHANTOMJS /* , Browser.SAFARI, Browser.OPERA */); | |||
} | |||
protected List<DesiredCapabilities> getBrowserCapabilities( | |||
Browser... browsers) { | |||
List<DesiredCapabilities> capabilities = new ArrayList<DesiredCapabilities>(); | |||
for (Browser browser : browsers) { | |||
capabilities.add(browser.getDesiredCapabilities()); | |||
} | |||
return capabilities; | |||
} | |||
} |
@@ -23,7 +23,7 @@ import org.junit.After; | |||
import com.jcraft.jsch.JSch; | |||
import com.jcraft.jsch.JSchException; | |||
import com.jcraft.jsch.Session; | |||
import com.vaadin.tests.annotations.TestCategory; | |||
import com.vaadin.testbench.parallel.TestCategory; | |||
@TestCategory("push") | |||
public abstract class MultiBrowserTestWithProxy extends MultiBrowserTest { |