]> source.dussan.org Git - vaadin-framework.git/commitdiff
Run local tests on localhost
authorArtur Signell <artur@vaadin.com>
Wed, 3 Jun 2015 05:44:02 +0000 (08:44 +0300)
committerVaadin Code Review <review@vaadin.com>
Fri, 5 Jun 2015 13:14:48 +0000 (13:14 +0000)
* Allows running test when offline

Change-Id: Ifb1d9ab60c299d6bbf31381fc26e50c639db8dc4

uitest/src/com/vaadin/tests/tb3/PrivateTB3Configuration.java

index 77b9b9ef7de4ac9e7d5e1eaa3ae1a68b9c47f75c..1c0542b2097f7376ded050b0e8be144450cdb93d 100644 (file)
@@ -141,6 +141,9 @@ public abstract class PrivateTB3Configuration extends ScreenshotTB3Test {
 
     @Override
     protected String getBaseURL() {
+        if (isRunLocally()) {
+            return "http://localhost:8888";
+        }
         String url = getProperty(DEPLOYMENT_PROPERTY);
         if (url == null || url.trim().isEmpty()) {
             return super.getBaseURL();
@@ -150,12 +153,26 @@ public abstract class PrivateTB3Configuration extends ScreenshotTB3Test {
 
     @Override
     protected String getDeploymentHostname() {
-        if (getRunLocallyBrowser() != null) {
+        if (isRunLocally()) {
             return "localhost";
         }
         return getConfiguredDeploymentHostname();
     }
 
+    private boolean isRunLocally() {
+        if (properties.containsKey(RUN_LOCALLY_PROPERTY)) {
+            return true;
+        }
+
+        if (properties.containsKey(ALLOW_RUN_LOCALLY_PROPERTY)
+                && properties.get(ALLOW_RUN_LOCALLY_PROPERTY).equals("true")
+                && getClass().getAnnotation(RunLocally.class) != null) {
+            return true;
+        }
+
+        return false;
+    }
+
     /**
      * Gets the hostname that tests are configured to use.
      *