diff options
author | Artur Signell <artur@vaadin.com> | 2015-09-01 13:08:07 +0300 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2015-09-02 16:54:47 +0300 |
commit | 1c45292021467d41ac8afecd0ece1f2d98a3962a (patch) | |
tree | 5780fece2208943ffff1fd59115c00b508b7c8f3 /uitest/src/com/vaadin/tests/tb3 | |
parent | 50c3190131f0cf003401d78e8b374f6fe36a0984 (diff) | |
download | vaadin-framework-1c45292021467d41ac8afecd0ece1f2d98a3962a.tar.gz vaadin-framework-1c45292021467d41ac8afecd0ece1f2d98a3962a.zip |
Reconnect dialog theme and functionality tests (#11733)
Change-Id: Ie4a940ba2488f0a7739492a1d3967957cdd41099
Diffstat (limited to 'uitest/src/com/vaadin/tests/tb3')
3 files changed, 63 insertions, 3 deletions
diff --git a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java index 842fcbb859..385a4477e1 100644 --- a/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java +++ b/uitest/src/com/vaadin/tests/tb3/AbstractTB3Test.java @@ -368,8 +368,8 @@ public abstract class AbstractTB3Test extends ParallelTest { * {@link org.openqa.selenium.JavascriptExecutor#executeScript(String, Object...)} * returns */ - protected Object executeScript(String script) { - return ((JavascriptExecutor) getDriver()).executeScript(script); + protected Object executeScript(String script, Object... args) { + return ((JavascriptExecutor) getDriver()).executeScript(script, args); } /** @@ -464,6 +464,15 @@ public abstract class AbstractTB3Test extends ParallelTest { waitUntil(ExpectedConditions.presenceOfElementLocated(by)); } + protected void waitForElementNotPresent(final By by) { + waitUntil(new ExpectedCondition<Boolean>() { + @Override + public Boolean apply(WebDriver input) { + return input.findElements(by).isEmpty(); + } + }); + } + protected void waitForElementVisible(final By by) { waitUntil(ExpectedConditions.visibilityOfElementLocated(by)); } diff --git a/uitest/src/com/vaadin/tests/tb3/CustomTestBenchCommandExecutor.java b/uitest/src/com/vaadin/tests/tb3/CustomTestBenchCommandExecutor.java index a70eeeeb49..00d7788f8b 100644 --- a/uitest/src/com/vaadin/tests/tb3/CustomTestBenchCommandExecutor.java +++ b/uitest/src/com/vaadin/tests/tb3/CustomTestBenchCommandExecutor.java @@ -118,7 +118,7 @@ public class CustomTestBenchCommandExecutor { * @return * @throws IOException */ - private BufferedImage cropToElement(WebElement element, + public static BufferedImage cropToElement(WebElement element, BufferedImage fullScreen, boolean isIE8) throws IOException { Point loc = element.getLocation(); Dimension size = element.getSize(); diff --git a/uitest/src/com/vaadin/tests/tb3/MultiBrowserThemeTestWithProxy.java b/uitest/src/com/vaadin/tests/tb3/MultiBrowserThemeTestWithProxy.java new file mode 100644 index 0000000000..142aa0ccc6 --- /dev/null +++ b/uitest/src/com/vaadin/tests/tb3/MultiBrowserThemeTestWithProxy.java @@ -0,0 +1,51 @@ +/* + * 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.tb3; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.openqa.selenium.remote.DesiredCapabilities; + +/** + * Test which uses theme returned by {@link #getTheme()} for running the test + */ +public abstract class MultiBrowserThemeTestWithProxy extends + MultiBrowserTestWithProxy { + + protected abstract String getTheme(); + + @Override + protected boolean requireWindowFocusForIE() { + return true; + } + + @Override + protected void openTestURL(Class<?> uiClass, String... parameters) { + Set<String> params = new HashSet<String>(Arrays.asList(parameters)); + params.add("theme=" + getTheme()); + super.openTestURL(uiClass, params.toArray(new String[params.size()])); + } + + @Override + public List<DesiredCapabilities> getBrowsersToTest() { + List<DesiredCapabilities> browsersToTest = getBrowsersExcludingPhantomJS(); + browsersToTest.add(PHANTOMJS2()); + return browsersToTest; + } +} |