summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <tsuoanttila@users.noreply.github.com>2018-05-04 17:09:48 +0300
committerGitHub <noreply@github.com>2018-05-04 17:09:48 +0300
commit1c53b2b7ed35be4a0a08aa0c2698e6a93c3b9b0c (patch)
tree0fb4684938f03cd55ed44ae5e2e0eb415c76349c
parent7aa9c79617009e6b33b710873ebdbddd9b91a463 (diff)
downloadvaadin-framework-1c53b2b7ed35be4a0a08aa0c2698e6a93c3b9b0c.tar.gz
vaadin-framework-1c53b2b7ed35be4a0a08aa0c2698e6a93c3b9b0c.zip
Add properties for local XVFB cluster testing (#10863)
-rw-r--r--uitest/eclipse-run-selected-test.properties84
-rw-r--r--uitest/src/test/java/com/vaadin/tests/tb3/PrivateTB3Configuration.java17
2 files changed, 42 insertions, 59 deletions
diff --git a/uitest/eclipse-run-selected-test.properties b/uitest/eclipse-run-selected-test.properties
index 355fe6b501..c73182861d 100644
--- a/uitest/eclipse-run-selected-test.properties
+++ b/uitest/eclipse-run-selected-test.properties
@@ -1,63 +1,45 @@
-;
-; This is an example property file showing how to control how TestBench is used
-; in the Vaadin Framework project. You should not modify this file since it's
-; under version control. Instead, create a copy of it inside the /work/ folder
-; in the project and make your customizations to that file.
-;
-
-;
-; For both TestBench 2 and 4
-;
-
-; Location of the screenshot directory.
-; This is the directory that contains the "references" directory
-com.vaadin.testbench.screenshot.directory=<enter the full path to the screenshots directory, parent of "references" directory>
-
-
-; Deployment url to use for testing. Context path must be /
-; com.vaadin.testbench.deployment.url=http://<enter your ip here>:8888/
+#
+# This is an example property file showing how to control how TestBench is used
+# in the Vaadin Framework project. You should not modify this file since it's
+# under version control. Instead, create a copy of it inside the /work/ folder
+# in the project and make your customizations to that file.
+#
+# Path names on Windows should replace '\' with '\\' to parse and use those correctly.
+#
+
+# Location of the screenshot directory. This is mutually exclusive with the folder settings for XVFB testing.
+# This is the directory that contains the "references" directory
-;
-; For only TestBench 4
-;
-
-; Simulates @RunLocally with the given value on all test classes without a @RunLocally annotation.
-; Use simple browser name (phantomjs, chrome, firefox, ie8, ie9, ie10, ie11)
-; com.vaadin.testbench.runLocally=firefox
+com.vaadin.testbench.screenshot.directory=<enter the full path to the screenshots directory, parent of "references" directory>
-; Optional override to specify the location of the Firefox/PhantomJS binary
-; firefox.path=/usr/bin/firefox
-; phantomjs.binary.path=/usr/bin/phantomjs
+# Deployment url to use for testing. Context path must be /
-; By default using @RunLocally annotation in Framework tests is not allowed.
-; Running tests locally can be done with com.vaadin.testbench.runLocally parameter above.
-; Uncomment the following line if you want to be able to use @RunLocally annotation
-; com.vaadin.testbench.allowRunLocally=true
+#com.vaadin.testbench.deployment.url=http://<enter your ip here>:8888/
-;
-; For only TestBench 2
-;
+# Simulates @RunLocally with the given value on all test classes without a @RunLocally annotation.
+# Use simple browser name (phantomjs, chrome, firefox, ie8, ie9, ie10, ie11)
-; Location where TestBench 2 jar can be found
-com.vaadin.testbench.lib.dir=<enter location of testbench here>
+#com.vaadin.testbench.runLocally=firefox
-; Run the whole test even if a screenshot comparison fails
-com.vaadin.testbench.screenshot.softfail=true
+# Optional override to specify the location of the Firefox/PhantomJS binary
-; Screen capture at the end if the test fails
-com.vaadin.testbench.screenshot.onfail=true
+#firefox.path=/usr/bin/firefox
+#phantomjs.binary.path=/usr/bin/phantomjs
-; Enable cursor detection
-com.vaadin.testbench.screenshot.cursor=true
+# By default using @RunLocally annotation in Framework tests is not allowed.
+# Running tests locally can be done with com.vaadin.testbench.runLocally parameter above.
+# Uncomment the following line if you want to be able to use @RunLocally annotation
-; Run the test case that is focused in Eclipse. Must be set in Eclipse launch configuration and not here.
-; testfiles=${resource_loc}
+#com.vaadin.testbench.allowRunLocally=true
-; Uncomment to limit to certain browsers or override in launch configuration
-; browsers=winxp-opera10
+#
+# Running local instance of XVFB testing cluster. Uncomment all lines below.
+# Fill in the full path for uitest folder and remember to comment out the other screenshot folder.
+#
-; Claim that the server has started successfully. Needed for TB2 tests to be executed
-server.start.succeeded=1
+#com.vaadin.testbench.Parameters.screenshotReferenceDirectory=<path to uitest>/reference-screenshots
+#com.vaadin.testbench.Parameters.screenshotErrorDirectory=<path to uitest>/target/error-screenshots
-; Directory where temporary Java classes are created
-test-output-dir=../build/test-output
+#com.vaadin.testbench.hub.url=http://localhost:4444/wd/hub
+#browser.factory=com.vaadin.tests.tb3.XvfbHubBrowserFactory
+#browsers.exclude=internet explorer11,phantomjs1,phantomjs2 \ No newline at end of file
diff --git a/uitest/src/test/java/com/vaadin/tests/tb3/PrivateTB3Configuration.java b/uitest/src/test/java/com/vaadin/tests/tb3/PrivateTB3Configuration.java
index ebeea11c38..4d4f83ea4f 100644
--- a/uitest/src/test/java/com/vaadin/tests/tb3/PrivateTB3Configuration.java
+++ b/uitest/src/test/java/com/vaadin/tests/tb3/PrivateTB3Configuration.java
@@ -13,6 +13,7 @@ import java.util.Calendar;
import java.util.Enumeration;
import java.util.Locale;
import java.util.Properties;
+import java.util.stream.Stream;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
@@ -34,6 +35,7 @@ import com.vaadin.testbench.parallel.BrowserUtil;
@RunOnHub("tb3-hub.intra.itmill.com")
@BrowserFactory(VaadinBrowserFactory.class)
public abstract class PrivateTB3Configuration extends ScreenshotTB3Test {
+ private static final String BROWSER_FACTORY = "browser.factory";
public static final String SCREENSHOT_DIRECTORY = "com.vaadin.testbench.screenshot.directory";
private static final String HOSTNAME_PROPERTY = "com.vaadin.testbench.deployment.hostname";
private static final String RUN_LOCALLY_PROPERTY = "com.vaadin.testbench.runLocally";
@@ -46,6 +48,7 @@ public abstract class PrivateTB3Configuration extends ScreenshotTB3Test {
"eclipse-run-selected-test.properties");
private static final String FIREFOX_PATH = "firefox.path";
private static final String PHANTOMJS_PATH = "phantomjs.binary.path";
+ private static final String BROWSERS_EXCLUDE = "browsers.exclude";
static {
if (propertiesFile.exists()) {
@@ -61,14 +64,12 @@ public abstract class PrivateTB3Configuration extends ScreenshotTB3Test {
System.setProperty("browsers.include",
localBrowser.getBrowserName() + localBrowser.getVersion());
}
- if (properties.containsKey(FIREFOX_PATH)) {
- System.setProperty(FIREFOX_PATH,
- properties.getProperty(FIREFOX_PATH));
- }
- if (properties.containsKey(PHANTOMJS_PATH)) {
- System.setProperty(PHANTOMJS_PATH,
- properties.getProperty(PHANTOMJS_PATH));
- }
+
+ // Read properties from the file.
+ Stream.of(FIREFOX_PATH, PHANTOMJS_PATH, BROWSER_FACTORY,
+ BROWSERS_EXCLUDE).filter(properties::containsKey)
+ .forEach(property -> System.setProperty(property,
+ properties.getProperty(property)));
String dir = System.getProperty(SCREENSHOT_DIRECTORY,
properties.getProperty(SCREENSHOT_DIRECTORY));